aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/lib/pubkey/ecc_key/ecc_key.cpp3
-rw-r--r--src/tests/data/ecc/ecc_private_with_rfc5915_parameters.pem6
-rw-r--r--src/tests/unit_ecdsa.cpp27
3 files changed, 31 insertions, 5 deletions
diff --git a/src/lib/pubkey/ecc_key/ecc_key.cpp b/src/lib/pubkey/ecc_key/ecc_key.cpp
index ad62f6ae3..7274a3cd9 100644
--- a/src/lib/pubkey/ecc_key/ecc_key.cpp
+++ b/src/lib/pubkey/ecc_key/ecc_key.cpp
@@ -177,9 +177,6 @@ EC_PrivateKey::EC_PrivateKey(const AlgorithmIdentifier& alg_id,
.decode_optional_string(public_key_bits, BIT_STRING, 1, PRIVATE)
.end_cons();
- if(!key_parameters.empty() && key_parameters != alg_id.oid)
- throw Decoding_Error("EC_PrivateKey - inner and outer OIDs did not match");
-
if(public_key_bits.empty())
{
m_public_key = domain().get_base_point() *
diff --git a/src/tests/data/ecc/ecc_private_with_rfc5915_parameters.pem b/src/tests/data/ecc/ecc_private_with_rfc5915_parameters.pem
new file mode 100644
index 000000000..9044ba49e
--- /dev/null
+++ b/src/tests/data/ecc/ecc_private_with_rfc5915_parameters.pem
@@ -0,0 +1,6 @@
+-----BEGIN PRIVATE KEY-----
+MIGTAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBHkwdwIBAQQgQsaM/yuLh6H7UPb+
+1oizCkiyxY9Q4M9A+lfRxmwgZMWgCgYIKoZIzj0DAQehRANCAAScslLLwFzPl93W
+50kyRwyO222/yBoKAeheP45kM7QVuxul7flLp+heb0kk9zL0m0xH3PEoRBw32+77
+2L1OXOsH
+-----END PRIVATE KEY-----
diff --git a/src/tests/unit_ecdsa.cpp b/src/tests/unit_ecdsa.cpp
index ea622ade4..2654753eb 100644
--- a/src/tests/unit_ecdsa.cpp
+++ b/src/tests/unit_ecdsa.cpp
@@ -370,18 +370,40 @@ Test::Result test_ecc_key_with_rfc5915_extensions()
std::unique_ptr<Botan::Private_Key> pkcs8(
Botan::PKCS8::load_key(Test::data_file("ecc/ecc_private_with_rfc5915_ext.pem"), Test::rng()));
- result.confirm("loaded RFC 5914 key", pkcs8.get());
+ result.confirm("loaded RFC 5915 key", pkcs8.get());
result.test_eq("key is ECDSA", pkcs8->algo_name(), "ECDSA");
result.confirm("key type is ECDSA", dynamic_cast<Botan::ECDSA_PrivateKey*>(pkcs8.get()));
}
catch(std::exception& e)
{
- result.test_failure("load_rfc5915", e.what());
+ result.test_failure("load_rfc5915_ext", e.what());
}
return result;
}
+Test::Result test_ecc_key_with_rfc5915_parameters()
+ {
+ Test::Result result("ECDSA Unit");
+
+ try
+ {
+ std::unique_ptr<Botan::Private_Key> pkcs8(
+ Botan::PKCS8::load_key(Test::data_file("ecc/ecc_private_with_rfc5915_parameters.pem"), Test::rng()));
+
+ result.confirm("loaded RFC 5915 key", pkcs8.get());
+ result.test_eq("key is ECDSA", pkcs8->algo_name(), "ECDSA");
+ result.confirm("key type is ECDSA", dynamic_cast<Botan::ECDSA_PrivateKey*>(pkcs8.get()));
+ }
+ catch(std::exception& e)
+ {
+ result.test_failure("load_rfc5915_params", e.what());
+ }
+
+ return result;
+ }
+
+
class ECDSA_Unit_Tests : public Test
{
@@ -402,6 +424,7 @@ class ECDSA_Unit_Tests : public Test
results.push_back(test_unusual_curve());
results.push_back(test_curve_registry());
results.push_back(test_ecc_key_with_rfc5915_extensions());
+ results.push_back(test_ecc_key_with_rfc5915_parameters());
return results;
}
};