diff options
author | lloyd <[email protected]> | 2012-07-09 16:24:14 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2012-07-09 16:24:14 +0000 |
commit | 4e43080954be57e362feb1cc8202bfd42117e286 (patch) | |
tree | ffcefbd2b2b78ddee4285e8dd4d2d90e112acb93 /checks | |
parent | 38f7ed8efb6621d55a705bb7af4ba5a21495113a (diff) |
Fix for bug 209. Required some reworking of the ASN.1 bytestring
decoding code but seems an improvement.
Diffstat (limited to 'checks')
-rw-r--r-- | checks/ecc_testdata/ecc_private_with_rfc5915_ext.pem | 6 | ||||
-rw-r--r-- | checks/ecdsa.cpp | 20 |
2 files changed, 26 insertions, 0 deletions
diff --git a/checks/ecc_testdata/ecc_private_with_rfc5915_ext.pem b/checks/ecc_testdata/ecc_private_with_rfc5915_ext.pem new file mode 100644 index 000000000..a8699fce7 --- /dev/null +++ b/checks/ecc_testdata/ecc_private_with_rfc5915_ext.pem @@ -0,0 +1,6 @@ +-----BEGIN ENCRYPTED PRIVATE KEY----- +MIGwMBsGCSqGSIb3DQEFAzAOBAhLqOHiUDFjTwICCAAEgZD1k1BiBROTLBRoFQG5 +gNEipqwBXlKKv+cen7laWHdABXBPGSXBTZGiwsfVPitW+mT3kLHjPZOwJ+55Chka +QkBardzHxD2LwX8BXxDqiv61R/NsGh376+KXxTbZApobC3p40T24wMvX0O04HXaZ +6qPBsRo1byuhn0jM6Qr0O/HnYHH4/fiIN6Iq2HF6/QaUnak= +-----END ENCRYPTED PRIVATE KEY----- diff --git a/checks/ecdsa.cpp b/checks/ecdsa.cpp index 1c7df5255..a43de69c5 100644 --- a/checks/ecdsa.cpp +++ b/checks/ecdsa.cpp @@ -413,6 +413,24 @@ void test_read_pkcs8(RandomNumberGenerator& rng) } } +void test_ecc_key_with_rfc5915_extensions(RandomNumberGenerator& rng) + { + const std::string pw = "G3bz1L1gmB5ULietOZdoLPu63D7uwTLMEk"; + + try + { + std::unique_ptr<PKCS8_PrivateKey> pkcs8( + PKCS8::load_key(TEST_DATA_DIR "/ecc_private_with_rfc5915_ext.pem", rng, pw)); + + if(!dynamic_cast<ECDSA_PrivateKey*>(pkcs8.get())) + std::cout << "Loaded RFC 5915 key, but got something other than an ECDSA key\n"; + } + catch(std::exception& e) + { + std::cout << "Exception in " << __func__ << " - " << e.what() << "\n"; + } + } + } u32bit do_ecdsa_tests(Botan::RandomNumberGenerator& rng) @@ -430,6 +448,8 @@ u32bit do_ecdsa_tests(Botan::RandomNumberGenerator& rng) test_curve_registry(rng); test_read_pkcs8(rng); + test_ecc_key_with_rfc5915_extensions(rng); + std::cout << std::endl; return 0; |