mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
712 lines
31 KiB
V
712 lines
31 KiB
V
module pem
|
|
|
|
// example PEM structures from the RFC
|
|
fn test_decode_rfc1421() {
|
|
for i in 0 .. pem.test_data_rfc1421.len {
|
|
decoded, rest := decode(pem.test_data_rfc1421[i]) or { Block{}, '' }
|
|
assert decoded == pem.expected_results_rfc1421[i]
|
|
assert decoded == decode_only(pem.test_data_rfc1421[i]) or { Block{} }
|
|
assert rest == ''
|
|
}
|
|
}
|
|
|
|
fn test_decode() {
|
|
for i in 0 .. pem.test_data.len {
|
|
decoded, rest := decode(pem.test_data[i]) or { Block{}, '' }
|
|
assert decoded == pem.expected_results[i]
|
|
assert decoded == decode_only(pem.test_data[i]) or { Block{} }
|
|
assert rest == pem.expected_rest[i]
|
|
}
|
|
}
|
|
|
|
fn test_encode_rfc1421() {
|
|
for i in 0 .. pem.test_data_rfc1421.len {
|
|
encoded := pem.expected_results_rfc1421[i].encode() or { '' }
|
|
decoded, rest := decode(encoded) or { Block{}, '' }
|
|
assert rest == ''
|
|
assert decoded == pem.expected_results_rfc1421[i]
|
|
assert decoded == decode_only(encoded) or { Block{} }
|
|
}
|
|
}
|
|
|
|
fn test_encode() {
|
|
for i in 0 .. pem.test_data.len {
|
|
encoded := pem.expected_results[i].encode() or { '' }
|
|
decoded, rest := decode(encoded) or { Block{}, '' }
|
|
assert rest == ''
|
|
assert decoded == pem.expected_results[i]
|
|
assert decoded == decode_only(encoded) or { Block{} }
|
|
}
|
|
}
|
|
|
|
fn test_encode_config() {
|
|
for i in 0 .. pem.test_data.len {
|
|
encoded := pem.expected_results[i].encode(EncodeConfig{31, '\r\n'}) or { '' }
|
|
decoded, rest := decode(encoded) or { Block{}, '' }
|
|
assert rest == ''
|
|
assert decoded == pem.expected_results[i]
|
|
assert decoded == decode_only(encoded) or { Block{} }
|
|
}
|
|
}
|
|
|
|
fn test_decode_no_pem() {
|
|
for test in pem.test_data_no_pem {
|
|
if _, _ := decode(test) {
|
|
assert false, 'decode should return `none` on input without PEM data'
|
|
}
|
|
if _ := decode_only(test) {
|
|
assert false, 'decode_only should return `none` on input without PEM data'
|
|
}
|
|
}
|
|
}
|
|
|
|
const test_data_no_pem = [
|
|
'',
|
|
'-----BEGIN',
|
|
'-----BEGIN -----',
|
|
'-----END',
|
|
]
|
|
|
|
// https://datatracker.ietf.org/doc/html/rfc7468#section-4
|
|
const test_data_rfc1421 = [
|
|
'-----BEGIN PRIVACY-ENHANCED MESSAGE-----
|
|
Proc-Type: 4,MIC-ONLY
|
|
Content-Domain: RFC822
|
|
Originator-Certificate:
|
|
MIIBlTCCAScCAWUwDQYJKoZIhvcNAQECBQAwUTELMAkGA1UEBhMCVVMxIDAeBgNV
|
|
BAoTF1JTQSBEYXRhIFNlY3VyaXR5LCBJbmMuMQ8wDQYDVQQLEwZCZXRhIDExDzAN
|
|
BgNVBAsTBk5PVEFSWTAeFw05MTA5MDQxODM4MTdaFw05MzA5MDMxODM4MTZaMEUx
|
|
CzAJBgNVBAYTAlVTMSAwHgYDVQQKExdSU0EgRGF0YSBTZWN1cml0eSwgSW5jLjEU
|
|
MBIGA1UEAxMLVGVzdCBVc2VyIDEwWTAKBgRVCAEBAgICAANLADBIAkEAwHZHl7i+
|
|
yJcqDtjJCowzTdBJrdAiLAnSC+CnnjOJELyuQiBgkGrgIh3j8/x0fM+YrsyF1u3F
|
|
LZPVtzlndhYFJQIDAQABMA0GCSqGSIb3DQEBAgUAA1kACKr0PqphJYw1j+YPtcIq
|
|
iWlFPuN5jJ79Khfg7ASFxskYkEMjRNZV/HZDZQEhtVaU7Jxfzs2wfX5byMp2X3U/
|
|
5XUXGx7qusDgHQGs7Jk9W8CW1fuSWUgN4w==
|
|
Issuer-Certificate:
|
|
MIIB3DCCAUgCAQowDQYJKoZIhvcNAQECBQAwTzELMAkGA1UEBhMCVVMxIDAeBgNV
|
|
BAoTF1JTQSBEYXRhIFNlY3VyaXR5LCBJbmMuMQ8wDQYDV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Az/7R7XhjYCm0PcqbdzoACZtIlETrKrcJiDYoP+DkZ8k1gCk7hQHpbIwIDAQAB
|
|
MA0GCSqGSIb3DQEBAgUAA38AAICPv4f9Gx/tY4+p+4DB7MV+tKZnvBoy8zgoMGOx
|
|
dD2jMZ/3HsyWKWgSF0eH/AJB3qr9zosG47pyMnTf3aSy2nBO7CMxpUWRBcXUpE+x
|
|
EREZd9++32ofGBIXaialnOgVUn0OzSYgugiQ077nJLDUj0hQehCizEs5wUJ35a5h
|
|
MIC-Info: RSA-MD5,RSA,
|
|
UdFJR8u/TIGhfH65ieewe2lOW4tooa3vZCvVNGBZirf/7nrgzWDABz8w9NsXSexv
|
|
AjRFbHoNPzBuxwmOAFeA0HJszL4yBvhG
|
|
Recipient-ID-Asymmetric:
|
|
MFExCzAJBgNVBAYTAlVTMSAwHgYDVQQKExdSU0EgRGF0YSBTZWN1cml0eSwgSW5j
|
|
LjEPMA0GA1UECxMGQmV0YSAxMQ8wDQYDVQQLEwZOT1RBUlk=,
|
|
66
|
|
Key-Info: RSA,
|
|
O6BS1ww9CTyHPtS3bMLD+L0hejdvX6Qv1HK2ds2sQPEaXhX8EhvVphHYTjwekdWv
|
|
7x0Z3Jx2vTAhOYHMcqqCjA==
|
|
|
|
qeWlj/YJ2Uf5ng9yznPbtD0mYloSwIuV9FRYx+gzY+8iXd/NQrXHfi6/MhPfPF3d
|
|
jIqCJAxvld2xgqQimUzoS1a4r7kQQ5c/Iua4LqKeq3ciFzEv/MbZhA==
|
|
-----END PRIVACY-ENHANCED MESSAGE-----',
|
|
'-----BEGIN PRIVACY-ENHANCED MESSAGE-----
|
|
Proc-Type: 4,ENCRYPTED
|
|
Content-Domain: RFC822
|
|
DEK-Info: DES-CBC,F8143EDE5960C597
|
|
Originator-ID-Symmetric: linn@zendia.enet.dec.com,,
|
|
Recipient-ID-Symmetric: linn@zendia.enet.dec.com,ptf-kmc,3
|
|
Key-Info: DES-ECB,RSA-MD2,9FD3AAD2F2691B9A,
|
|
B70665BB9BF7CBCDA60195DB94F727D3
|
|
Recipient-ID-Symmetric: pem-dev@tis.com,ptf-kmc,4
|
|
Key-Info: DES-ECB,RSA-MD2,161A3F75DC82EF26,
|
|
E2EF532C65CBCFF79F83A2658132DB47
|
|
|
|
LLrHB0eJzyhP+/fSStdW8okeEnv47jxe7SJ/iN72ohNcUk2jHEUSoH1nvNSIWL9M
|
|
8tEjmF/zxB+bATMtPjCUWbz8Lr9wloXIkjHUlBLpvXR0UrUzYbkNpk0agV2IzUpk
|
|
J6UiRRGcDSvzrsoK+oNvqu6z7Xs5Xfz5rDqUcMlK1Z6720dcBWGGsDLpTpSCnpot
|
|
dXd/H5LMDWnonNvPCwQUHt==
|
|
-----END PRIVACY-ENHANCED MESSAGE-----',
|
|
]
|
|
|
|
const expected_results_rfc1421 = [
|
|
Block{
|
|
block_type: 'PRIVACY-ENHANCED MESSAGE'
|
|
headers: {
|
|
'Proc-Type': ['4,MIC-ONLY']
|
|
'Content-Domain': ['RFC822']
|
|
'Originator-Certificate': [
|
|
'MIIBlTCCAScCAWUwDQYJKoZIhvcNAQECBQAwUTELMAkGA1UEBhMCVVMxIDAeBgNVBAoTF1JTQSBEYXRhIFNlY3VyaXR5LCBJbmMuMQ8wDQYDVQQLEwZCZXRhIDExDzANBgNVBAsTBk5PVEFSWTAeFw05MTA5MDQxODM4MTdaFw05MzA5MDMxODM4MTZaMEUxCzAJBgNVBAYTAlVTMSAwHgYDVQQKExdSU0EgRGF0YSBTZWN1cml0eSwgSW5jLjEUMBIGA1UEAxMLVGVzdCBVc2VyIDEwWTAKBgRVCAEBAgICAANLADBIAkEAwHZHl7i+yJcqDtjJCowzTdBJrdAiLAnSC+CnnjOJELyuQiBgkGrgIh3j8/x0fM+YrsyF1u3FLZPVtzlndhYFJQIDAQABMA0GCSqGSIb3DQEBAgUAA1kACKr0PqphJYw1j+YPtcIqiWlFPuN5jJ79Khfg7ASFxskYkEMjRNZV/HZDZQEhtVaU7Jxfzs2wfX5byMp2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,
|
|
0x0a, 0x2d, 0x20, 0x46, 0x6f, 0x6c, 0x6c, 0x6f,
|
|
0x77, 0x69, 0x6e, 0x67, 0x20, 0x69, 0x73, 0x20,
|
|
0x61, 0x20, 0x62, 0x6c, 0x61, 0x6e, 0x6b, 0x20,
|
|
0x6c, 0x69, 0x6e, 0x65, 0x3a, 0x0d, 0x0a, 0x0d,
|
|
0x0a, 0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73,
|
|
0x20, 0x74, 0x68, 0x65, 0x20, 0x65, 0x6e, 0x64,
|
|
0x2e, 0x0d, 0x0a,
|
|
]
|
|
// vfmt on
|
|
},
|
|
Block{
|
|
block_type: 'PRIVACY-ENHANCED MESSAGE'
|
|
headers: {
|
|
'Proc-Type': [
|
|
'4,ENCRYPTED',
|
|
]
|
|
'Content-Domain': [
|
|
'RFC822',
|
|
]
|
|
'DEK-Info': [
|
|
'DES-CBC,BFF968AA74691AC1',
|
|
]
|
|
'Originator-Certificate': [
|
|
'MIIBlTCCAScCAWUwDQYJKoZIhvcNAQECBQAwUTELMAkGA1UEBhMCVVMxIDAeBgNVBAoTF1JTQSBEYXRhIFNlY3VyaXR5LCBJbmMuMQ8wDQYDVQQLEwZCZXRhIDExDzANBgNVBAsTBk5PVEFSWTAeFw05MTA5MDQxODM4MTdaFw05MzA5MDMxODM4MTZaMEUxCzAJBgNVBAYTAlVTMSAwHgYDVQQKExdSU0EgRGF0YSBTZWN1cml0eSwgSW5jLjEUMBIGA1UEAxMLVGVzdCBVc2VyIDEwWTAKBgRVCAEBAgICAANLADBIAkEAwHZHl7i+yJcqDtjJCowzTdBJrdAiLAnSC+CnnjOJELyuQiBgkGrgIh3j8/x0fM+YrsyF1u3FLZPVtzlndhYFJQIDAQABMA0GCSqGSIb3DQEBAgUAA1kACKr0PqphJYw1j+YPtcIqiWlFPuN5jJ79Khfg7ASFxskYkEMjRNZV/HZDZQEhtVaU7Jxfzs2wfX5byMp2X3U/5XUXGx7qusDgHQGs7Jk9W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
|
|
'MFExCzAJBgNVBAYTAlVTMSAwHgYDVQQKExdSU0EgRGF0YSBTZWN1cml0eSwgSW5jLjEPMA0GA1UECxMGQmV0YSAxMQ8wDQYDVQQLEwZOT1RBUlk=,66',
|
|
]
|
|
}
|
|
// vfmt off
|
|
data: [
|
|
u8(0xa9), 0xe5, 0xa5, 0x8f, 0xf6, 0x09, 0xd9, 0x47,
|
|
0xf9, 0x9e, 0x0f, 0x72, 0xce, 0x73, 0xdb, 0xb4,
|
|
0x3d, 0x26, 0x62, 0x5a, 0x12, 0xc0, 0x8b, 0x95,
|
|
0xf4, 0x54, 0x58, 0xc7, 0xe8, 0x33, 0x63, 0xef,
|
|
0x22, 0x5d, 0xdf, 0xcd, 0x42, 0xb5, 0xc7, 0x7e,
|
|
0x2e, 0xbf, 0x32, 0x13, 0xdf, 0x3c, 0x5d, 0xdd,
|
|
0x8c, 0x8a, 0x82, 0x24, 0x0c, 0x6f, 0x95, 0xdd,
|
|
0xb1, 0x82, 0xa4, 0x22, 0x99, 0x4c, 0xe8, 0x4b,
|
|
0x56, 0xb8, 0xaf, 0xb9, 0x10, 0x43, 0x97, 0x3f,
|
|
0x22, 0xe6, 0xb8, 0x2e, 0xa2, 0x9e, 0xab, 0x77,
|
|
0x22, 0x17, 0x31, 0x2f, 0xfc, 0xc6, 0xd9, 0x84,
|
|
]
|
|
// vfmt on
|
|
},
|
|
Block{
|
|
block_type: 'PRIVACY-ENHANCED MESSAGE'
|
|
headers: {
|
|
'Proc-Type': [
|
|
'4,ENCRYPTED',
|
|
]
|
|
'Content-Domain': [
|
|
'RFC822',
|
|
]
|
|
'DEK-Info': [
|
|
'DES-CBC,F8143EDE5960C597',
|
|
]
|
|
'Originator-ID-Symmetric': [
|
|
'linn@zendia.enet.dec.com,,',
|
|
]
|
|
'Recipient-ID-Symmetric': [
|
|
'linn@zendia.enet.dec.com,ptf-kmc,3',
|
|
'pem-dev@tis.com,ptf-kmc,4',
|
|
]
|
|
'Key-Info': [
|
|
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0x75, 0x77, 0x7f, 0x1f, 0x92, 0xcc, 0x0d, 0x69,
|
|
0xe8, 0x9c, 0xdb, 0xcf, 0x0b, 0x04, 0x14, 0x1e,
|
|
]
|
|
// vfmt on
|
|
},
|
|
]
|
|
|
|
const test_data = [
|
|
// https://qsupport.quantum.com/kb/flare/Content/stornext/SN5_DocSite/Guide_Users/Topics/Example_of_a_server_pem_.htm
|
|
"--BEG
|
|
An RSA PRIVATE KEY is on it's way!!
|
|
----BEGIN
|
|
I only want to parse the certificate below
|
|
-----BEGIN RSA PRIVATE KEY-----
|
|
izfrNTmQLnfsLzi2Wb9xPz2Qj9fQYGgeug3N2MkDuVHwpPcgkhHkJgCQuuvT+qZI
|
|
MbS2U6wTS24SZk5RunJIUkitRKeWWMS28SLGfkDs1bBYlSPa5smAd3/q1OePi4ae
|
|
dU6YgWuDxzBAKEKVSUu6pA2HOdyQ9N4F1dI+F8w9J990zE93EgyNqZFBBa2L70h4
|
|
M7DrB0gJBWMdUMoxGnun5glLiCMo2JrHZ9RkMiallS1sHMhELx2UAlP8I1+0Mav8
|
|
iMlHGyUW8EJy0paVf09MPpceEcVwDBeX0+G4UQlO551GTFtOSRjcD8U+GkCzka9W
|
|
/SFQrSGe3Gh3SDaOw/4JEMAjWPDLiCglwh0rLIO4VwU6AxzTCuCw3d1ZxQsU6VFQ
|
|
PqHA8haOUATZIrp3886PBThVqALBk9p1Nqn51bXLh13Zy9DZIVx4Z5Ioz/EGuzgR
|
|
d68VW5wybLjYE2r6Q9nHpitSZ4ZderwjIZRes67HdxYFw8unm4Wo6kuGnb5jSSag
|
|
vwBxKzAf3Omn+J6IthTJKuDd13rKZGMcRpQQ6VstwihYt1TahQ/qfJUWPjPcU5ML
|
|
9LkgVwA8Ndi1wp1/sEPe+UlL16L6vO9jUHcueWN7+zSUOE/cDSJyMd9x/ZL8QASA
|
|
ETd5dujVIqlINL2vJKr1o4T+i0RsnpfFiqFmBKlFqww/SKzJeChdyEtpa/dJMrt2
|
|
8S86b6zEmkser+SDYgGketS2DZ4hB+vh2ujSXmS8Gkwrn+BfHMzkbtio8lWbGw0l
|
|
eM1tfdFZ6wMTLkxRhBkBK4JiMiUMvpERyPib6a2L6iXTfH+3RUDS6A==
|
|
-----END RSA PRIVATE KEY-----Extra stuff
|
|
This should be sent back in the second variable
|
|
I will now continue to spam my keyboard to add junk
|
|
lfajsdkfsndckasdjflkasdjclsdfjljjasldfj
|
|
alsdfsdkfasdfasfsdafasdcjaosdicnsad
|
|
|
|
|
|
fas90dfsdsdj
|
|
----------------------------------
|
|
-----
|
|
asddfadsfasjfsadf
|
|
-----BEGIN lkfajsdklfjasldkfjalsdjf;kasdflkjsaf
|
|
flajsdfkjasdfajskfjslkdfjaskdjf
|
|
FJASKDJjklfjasdfklsdjf
|
|
BEGIN BEGIN BEGIN
|
|
----BEGIN
|
|
-----END RSA PRIVATE KEY
|
|
: fkalsdjflkasdjf
|
|
private key: fsaddf",
|
|
'Mollitia magnam ullam ipsam voluptas ipsa
|
|
rerum debitis. Vel nulla ipsum enim perspiciatis adipisci quam. Nihil incidunt ipsum
|
|
--- --BEGIN
|
|
|
|
|
|
-- BEGIN ------
|
|
---
|
|
--BEGIN ------
|
|
amet rem rerum explicabo. Cum distinctio ipsum dolorum quae. Suscipit asperiores et aut eos numquam.
|
|
-----BEGIN CERTIFICATE-----
|
|
MIICMzCCAZygAwIBAgIJALiPnVsvq8dsMA0GCSqGSIb3DQEBBQUAMFMxCzAJBgNV
|
|
BAYTAlVTMQwwCgYDVQQIEwNmb28xDDAKBgNVBAcTA2ZvbzEMMAoGA1UEChMDZm9v
|
|
MQwwCgYDVQQLEwNmb28xDDAKBgNVBAMTA2ZvbzAeFw0xMzAzMTkxNTQwMTlaFw0x
|
|
ODAzMTgxNTQwMTlaMFMxCzAJBgNVBAYTAlVTMQwwCgYDVQQIEwNmb28xDDAKBgNV
|
|
BAcTA2ZvbzEMMAoGA1UEChMDZm9vMQwwCgYDVQQLEwNmb28xDDAKBgNVBAMTA2Zv
|
|
bzCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAzdGfxi9CNbMf1UUcvDQh7MYB
|
|
OveIHyc0E0KIbhjK5FkCBU4CiZrbfHagaW7ZEcN0tt3EvpbOMxxc/ZQU2WN/s/wP
|
|
xph0pSfsfFsTKM4RhTWD2v4fgk+xZiKd1p0+L4hTtpwnEw0uXRVd0ki6muwV5y/P
|
|
+5FHUeldq+pgTcgzuK8CAwEAAaMPMA0wCwYDVR0PBAQDAgLkMA0GCSqGSIb3DQEB
|
|
BQUAA4GBAJiDAAtY0mQQeuxWdzLRzXmjvdSuL9GoyT3BF/jSnpxz5/58dba8pWen
|
|
v3pj4P3w5DoOso0rzkZy2jEsEitlVM2mLSbQpMM+MUVQCQoiG6W9xuCFuxSrwPIS
|
|
pAqEAuV4DNoxQKKWmhVv+J0ptMWD25Pnpxeq5sXzghfJnslJlQND
|
|
-----END CERTIFICATE-----
|
|
fdsjaf888888888888
|
|
-----
|
|
|
|
-----END
|
|
-----BEGIN',
|
|
'Lorem ipsum dolor sit amet
|
|
, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore
|
|
et dolore magna aliqua. Massa id neque aliquam vestibulum
|
|
morbi blandit cursus risus. Elit at imperdiet dui accumsan sit amet nulla. Pulvinar pellentesque habitant
|
|
|
|
|
|
morbi tristique senectus. Vulputate
|
|
dignissim suspendisse in est ante in. Egestas dui id ornare arcu. Ultrices mi tempus imperdiet
|
|
nulla malesuada. Elementum nisi quis eleifend quam adipiscing.
|
|
Mi in nulla posuere sollicitudin aliquam ultrices. Elit at imperdiet dui accumsan sit amet nulla facilisi. In hac
|
|
habitasse platea dictumst quisque sagittis. Vestibulum
|
|
lectus mauris ultrices eros in cursus. Blandit volutpat maecenas volutpat blandit. Sed nisi
|
|
lacus sed viverra tellus in hac habitasse platea.
|
|
Nulla facilisi etiam dignissim diam. Donec et odio pellentesque diam volutpat
|
|
commodo sed egestas. Eleifend quam adipiscing
|
|
vitae proin sagittis nisl.
|
|
|
|
Pharetra et ultrices neque ornare aenean euismod elementum nisi. Sit amet consectetur sed id semper risus in.
|
|
Eget nullam non nisi est. A diam maecenas sed enim. Enim nec dui nunc mattis. Lectus quam id leo in vitae turpis massa sed
|
|
. In eu mi bibendum neque egestas congue. Dui faucibus in ornare quam viverra orci j
|
|
sagittis. Lectus sit amet est placerat in egestas erat imperdiet.
|
|
|
|
Suspendisse potenti nullam ac tortor. Iaculis nunc sed augue lacus viverra vitae congue eu consequat.
|
|
Lacus vestibulum sed arcu
|
|
non odio euismod. Massa sed elementum tempus egestas sed. Nulla facilisi etiam dignissim diam quis enim
|
|
. Ac ut consequat semper viverra. Eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis rhoncus. Nunc consequat interdum varius sit amet mattis vulputate enim.
|
|
Orci nulla pellentesque dignissim enim sit amet. Sed vulputate mi sit amet.
|
|
Sagittis vitae et leo duis ut diam. Orci a scelerisque purus semper eget duis
|
|
at tellus at. In hac habitasse platea dictumst vestibulum rhoncus est
|
|
. Fames
|
|
ac turpis egestas integer. Mattis enim ut
|
|
tellus elementum sagittis vitae. Pellentesque pulvinar pellentesque habitant morbi tristique senectus et netus
|
|
et. Id semper risus in hendrerit.
|
|
Et sollicitudin ac orci phasellus egestas. Sem integer vitae justo eget
|
|
magna. Et ligula ullamcorper malesuada proin libero nunc consequat.-----BEGIN CERTIFICATE-----
|
|
MIICMzCCAZygAwIBAgIJALiPnVsvq8dsMA0GCSqGSIb3DQEBBQUAMFMxCzAJBgNV
|
|
BAYTAlVTMQwwCgYDVQQIEwNmb28xDDAKBgNVBAcTA2ZvbzEMMAoGA1UEChMDZm9v
|
|
MQwwCgYDVQQLEwNmb28xDDAKBgNVBAMTA2ZvbzAeFw0xMzAzMTkxNTQwMTlaFw0x
|
|
ODAzMTgxNTQwMTlaMFMxCzAJBgNVBAYTAlVTMQwwCgYDVQQIEwNmb28xDDAKBgNV
|
|
BAcTA2ZvbzEMMAoGA1UEChMDZm9vMQw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
|
Bwb3N1ZXJlIHVybmEgbmVjIHRpbmNpZHVudCBwcmFlc2VudCBzZW1wZXIgZmV1Z2lhdCBuaWJoLiBOYW
|
|
0gYWxpcXVhbSBzZW0gZXQgdG9ydG9yIGNvbg==',
|
|
]
|
|
|
|
const expected_results = [
|
|
Block{
|
|
block_type: 'RSA PRIVATE KEY'
|
|
// vfmt off
|
|
data: [
|
|
u8(0x8b), 0x37, 0xeb, 0x35, 0x39, 0x90, 0x2e, 0x77,
|
|
0xec, 0x2f, 0x38, 0xb6, 0x59, 0xbf, 0x71, 0x3f,
|
|
0x3d, 0x90, 0x8f, 0xd7, 0xd0, 0x60, 0x68, 0x1e,
|
|
0xba, 0x0d, 0xcd, 0xd8, 0xc9, 0x03, 0xb9, 0x51,
|
|
0xf0, 0xa4, 0xf7, 0x20, 0x92, 0x11, 0xe4, 0x26,
|
|
0x00, 0x90, 0xba, 0xeb, 0xd3, 0xfa, 0xa6, 0x48,
|
|
0x31, 0xb4, 0xb6, 0x53, 0xac, 0x13, 0x4b, 0x6e,
|
|
0x12, 0x66, 0x4e, 0x51, 0xba, 0x72, 0x48, 0x52,
|
|
0x48, 0xad, 0x44, 0xa7, 0x96, 0x58, 0xc4, 0xb6,
|
|
0xf1, 0x22, 0xc6, 0x7e, 0x40, 0xec, 0xd5, 0xb0,
|
|
0x58, 0x95, 0x23, 0xda, 0xe6, 0xc9, 0x80, 0x77,
|
|
0x7f, 0xea, 0xd4, 0xe7, 0x8f, 0x8b, 0x86, 0x9e,
|
|
0x75, 0x4e, 0x98, 0x81, 0x6b, 0x83, 0xc7, 0x30,
|
|
0x40, 0x28, 0x42, 0x95, 0x49, 0x4b, 0xba, 0xa4,
|
|
0x0d, 0x87, 0x39, 0xdc, 0x90, 0xf4, 0xde, 0x05,
|
|
0xd5, 0xd2, 0x3e, 0x17, 0xcc, 0x3d, 0x27, 0xdf,
|
|
0x74, 0xcc, 0x4f, 0x77, 0x12, 0x0c, 0x8d, 0xa9,
|
|
0x91,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0x9d, 0x5b, 0x2f, 0xab, 0xc7, 0x6c,
|
|
0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86,
|
|
0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, 0x30,
|
|
0x53, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55,
|
|
0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x0c,
|
|
0x30, 0x0a, 0x06, 0x03, 0x55, 0x04, 0x08, 0x13,
|
|
0x03, 0x66, 0x6f, 0x6f, 0x31, 0x0c, 0x30, 0x0a,
|
|
0x06, 0x03, 0x55, 0x04, 0x07, 0x13, 0x03, 0x66,
|
|
0x6f, 0x6f, 0x31, 0x0c, 0x30, 0x0a, 0x06, 0x03,
|
|
0x55, 0x04, 0x0a, 0x13, 0x03, 0x66, 0x6f, 0x6f,
|
|
0x31, 0x0c, 0x30, 0x0a, 0x06, 0x03, 0x55, 0x04,
|
|
0x0b, 0x13, 0x03, 0x66, 0x6f, 0x6f, 0x31, 0x0c,
|
|
0x30, 0x0a, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13,
|
|
0x03, 0x66, 0x6f, 0x6f, 0x30, 0x1e, 0x17, 0x0d,
|
|
0x31, 0x33, 0x30, 0x33, 0x31, 0x39, 0x31, 0x35,
|
|
0x34, 0x30, 0x31, 0x39, 0x5a, 0x17, 0x0d, 0x31,
|
|
0x38, 0x30, 0x33, 0x31, 0x38, 0x31, 0x35, 0x34,
|
|
0x30, 0x31, 0x39, 0x5a, 0x30, 0x53, 0x31, 0x0b,
|
|
0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13,
|
|
0x02, 0x55, 0x53, 0x31, 0x0c, 0x30, 0x0a, 0x06,
|
|
0x03, 0x55, 0x04, 0x08, 0x13, 0x03, 0x66, 0x6f,
|
|
0x6f, 0x31, 0x0c, 0x30, 0x0a, 0x06, 0x03, 0x55,
|
|
0x04, 0x07, 0x13, 0x03, 0x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 0x9a, 0x15, 0x6f, 0xf8,
|
|
0x9d, 0x29, 0xb4, 0xc5, 0x83, 0xdb, 0x93, 0xe7,
|
|
0xa7, 0x17, 0xaa, 0xe6, 0xc5, 0xf3, 0x82, 0x17,
|
|
0xc9, 0x9e, 0xc9, 0x49, 0x95, 0x03, 0x43,
|
|
]
|
|
// vfmt on
|
|
},
|
|
Block{
|
|
block_type: 'CERTIFICATE'
|
|
// vfmt off
|
|
data: [
|
|
u8(0x30), 0x82, 0x02, 0x33, 0x30, 0x82, 0x01, 0x9c,
|
|
0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x09, 0x00,
|
|
0xb8, 0x8f, 0x9d, 0x5b, 0x2f, 0xab, 0xc7, 0x6c,
|
|
0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86,
|
|
0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, 0x30,
|
|
0x53, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55,
|
|
0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x0c,
|
|
0x30, 0x0a, 0x06, 0x03, 0x55, 0x04, 0x08, 0x13,
|
|
0x03, 0x66, 0x6f, 0x6f, 0x31, 0x0c, 0x30, 0x0a,
|
|
0x06, 0x03, 0x55, 0x04, 0x07, 0x13, 0x03, 0x66,
|
|
0x6f, 0x6f, 0x31, 0x0c, 0x30, 0x0a, 0x06, 0x03,
|
|
0x55, 0x04, 0x0a, 0x13, 0x03, 0x66, 0x6f, 0x6f,
|
|
0x31, 0x0c, 0x30, 0x0a, 0x06, 0x03, 0x55, 0x04,
|
|
0x0b, 0x13, 0x03, 0x66, 0x6f, 0x6f, 0x31, 0x0c,
|
|
0x30, 0x0a, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13,
|
|
0x03, 0x66, 0x6f, 0x6f, 0x30, 0x1e, 0x17, 0x0d,
|
|
0x31, 0x33, 0x30, 0x33, 0x31, 0x39, 0x31, 0x35,
|
|
0x34, 0x30, 0x31, 0x39, 0x5a, 0x17, 0x0d, 0x31,
|
|
0x38, 0x30, 0x33, 0x31, 0x38, 0x31, 0x35, 0x34,
|
|
0x30, 0x31, 0x39, 0x5a, 0x30, 0x53, 0x31, 0x0b,
|
|
0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13,
|
|
0x02, 0x55, 0x53, 0x31, 0x0c, 0x30, 0x0a, 0x06,
|
|
0x03, 0x55, 0x04, 0x08, 0x13, 0x03, 0x66, 0x6f,
|
|
0x6f, 0x31, 0x0c, 0x30, 0x0a, 0x06, 0x03, 0x55,
|
|
0x04, 0x07, 0x13, 0x03, 0x66, 0x6f, 0x6f, 0x31,
|
|
0x0c, 0x30, 0x0a, 0x06, 0x03, 0x55, 0x04, 0x0a,
|
|
0x13, 0x03, 0x66, 0x6f, 0x6f, 0x31, 0x0c, 0x30,
|
|
0x0a, 0x06, 0x03, 0x55, 0x04, 0x0b, 0x13, 0x03,
|
|
0x66, 0x6f, 0x6f, 0x31, 0x0c, 0x30, 0x0a, 0x06,
|
|
0x03, 0x55, 0x04, 0x03, 0x13, 0x03, 0x66, 0x6f,
|
|
0x6f, 0x30, 0x81, 0x9f, 0x30, 0x0d, 0x06, 0x09,
|
|
0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01,
|
|
0x01, 0x05, 0x00, 0x03, 0x81, 0x8d, 0x00, 0x30,
|
|
0x81, 0x89, 0x02, 0x81, 0x81, 0x00, 0xcd, 0xd1,
|
|
0x9f, 0xc6, 0x2f, 0x42, 0x35, 0xb3, 0x1f, 0xd5,
|
|
0x45, 0x1c, 0xbc, 0x34, 0x21, 0xec, 0xc6, 0x01,
|
|
0x3a, 0xf7, 0x88, 0x1f, 0x27, 0x34, 0x13, 0x42,
|
|
0x88, 0x6e, 0x18, 0xca, 0xe4, 0x59, 0x02, 0x05,
|
|
0x4e, 0x02, 0x89, 0x9a, 0xdb, 0x7c, 0x76, 0xa0,
|
|
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xe0, 0xfd, 0xf0, 0xe4, 0x3a,
|
|
0x0e, 0xb2, 0x8d, 0x2b, 0xce, 0x46, 0x72, 0xda,
|
|
0x31, 0x2c, 0x12, 0x2b, 0x65, 0x54, 0xcd, 0xa6,
|
|
0x2d, 0x26, 0xd0, 0xa4, 0xc3, 0x3e, 0x31, 0x45,
|
|
0x50, 0x09, 0x0a, 0x22, 0x1b, 0xa5, 0xbd, 0xc6,
|
|
0xe0, 0x85, 0xbb, 0x14, 0xab, 0xc0, 0xf2, 0x12,
|
|
0xa4, 0x0a, 0x84, 0x02, 0xe5, 0x78, 0x0c, 0xda,
|
|
0x31, 0x40, 0xa2, 0x96, 0x9a, 0x15, 0x6f, 0xf8,
|
|
0x9d, 0x29, 0xb4, 0xc5, 0x83, 0xdb, 0x93, 0xe7,
|
|
0xa7, 0x17, 0xaa, 0xe6, 0xc5, 0xf3, 0x82, 0x17,
|
|
0xc9, 0x9e, 0xc9, 0x49, 0x95, 0x03, 0x43,
|
|
]
|
|
// vfmt on
|
|
},
|
|
]
|
|
|
|
const expected_rest = [
|
|
'Extra stuff
|
|
This should be sent back in the second variable
|
|
I will now continue to spam my keyboard to add junk
|
|
lfajsdkfsndckasdjflkasdjclsdfjljjasldfj
|
|
alsdfsdkfasdfasfsdafasdcjaosdicnsad
|
|
|
|
|
|
fas90dfsdsdj
|
|
----------------------------------
|
|
-----
|
|
asddfadsfasjfsadf
|
|
-----BEGIN lkfajsdklfjasldkfjalsdjf;kasdflkjsaf
|
|
flajsdfkjasdfajskfjslkdfjaskdjf
|
|
FJASKDJjklfjasdfklsdjf
|
|
BEGIN BEGIN BEGIN
|
|
----BEGIN
|
|
-----END RSA PRIVATE KEY
|
|
: fkalsdjflkasdjf
|
|
private key: fsaddf',
|
|
'
|
|
fdsjaf888888888888
|
|
-----
|
|
|
|
-----END
|
|
-----BEGIN',
|
|
'YXMuIEVsZWlmZW5kIHF1YW0gYWRpcGlzY2luZyB2aXRh
|
|
ZSBwcm9pbiBzYWdpdHRpcyBuaXNsLgoKUGVsbGVudGVzcXVlIG
|
|
hh
|
|
|
|
|
|
|
|
Yml0YW50IG1vcmJpIHRyaXN0aXF1ZSBzZW5lY3R1cy4gRWdldCBudW5jIGxvYm9ydGlzIG1hdHRpcyBhb
|
|
GlxdWFtIGZhdWNpYnVzLiBOdWxsYW0g
|
|
dmVoaWN1bGEgaXBzdW0gYSBhcmN1IGN1cnN1cy4gUG9ydHRpdG9yIGVnZXQg
|
|
ZG9sb3IgbW9yYmkgbm9uIGFyY3Ugcml
|
|
|
|
|
|
zdXMgcXVpcyB2YXJpdXMgcXVhbS4gRGlnbmlzc2ltIGVuaW0gc2l0IGFtZXQgdmVuZW5hd
|
|
GlzLiBDb25zZWN0ZXR1ciBhIGVyYXQgbmFtIGF0IGxlY3R1cyB1cm5h
|
|
IGR1aXMuIEluIGZlcm1lbnR1bS
|
|
Bwb3N1ZXJlIHVybmEgbmVjIHRpbmNpZHVudCBwcmFlc2VudCBzZW1wZXIgZmV1Z2lhdCBuaWJoLiBOYW
|
|
0gYWxpcXVhbSBzZW0gZXQgdG9ydG9yIGNvbg==',
|
|
]
|