• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1This is the same test as rsa-pkcs1-sha256.pem except the SPKI has been encoded
2using a non-minimal length for the outtermost SEQUENCE.
3
4Under DER, the tag-length-value encodings should be minimal and hence this should fail.
5
6Specifically the SPKI start was changed from:
7  30 81 9f
8To:
9  30 82 00 9f
10
11(the length of 0x9F is being expressed using 2 bytes instead of 1)
12
13
14
15-----BEGIN PUBLIC KEY-----
16MIIAnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAqkfgdjI9YqzadSZ2Ns0CEEUD8+8m7OplIx0
1794X+QD8mooNrunwT04asbLIINGL4qiI/+9IVSvyV3Kj9c4EeQIbANGoJ8AI3wf6MOBB/txxGFed
18qqcTffKVMQvtZdoYFbZ/MQkvyRsoyvunb/pWcN4sSaF9kY1bXSeP3J99fBIYUCAwEAAQ==
19-----END PUBLIC KEY-----
20
21$ openssl asn1parse -i < [PUBLIC KEY]
22    0:d=0  hl=4 l= 159 cons: SEQUENCE
23    4:d=1  hl=2 l=  13 cons:  SEQUENCE
24    6:d=2  hl=2 l=   9 prim:   OBJECT            :rsaEncryption
25   17:d=2  hl=2 l=   0 prim:   NULL
26   19:d=1  hl=3 l= 141 prim:  BIT STRING
27
28
29
30-----BEGIN ALGORITHM-----
31MA0GCSqGSIb3DQEBCwUA
32-----END ALGORITHM-----
33
34$ openssl asn1parse -i < [ALGORITHM]
35    0:d=0  hl=2 l=  13 cons: SEQUENCE
36    2:d=1  hl=2 l=   9 prim:  OBJECT            :sha256WithRSAEncryption
37   13:d=1  hl=2 l=   0 prim:  NULL
38
39
40
41-----BEGIN DATA-----
42MIIB46ADAgECAgkA3l4tFOVii0UwDQYJKoZIhvcNAQELBQAwVjELMAkGA1UEBhMCQVUxEzARBgN
43VBAgMClNvbWUtU3RhdGUxITAfBgNVBAoMGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDEPMA0GA1
44UEAwwGTXkga2V5MB4XDTE1MDcwMjE3MDYzOVoXDTE2MDcwMTE3MDYzOVowVjELMAkGA1UEBhMCQ
45VUxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoMGEludGVybmV0IFdpZGdpdHMgUHR5IEx0
46ZDEPMA0GA1UEAwwGTXkga2V5MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCqR+B2Mj1irNp
471JnY2zQIQRQPz7ybs6mUjHT3hf5APyaig2u6fBPThqxssgg0YviqIj/70hVK/JXcqP1zgR5AhsA
480agnwAjfB/ow4EH+3HEYV52qpxN98pUxC+1l2hgVtn8xCS/JGyjK+6dv+lZw3ixJoX2RjVtdJ4/
49cn318EhhQIDAQABo1AwTjAdBgNVHQ4EFgQUzQBVKTEknyLndWd2HTsBdTKvyikwHwYDVR0jBBgw
50FoAUzQBVKTEknyLndWd2HTsBdTKvyikwDAYDVR0TBAUwAwEB/w==
51-----END DATA-----
52
53
54
55-----BEGIN SIGNATURE-----
56A4GBADrHSmFSJw/Gv7hs5PNzpaJwAri/sitarIZfzN/SjR+n8L8yeTEoiDb1+BkxlFvXvPHTaOK
57oO3WlslNNOxh1W5/JkYYGOUkCcyIjnln6qS560imcr3VNjomT/M8M2Iss+rJiKau1TRuaP7H8i6
58+Gqf3saGdr8/LnvFAdNQvkalQt
59-----END SIGNATURE-----
60
61$ openssl asn1parse -i < [SIGNATURE]
62    0:d=0  hl=3 l= 129 prim: BIT STRING
63