diff options
author | David Benjamin <davidben@davidben.net> | 2018-08-23 14:58:30 -0500 |
---|---|---|
committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2018-08-23 14:58:30 -0500 |
commit | 3ce8883fd62043419b225790cd524b7619b4bb72 (patch) | |
tree | 2c522ad472b94daf04b9f8095168913260057851 /vectors/cryptography_vectors/asymmetric/PKCS8 | |
parent | fe33ec8ca04b74479c68806616b0e6a43503d794 (diff) | |
download | cryptography-3ce8883fd62043419b225790cd524b7619b4bb72.tar.gz cryptography-3ce8883fd62043419b225790cd524b7619b4bb72.tar.bz2 cryptography-3ce8883fd62043419b225790cd524b7619b4bb72.zip |
Fix encoding errors in RSA test keys. (#4410)
* Fix encoding errors in RSA test keys.
enc-rsa-pkcs8.pem and unenc-rsa-pkcs8.pem did not encode the RSA key
correctly. Per RFC 8017, appendix A.1:
The object identifier rsaEncryption identifies RSA public and private
keys as defined in Appendices A.1.1 and A.1.2. The parameters field
has associated with this OID in a value of type AlgorithmIdentifier
SHALL have a value of type NULL.
rsaEncryption OBJECT IDENTIFIER ::= { pkcs-1 1 }
unenc-rsa-pkcs8.pem, however, was missing that NULL, which was, in turn,
carried into the encrypted payload of enc-rsa-pkcs8.pem. The DER
version, enc-rsa-pkcs8.der, carries this mistake too. Interestingly,
unenc-rsa-pkcs8.der does *not* have it. I'm guessing it was converted
with the openssl command-line tool which fixed the encoding in
conversion.
Current versions of OpenSSL are lax and ignore the parameters field, but
it's best to test against spec-compliant inputs. Fix unenc-rsa-pkcs8.pem
to match unenc-rsa-pkcs8.der and then refresh enc-rsa-pkcs8.{der,pem}
with the new encoding but otherwise the same encryption parameters.
I've refreshed the dumpasn1 (at least that's what it looks like)
preamble at the top of each file, but the current version of dumpasn1
appears to have changed the spacing slightly, so there's some whitespace
diff noise.
* Update test-vectors.rst.
Diffstat (limited to 'vectors/cryptography_vectors/asymmetric/PKCS8')
-rw-r--r-- | vectors/cryptography_vectors/asymmetric/PKCS8/enc-rsa-pkcs8.pem | 70 | ||||
-rw-r--r-- | vectors/cryptography_vectors/asymmetric/PKCS8/unenc-rsa-pkcs8.pem | 151 |
2 files changed, 110 insertions, 111 deletions
diff --git a/vectors/cryptography_vectors/asymmetric/PKCS8/enc-rsa-pkcs8.pem b/vectors/cryptography_vectors/asymmetric/PKCS8/enc-rsa-pkcs8.pem index 69417b85..f5377af9 100644 --- a/vectors/cryptography_vectors/asymmetric/PKCS8/enc-rsa-pkcs8.pem +++ b/vectors/cryptography_vectors/asymmetric/PKCS8/enc-rsa-pkcs8.pem @@ -1,38 +1,38 @@ - 0 674: SEQUENCE { - 4 28: SEQUENCE { - 6 10: OBJECT IDENTIFIER - : pbeWithSHAAnd3-KeyTripleDES-CBC (1 2 840 113549 1 12 1 3) - 18 14: SEQUENCE { - 20 8: OCTET STRING 72 B4 33 4F 90 B8 42 FD - 30 2: INTEGER 290 - : } - : } - 34 640: OCTET STRING - : D1 AB E2 91 63 ED 17 3F 4B 4E 97 00 53 CD 58 A2 - : 5D 25 E8 C8 D9 CA 01 92 AD E6 BE 4A FD F1 8D 9E - : DB F6 DA 0F F5 B3 F6 4D 09 EB 6B AA C2 43 0B 97 - : 8C 50 F3 DA 73 3D 3A 8C 5A BF 22 9B 1E A7 8F CE - : 82 34 3D 50 03 B3 5C DA D6 12 83 72 AC 79 D6 0E - : 8E EE B2 00 F7 09 6D 26 2B 2A 84 47 8F B0 1B 46 - : 5D 54 C6 ED DC DF 82 24 71 81 F3 98 F3 46 64 13 - : 7E 47 71 D6 B4 96 79 2C 7E 5F 2B 30 1E 7F 04 47 - : [ Another 512 bytes skipped ] - : } + 0 674: SEQUENCE { + 4 28: SEQUENCE { + 6 10: OBJECT IDENTIFIER + : pbeWithSHAAnd3-KeyTripleDES-CBC (1 2 840 113549 1 12 1 3) + 18 14: SEQUENCE { + 20 8: OCTET STRING 6A FC C4 AC 34 02 A7 5C + 30 2: INTEGER 290 + : } + : } + 34 640: OCTET STRING + : E0 54 A1 19 E4 5C C0 DC 96 A3 4E E3 12 CA 82 21 + : AD AD ED 1E 23 19 BC 33 BF 39 08 98 90 C5 71 87 + : 90 B2 79 68 E3 0F 1A 81 5E B1 36 23 F8 1D AD F0 + : DF BF 5F 0E 6C BE DB 35 61 81 40 BE FB 5B 46 79 + : DA 76 5A 79 4E A3 37 90 7E AB 95 37 3F 8B F1 79 + : 81 44 F4 BA D2 2E 5E 2F D8 41 6A 47 23 13 F2 3A + : F3 2A D8 54 62 F2 12 9E B3 FF 1E EB F3 18 23 B5 + : 4E 58 36 0E FB 7E AA 5D C3 2C BC 98 B0 41 1F 09 + : [ Another 512 bytes skipped ] + : } -----BEGIN ENCRYPTED PRIVATE KEY----- -MIICojAcBgoqhkiG9w0BDAEDMA4ECHK0M0+QuEL9AgIBIgSCAoDRq+KRY+0XP0tO -lwBTzViiXSXoyNnKAZKt5r5K/fGNntv22g/1s/ZNCetrqsJDC5eMUPPacz06jFq/ -Ipsep4/OgjQ9UAOzXNrWEoNyrHnWDo7usgD3CW0mKyqER4+wG0ZdVMbt3N+CJHGB -85jzRmQTfkdx1rSWeSx+XyswHn8ER4+hQ+omKWMVm7AFkjjmP/KmhUnLT98J8rhU -ArQoFPHz/6HVkypFccNaPPNg6IA4aS2A+TU9vJYOaXSVfFB2yf99hfYYzC+ukmuU -5Lun0cysK5s/5uSwDueUmDQKspnaNyiaMGDxvw8hilJc7vg0fGObfnbIpizhxJwq -gKBfR7Zt0Hv8OYi1He4MehfMGdbHskztF+yQ40LplBGXQrvAqpU4zShga1BoQ98T -0ekbBmqj7hg47VFsppXR7DKhx7G7rpMmdKbFhAZVCjae7rRGpUtD52cpFdPhMyAX -huhMkoczwUW8B/rM4272lkHo6Br0yk/TQfTEGkvryflNVu6lniPTV151WV5U1M3o -3G3a44eDyt7Ln+WSOpWtbPQMTrpKhur6WXgJvrpa/m02oOGdvOlDsoOCgavgQMWg -7xKKL7620pHl7p7f/8tlE8q6vLXVvyNtAOgt/JAr2rgvrHaZSzDE0DwgCjBXEm+7 -cVMV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dcNZI3fDkaxM8ArgxTCr7nDGLKuaHcS1+XtzuA +kJNTLBIv -----END ENCRYPTED PRIVATE KEY----- diff --git a/vectors/cryptography_vectors/asymmetric/PKCS8/unenc-rsa-pkcs8.pem b/vectors/cryptography_vectors/asymmetric/PKCS8/unenc-rsa-pkcs8.pem index 794dfd7e..9eff5c6d 100644 --- a/vectors/cryptography_vectors/asymmetric/PKCS8/unenc-rsa-pkcs8.pem +++ b/vectors/cryptography_vectors/asymmetric/PKCS8/unenc-rsa-pkcs8.pem @@ -1,79 +1,78 @@ - 0 629: SEQUENCE { - 4 1: INTEGER 0 - 7 11: SEQUENCE { - 9 9: OBJECT IDENTIFIER rsaEncryption (1 2 840 113549 1 1 1) - : } - 20 609: OCTET STRING, encapsulates { - 24 605: SEQUENCE { - 28 1: INTEGER 0 - 31 129: INTEGER - : 00 BB 24 7A 09 7E 0E B2 37 32 CC 39 67 AD F1 9E - : 3D 6B 82 83 D1 D0 AC A4 C0 18 BE 8D 98 00 C0 7B - : FF 07 44 C9 CA 1C BA 36 E1 27 69 FF B1 E3 8D 8B - : EE 57 A9 3A AA 16 43 39 54 19 7C AE 69 24 14 F6 - : 64 FF BC 74 C6 67 6C 4C F1 02 49 69 C7 2B E1 E1 - : A1 A3 43 14 F4 77 8F C8 D0 85 5A 35 95 AC 62 A9 - : C1 21 00 77 A0 8B 97 30 B4 5A 2C B8 90 2F 48 A0 - : 05 28 4B F2 0F 8D EC 8B 4D 03 42 75 D6 AD 81 C0 - : [ Another 1 bytes skipped ] - 163 3: INTEGER 65537 - 168 128: INTEGER - : 00 FC B9 4A 26 07 89 51 2B 53 72 91 E0 18 3E A6 - : 5E 31 EF 9C 0C 16 24 42 D0 28 33 F9 FA D0 3C 54 - : 04 06 C0 15 F5 1B 9A B3 24 31 AB 3C 6B 47 43 B0 - : D2 A9 DC 05 E1 81 59 B6 04 E9 66 61 AA D7 0B 00 - : 8F 3D E5 BF A2 F8 5E 25 6C 1E 22 0F B4 FD 41 E2 - : 03 31 5F DA 20 C5 C0 F3 55 0E E1 C9 EC D7 3E 2A - : 0C 01 CA 7B 22 CB AC F4 2B 27 F0 78 5F B5 C2 F9 - : E8 14 5A 6E 7E 86 BD 6A 9B 20 0C BA CC 97 20 11 - 299 65: INTEGER - : 00 C9 59 9F 29 8A 5B 9F E3 2A D8 7E C2 40 9F A8 - : 45 E5 3E 11 8D 3C ED 6E AB CE D0 65 46 D8 C7 07 - : 63 B5 23 34 F4 9F 7E 1C C7 C7 F9 65 D1 F4 04 42 - : 38 BE 3A 0C 9D 08 25 FC A3 71 D9 AE 0C 39 61 F4 - : 89 - 366 65: INTEGER - : 00 ED EF AB A9 D5 39 9C EE 59 1B FF CF 48 44 1B - : B6 32 E7 46 24 F3 04 7F DE 95 08 6D 75 9E 67 17 - : BA 5C A4 D4 E2 E2 4D 77 CE EB 66 29 C5 96 E0 62 - : BB E5 AC DC 44 62 54 86 ED 64 0C CE D0 60 03 9D - : 49 - 433 64: INTEGER - : 54 D9 18 72 27 E4 BE 76 BB 1A 6A 28 2F 95 58 12 - : C4 2C A8 B6 CC E2 FD 0D 17 64 C8 18 D7 C6 DF 3D - : 4C 1A 9E F9 2A B0 B9 2E 12 FD EC C3 51 C1 ED A9 - : FD B7 76 93 41 D8 C8 22 94 1A 77 F6 9C C3 C3 89 - 499 65: INTEGER - : 00 8E F9 A7 08 AD B5 2A 04 DB 8D 04 A1 B5 06 20 - : 34 D2 CF C0 89 B1 72 31 B8 39 8B CF E2 8E A5 DA - : 4F 45 1E 53 42 66 C4 30 4B 29 8E C1 69 17 29 8C - : 8A E6 0F 82 68 A1 41 B3 B6 70 99 75 A9 27 18 E4 - : E9 - 566 65: INTEGER - : 00 89 EA 6E 6D 70 DF 25 5F 18 3F 48 DA 63 10 8B - : FE A8 0C 94 0F DE 97 56 53 89 94 E2 1E 2C 74 3C - : 91 81 34 0B A6 40 F8 CB 2A 60 8C E0 02 B7 89 93 - : CF 18 9F 49 54 FD 7D 3F 9A EF D4 A4 4F C1 45 99 - : 91 - : } - : } - : } - -0 warnings, 0 errors. + 0 631: SEQUENCE { + 4 1: INTEGER 0 + 7 13: SEQUENCE { + 9 9: OBJECT IDENTIFIER rsaEncryption (1 2 840 113549 1 1 1) + 20 0: NULL + : } + 22 609: OCTET STRING, encapsulates { + 26 605: SEQUENCE { + 30 1: INTEGER 0 + 33 129: INTEGER + : 00 BB 24 7A 09 7E 0E B2 37 32 CC 39 67 AD F1 9E + : 3D 6B 82 83 D1 D0 AC A4 C0 18 BE 8D 98 00 C0 7B + : FF 07 44 C9 CA 1C BA 36 E1 27 69 FF B1 E3 8D 8B + : EE 57 A9 3A AA 16 43 39 54 19 7C AE 69 24 14 F6 + : 64 FF BC 74 C6 67 6C 4C F1 02 49 69 C7 2B E1 E1 + : A1 A3 43 14 F4 77 8F C8 D0 85 5A 35 95 AC 62 A9 + : C1 21 00 77 A0 8B 97 30 B4 5A 2C B8 90 2F 48 A0 + : 05 28 4B F2 0F 8D EC 8B 4D 03 42 75 D6 AD 81 C0 + : 11 +165 3: INTEGER 65537 +170 128: INTEGER + : 00 FC B9 4A 26 07 89 51 2B 53 72 91 E0 18 3E A6 + : 5E 31 EF 9C 0C 16 24 42 D0 28 33 F9 FA D0 3C 54 + : 04 06 C0 15 F5 1B 9A B3 24 31 AB 3C 6B 47 43 B0 + : D2 A9 DC 05 E1 81 59 B6 04 E9 66 61 AA D7 0B 00 + : 8F 3D E5 BF A2 F8 5E 25 6C 1E 22 0F B4 FD 41 E2 + : 03 31 5F DA 20 C5 C0 F3 55 0E E1 C9 EC D7 3E 2A + : 0C 01 CA 7B 22 CB AC F4 2B 27 F0 78 5F B5 C2 F9 + : E8 14 5A 6E 7E 86 BD 6A 9B 20 0C BA CC 97 20 11 +301 65: INTEGER + : 00 C9 59 9F 29 8A 5B 9F E3 2A D8 7E C2 40 9F A8 + : 45 E5 3E 11 8D 3C ED 6E AB CE D0 65 46 D8 C7 07 + : 63 B5 23 34 F4 9F 7E 1C C7 C7 F9 65 D1 F4 04 42 + : 38 BE 3A 0C 9D 08 25 FC A3 71 D9 AE 0C 39 61 F4 + : 89 +368 65: INTEGER + : 00 ED EF AB A9 D5 39 9C EE 59 1B FF CF 48 44 1B + : B6 32 E7 46 24 F3 04 7F DE 95 08 6D 75 9E 67 17 + : BA 5C A4 D4 E2 E2 4D 77 CE EB 66 29 C5 96 E0 62 + : BB E5 AC DC 44 62 54 86 ED 64 0C CE D0 60 03 9D + : 49 +435 64: INTEGER + : 54 D9 18 72 27 E4 BE 76 BB 1A 6A 28 2F 95 58 12 + : C4 2C A8 B6 CC E2 FD 0D 17 64 C8 18 D7 C6 DF 3D + : 4C 1A 9E F9 2A B0 B9 2E 12 FD EC C3 51 C1 ED A9 + : FD B7 76 93 41 D8 C8 22 94 1A 77 F6 9C C3 C3 89 +501 65: INTEGER + : 00 8E F9 A7 08 AD B5 2A 04 DB 8D 04 A1 B5 06 20 + : 34 D2 CF C0 89 B1 72 31 B8 39 8B CF E2 8E A5 DA + : 4F 45 1E 53 42 66 C4 30 4B 29 8E C1 69 17 29 8C + : 8A E6 0F 82 68 A1 41 B3 B6 70 99 75 A9 27 18 E4 + : E9 +568 65: INTEGER + : 00 89 EA 6E 6D 70 DF 25 5F 18 3F 48 DA 63 10 8B + : FE A8 0C 94 0F DE 97 56 53 89 94 E2 1E 2C 74 3C + : 91 81 34 0B A6 40 F8 CB 2A 60 8C E0 02 B7 89 93 + : CF 18 9F 49 54 FD 7D 3F 9A EF D4 A4 4F C1 45 99 + : 91 + : } + : } + : } -----BEGIN PRIVATE KEY----- -MIICdQIBADALBgkqhkiG9w0BAQEEggJhMIICXQIBAAKBgQC7JHoJfg6yNzLMOWet -8Z49a4KD0dCspMAYvo2YAMB7/wdEycocujbhJ2n/seONi+5XqTqqFkM5VBl8rmkk -FPZk/7x0xmdsTPECSWnHK+HhoaNDFPR3j8jQhVo1laxiqcEhAHegi5cwtFosuJAv -SKAFKEvyD43si00DQnXWrYHAEQIDAQABAoGAAPy5S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