From b03de8bcbe77a0b87555d82538682d0310b14c76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Thu, 15 Aug 2013 14:39:16 +0200 Subject: [PATCH] Add test for EC keys with all curves. (Made possible by the OID fix.) --- tests/data_files/ec_224_prv.pem | 5 ++++ tests/data_files/ec_224_pub.pem | 4 ++++ tests/data_files/ec_256_prv.pem | 5 ++++ tests/data_files/ec_256_pub.pem | 4 ++++ tests/data_files/ec_384_prv.pem | 6 +++++ tests/data_files/ec_384_pub.pem | 5 ++++ tests/data_files/ec_521_prv.pem | 7 ++++++ tests/data_files/ec_521_pub.pem | 6 +++++ tests/suites/test_suite_x509parse.data | 32 ++++++++++++++++++++++++++ 9 files changed, 74 insertions(+) create mode 100644 tests/data_files/ec_224_prv.pem create mode 100644 tests/data_files/ec_224_pub.pem create mode 100644 tests/data_files/ec_256_prv.pem create mode 100644 tests/data_files/ec_256_pub.pem create mode 100644 tests/data_files/ec_384_prv.pem create mode 100644 tests/data_files/ec_384_pub.pem create mode 100644 tests/data_files/ec_521_prv.pem create mode 100644 tests/data_files/ec_521_pub.pem diff --git a/tests/data_files/ec_224_prv.pem b/tests/data_files/ec_224_prv.pem new file mode 100644 index 000000000..ebb83a02c --- /dev/null +++ b/tests/data_files/ec_224_prv.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MGgCAQEEHGhJ+X0QZvaZd1ljfH44mUZM7j7HrJcGU6C+B0KgBwYFK4EEACGhPAM6 +AAQWk6KQ9/C1cf4rQdXYSwEydjH0qGD5lfozLAl/VBkrsQ8AET8q/7E8GiTORJFF +calUQK4BSgDL9w== +-----END EC PRIVATE KEY----- diff --git a/tests/data_files/ec_224_pub.pem b/tests/data_files/ec_224_pub.pem new file mode 100644 index 000000000..d2da54a65 --- /dev/null +++ b/tests/data_files/ec_224_pub.pem @@ -0,0 +1,4 @@ +-----BEGIN PUBLIC KEY----- +ME4wEAYHKoZIzj0CAQYFK4EEACEDOgAEFpOikPfwtXH+K0HV2EsBMnYx9Khg+ZX6 +MywJf1QZK7EPABE/Kv+xPBokzkSRRXGpVECuAUoAy/c= +-----END PUBLIC KEY----- diff --git a/tests/data_files/ec_256_prv.pem b/tests/data_files/ec_256_prv.pem new file mode 100644 index 000000000..e42dd4a6c --- /dev/null +++ b/tests/data_files/ec_256_prv.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIEnJqMGMS4hWOMQxzx3xyZQTFgm1gNT9Q6DKsX2y8T7uoAoGCCqGSM49 +AwEHoUQDQgAEd3Jlb4FLOZJ51eHxeB+sbwmaPFyhsONTUYNLCLZeC1clkM2vj3aT +YbzzSs/BHl4HToQmvd4Evm5lOUVElhfeRQ== +-----END EC PRIVATE KEY----- diff --git a/tests/data_files/ec_256_pub.pem b/tests/data_files/ec_256_pub.pem new file mode 100644 index 000000000..701da02fc --- /dev/null +++ b/tests/data_files/ec_256_pub.pem @@ -0,0 +1,4 @@ +-----BEGIN PUBLIC KEY----- +MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEd3Jlb4FLOZJ51eHxeB+sbwmaPFyh +sONTUYNLCLZeC1clkM2vj3aTYbzzSs/BHl4HToQmvd4Evm5lOUVElhfeRQ== +-----END PUBLIC KEY----- diff --git a/tests/data_files/ec_384_prv.pem b/tests/data_files/ec_384_prv.pem new file mode 100644 index 000000000..7890759b4 --- /dev/null +++ b/tests/data_files/ec_384_prv.pem @@ -0,0 +1,6 @@ +-----BEGIN EC PRIVATE KEY----- +MIGkAgEBBDA/XY2b4oC1aWzFzJ+Uz4r35rYd1lkrKrKzpMYHRQQX7DJ9zcrtfBAF +PXGaBXTwp2qgBwYFK4EEACKhZANiAATZxmK1C6KcpHmQRQ4EOur08MabFWdtES9i +KnHJMFmvmZaRxWgNK0TREVedsS9KQTou1cRfz7Z7W2PgC5Hr5Z0JprGsLAxCgqoS +MX7VkU+Zm8SIuxMug0LMNvLKXjN5x0c= +-----END EC PRIVATE KEY----- diff --git a/tests/data_files/ec_384_pub.pem b/tests/data_files/ec_384_pub.pem new file mode 100644 index 000000000..de95382e4 --- /dev/null +++ b/tests/data_files/ec_384_pub.pem @@ -0,0 +1,5 @@ +-----BEGIN PUBLIC KEY----- +MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAE2cZitQuinKR5kEUOBDrq9PDGmxVnbREv +YipxyTBZr5mWkcVoDStE0RFXnbEvSkE6LtXEX8+2e1tj4AuR6+WdCaaxrCwMQoKq +EjF+1ZFPmZvEiLsTLoNCzDbyyl4zecdH +-----END PUBLIC KEY----- diff --git a/tests/data_files/ec_521_prv.pem b/tests/data_files/ec_521_prv.pem new file mode 100644 index 000000000..144bb44b7 --- /dev/null +++ b/tests/data_files/ec_521_prv.pem @@ -0,0 +1,7 @@ +-----BEGIN EC PRIVATE KEY----- +MIHcAgEBBEIBsbatB7t55zINpZhg6ijgVShPYFjyed5mbgbUNdKve9oo2Z+ke33Q +lj4WsAcweO6LijjZZqWC9G0Z/5XfOtloWq6gBwYFK4EEACOhgYkDgYYABAAd4ULV +T2nrA47kt6+dPKB3Nv2c9xnrNU1ph57n88E2+w+/nwj4a+X6Eo7BoFHT5sZD6Fra +j/rPNmPCYL0shEtvVgDO6OSKnmXQnK3YnyNd7gXzuKZGvnFfH2fVtDTg/yOh/Afv +d0AZPkDu/287zf12WqkVUDNST+TyBfVETiksTC9qwQ== +-----END EC PRIVATE KEY----- diff --git a/tests/data_files/ec_521_pub.pem b/tests/data_files/ec_521_pub.pem new file mode 100644 index 000000000..26bc5c51d --- /dev/null +++ b/tests/data_files/ec_521_pub.pem @@ -0,0 +1,6 @@ +-----BEGIN PUBLIC KEY----- +MIGbMBAGByqGSM49AgEGBSuBBAAjA4GGAAQAHeFC1U9p6wOO5LevnTygdzb9nPcZ +6zVNaYee5/PBNvsPv58I+Gvl+hKOwaBR0+bGQ+ha2o/6zzZjwmC9LIRLb1YAzujk +ip5l0Jyt2J8jXe4F87imRr5xXx9n1bQ04P8jofwH73dAGT5A7v9vO839dlqpFVAz +Uk/k8gX1RE4pLEwvasE= +-----END PUBLIC KEY----- diff --git a/tests/suites/test_suite_x509parse.data b/tests/suites/test_suite_x509parse.data index a44fc0612..caa525d7d 100644 --- a/tests/suites/test_suite_x509parse.data +++ b/tests/suites/test_suite_x509parse.data @@ -194,6 +194,22 @@ X509 Parse Public EC Key #2 (RFC 5480, PEM) depends_on:POLARSSL_PEM_C:POLARSSL_ECP_C:POLARSSL_ECP_DP_SECP192R1_ENABLED:POLARSSL_FS_IO x509parse_public_keyfile_ec:"data_files/ec_pub.pem":0 +X509 Parse Public EC Key #3 (RFC 5480, secp224r1) +depends_on:POLARSSL_PEM_C:POLARSSL_ECP_C:POLARSSL_ECP_DP_SECP224R1_ENABLED:POLARSSL_FS_IO +x509parse_public_keyfile_ec:"data_files/ec_224_pub.pem":0 + +X509 Parse Public EC Key #4 (RFC 5480, secp256r1) +depends_on:POLARSSL_PEM_C:POLARSSL_ECP_C:POLARSSL_ECP_DP_SECP256R1_ENABLED:POLARSSL_FS_IO +x509parse_public_keyfile_ec:"data_files/ec_256_pub.pem":0 + +X509 Parse Public EC Key #5 (RFC 5480, secp384r1) +depends_on:POLARSSL_PEM_C:POLARSSL_ECP_C:POLARSSL_ECP_DP_SECP384R1_ENABLED:POLARSSL_FS_IO +x509parse_public_keyfile_ec:"data_files/ec_384_pub.pem":0 + +X509 Parse Public EC Key #6 (RFC 5480, secp521r1) +depends_on:POLARSSL_PEM_C:POLARSSL_ECP_C:POLARSSL_ECP_DP_SECP521R1_ENABLED:POLARSSL_FS_IO +x509parse_public_keyfile_ec:"data_files/ec_521_pub.pem":0 + X509 Parse EC Key #1 (SEC1 DER) depends_on:POLARSSL_FS_IO:POLARSSL_ECP_C:POLARSSL_ECP_DP_SECP192R1_ENABLED x509parse_keyfile_ec:"data_files/ec_prv.sec1.der":NULL:0 @@ -222,6 +238,22 @@ X509 Parse EC Key #7 (PKCS8 encrypted PEM) depends_on:POLARSSL_DES_C:POLARSSL_PEM_C:POLARSSL_FS_IO:POLARSSL_ECP_C:POLARSSL_ECP_DP_SECP192R1_ENABLED x509parse_keyfile_ec:"data_files/ec_prv.pk8.pw.pem":"polar":0 +X509 Parse EC Key #8 (SEC1 PEM, secp224r1) +depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO:POLARSSL_ECP_C:POLARSSL_ECP_DP_SECP224R1_ENABLED +x509parse_keyfile_ec:"data_files/ec_224_prv.pem":NULL:0 + +X509 Parse EC Key #9 (SEC1 PEM, secp256r1) +depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO:POLARSSL_ECP_C:POLARSSL_ECP_DP_SECP256R1_ENABLED +x509parse_keyfile_ec:"data_files/ec_256_prv.pem":NULL:0 + +X509 Parse EC Key #10 (SEC1 PEM, secp384r1) +depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO:POLARSSL_ECP_C:POLARSSL_ECP_DP_SECP384R1_ENABLED +x509parse_keyfile_ec:"data_files/ec_384_prv.pem":NULL:0 + +X509 Parse EC Key #11 (SEC1 PEM, secp521r1) +depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO:POLARSSL_ECP_C:POLARSSL_ECP_DP_SECP521R1_ENABLED +x509parse_keyfile_ec:"data_files/ec_521_prv.pem":NULL:0 + X509 Get Distinguished Name #1 depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO x509_dn_gets:"data_files/server1.crt":subject:"C=NL, O=PolarSSL, CN=PolarSSL Server 1"