aboutsummaryrefslogtreecommitdiffstats
path: root/checks/ecdsa.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2012-07-09 16:24:14 +0000
committerlloyd <[email protected]>2012-07-09 16:24:14 +0000
commit4e43080954be57e362feb1cc8202bfd42117e286 (patch)
treeffcefbd2b2b78ddee4285e8dd4d2d90e112acb93 /checks/ecdsa.cpp
parent38f7ed8efb6621d55a705bb7af4ba5a21495113a (diff)
Fix for bug 209. Required some reworking of the ASN.1 bytestring
decoding code but seems an improvement.
Diffstat (limited to 'checks/ecdsa.cpp')
-rw-r--r--checks/ecdsa.cpp20
1 files changed, 20 insertions, 0 deletions
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;