OLD | NEW |
(Empty) | |
| 1 This test data was produced by creating a self-signed EC cert using OpenSSL, |
| 2 and then extracting the relevant fields. |
| 3 |
| 4 It uses RSA PKCS#1 v1.5 with SHA-256 and a 1024-bit key. |
| 5 |
| 6 (1) Generate self-signed certificate |
| 7 |
| 8 openssl genrsa -out rsa_key.pem 1024 |
| 9 openssl req -new -key rsa_key.pem -x509 -nodes -days 365 -out cert.pem |
| 10 |
| 11 (2) Extract public key |
| 12 |
| 13 openssl x509 -in cert.pem -pubkey -noout > pubkey.pem |
| 14 cat pubkey.pem |
| 15 |
| 16 (3) Extract signed data (tbsCertificate) |
| 17 |
| 18 openssl asn1parse -in cert.pem -out tbs -noout -strparse 4 |
| 19 base64 tbs |
| 20 |
| 21 (4) Extract signature algorithm |
| 22 |
| 23 # Find the offset of the signature algorithm near the end (491 in this case) |
| 24 openssl asn1parse -in cert.pem |
| 25 |
| 26 openssl asn1parse -in cert.pem -out alg -noout -strparse 491 |
| 27 base64 alg |
| 28 |
| 29 (5) Extract the signature |
| 30 |
| 31 # Find the final offset of BIT STRING (506 in this case) |
| 32 openssl asn1parse -in cert.pem |
| 33 |
| 34 openssl asn1parse -in cert.pem -out sig -noout -strparse 506 |
| 35 base64 sig |
| 36 |
| 37 |
| 38 -----BEGIN PUBLIC KEY----- |
| 39 MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCqR+B2Mj1irNp1JnY2zQIQRQPz |
| 40 7ybs6mUjHT3hf5APyaig2u6fBPThqxssgg0YviqIj/70hVK/JXcqP1zgR5AhsA0a |
| 41 gnwAjfB/ow4EH+3HEYV52qpxN98pUxC+1l2hgVtn8xCS/JGyjK+6dv+lZw3ixJoX |
| 42 2RjVtdJ4/cn318EhhQIDAQAB |
| 43 -----END PUBLIC KEY----- |
| 44 |
| 45 -----BEGIN ALGORITHM----- |
| 46 MA0GCSqGSIb3DQEBCwUA |
| 47 -----END ALGORITHM----- |
| 48 |
| 49 -----BEGIN DATA----- |
| 50 MIIB46ADAgECAgkA3l4tFOVii0UwDQYJKoZIhvcNAQELBQAwVjELMAkGA1UEBhMCQVUxEzARBgNV |
| 51 BAgMClNvbWUtU3RhdGUxITAfBgNVBAoMGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDEPMA0GA1UE |
| 52 AwwGTXkga2V5MB4XDTE1MDcwMjE3MDYzOVoXDTE2MDcwMTE3MDYzOVowVjELMAkGA1UEBhMCQVUx |
| 53 EzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoMGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDEP |
| 54 MA0GA1UEAwwGTXkga2V5MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCqR+B2Mj1irNp1JnY2 |
| 55 zQIQRQPz7ybs6mUjHT3hf5APyaig2u6fBPThqxssgg0YviqIj/70hVK/JXcqP1zgR5AhsA0agnwA |
| 56 jfB/ow4EH+3HEYV52qpxN98pUxC+1l2hgVtn8xCS/JGyjK+6dv+lZw3ixJoX2RjVtdJ4/cn318Eh |
| 57 hQIDAQABo1AwTjAdBgNVHQ4EFgQUzQBVKTEknyLndWd2HTsBdTKvyikwHwYDVR0jBBgwFoAUzQBV |
| 58 KTEknyLndWd2HTsBdTKvyikwDAYDVR0TBAUwAwEB/w== |
| 59 -----END DATA----- |
| 60 |
| 61 -----BEGIN SIGNATURE----- |
| 62 OsdKYVInD8a/uGzk83OlonACuL+yK1qshl/M39KNH6fwvzJ5MSiINvX4GTGUW9e88dNo4qg7daWy |
| 63 U007GHVbn8mRhgY5SQJzIiOeWfqpLnrSKZyvdU2OiZP8zwzYiyz6smIpq7VNG5o/sfyLr4ap/exo |
| 64 Z2vz8ue8UB01C+RqVC0= |
| 65 -----END SIGNATURE----- |
OLD | NEW |