From b10d9acf797da613c7286f4b2fc069257c4fd89f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnter=20Prossliner?= Date: Wed, 14 Feb 2018 09:26:52 +0100 Subject: [PATCH] test_import_private_pkcs8_in_pem_with_parameters_clear for issue #133 --- lib/Crypto/SelfTest/PublicKey/test_import_ECC.py | 6 ++++++ .../ECC/ecc_p256_private_with_parameters_clear.pem | 8 ++++++++ 2 files changed, 14 insertions(+) create mode 100644 lib/Crypto/SelfTest/PublicKey/test_vectors/ECC/ecc_p256_private_with_parameters_clear.pem diff --git a/lib/Crypto/SelfTest/PublicKey/test_import_ECC.py b/lib/Crypto/SelfTest/PublicKey/test_import_ECC.py index ee8c9ed4d..87d6430b7 100644 --- a/lib/Crypto/SelfTest/PublicKey/test_import_ECC.py +++ b/lib/Crypto/SelfTest/PublicKey/test_import_ECC.py @@ -114,6 +114,12 @@ def test_import_private_pkcs8_in_pem_clear(self): key = ECC.import_key(key_file) self.assertEqual(ref_private, key) + def test_import_private_pkcs8_in_pem_with_parameters_clear(self): + key_file = load_file("ecc_p256_private_with_parameters_clear.pem") + + key = ECC.import_key(key_file) + self.assertEqual(ref_private, key) + def test_import_private_pkcs8_encrypted_1(self): key_file = load_file("ecc_p256_private_p8.der") diff --git a/lib/Crypto/SelfTest/PublicKey/test_vectors/ECC/ecc_p256_private_with_parameters_clear.pem b/lib/Crypto/SelfTest/PublicKey/test_vectors/ECC/ecc_p256_private_with_parameters_clear.pem new file mode 100644 index 000000000..f7119c3d8 --- /dev/null +++ b/lib/Crypto/SelfTest/PublicKey/test_vectors/ECC/ecc_p256_private_with_parameters_clear.pem @@ -0,0 +1,8 @@ +-----BEGIN EC PARAMETERS----- +BggqhkjOPQMBBw== +-----END EC PARAMETERS----- +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIGVACa4F96iDau21g+NgZ2EhShjnjijtSGmGQpgdQOJ8oAoGCCqGSM49 +AwEHoUQDQgAE21z/R5bXO0szKdO0Ocy+6n13GJr9nLnMWwBrAG5oxmFDuoLh2PSY +AkiYgkPQ0+ZDenbmOBijVyRlI7IVA46mkw== +-----END EC PRIVATE KEY----- \ No newline at end of file