diff --git a/tests/suites/test_suite_x509parse.data b/tests/suites/test_suite_x509parse.data index f21e5bd3f9..aa09d29303 100644 --- a/tests/suites/test_suite_x509parse.data +++ b/tests/suites/test_suite_x509parse.data @@ -110,6 +110,14 @@ X509 Parse Key #8 (AES-256 Encrypted) depends_on:POLARSSL_MD5_C:POLARSSL_AES_C:POLARSSL_PEM_C:POLARSSL_FS_IO x509parse_keyfile:"data_files/keyfile.aes256":"testkey":0 +X509 Parse Key #9 (PKCS#8 wrapped) +depends_on:POLARSSL_MD5_C:POLARSSL_PEM_C:POLARSSL_FS_IO +x509parse_keyfile:"data_files/format_gen.key":"":0 + +X509 Parse Public Key #1 (PKCS#8 wrapped) +depends_on:POLARSSL_MD5_C:POLARSSL_PEM_C:POLARSSL_FS_IO +x509parse_public_keyfile:"data_files/format_gen.pub":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" @@ -351,7 +359,7 @@ X509 Certificate ASN1 (TBSCertificate, pubkey, no alg) x509parse_crt:"30583056a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a300806001304546573743000":"":POLARSSL_ERR_X509_CERT_INVALID_ALG + POLARSSL_ERR_ASN1_OUT_OF_DATA X509 Certificate ASN1 (TBSCertificate, valid subject, unknown pk alg) -x509parse_crt:"30673065a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374300f300d06092A864886F70D0101000500":"":POLARSSL_ERR_X509_CERT_UNKNOWN_PK_ALG +x509parse_crt:"30673065a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374300f300d06092A864886F70D0101000500":"":POLARSSL_ERR_X509_UNKNOWN_PK_ALG X509 Certificate ASN1 (TBSCertificate, pubkey, no bitstring) x509parse_crt:"30673065a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374300f300d06092A864886F70D0101010500":"":POLARSSL_ERR_X509_CERT_INVALID_PUBKEY + POLARSSL_ERR_ASN1_OUT_OF_DATA diff --git a/tests/suites/test_suite_x509parse.function b/tests/suites/test_suite_x509parse.function index 938d3d0c84..c325286ad3 100644 --- a/tests/suites/test_suite_x509parse.function +++ b/tests/suites/test_suite_x509parse.function @@ -143,6 +143,25 @@ x509parse_keyfile:key_file:password:result } END_CASE +BEGIN_CASE +x509parse_public_keyfile:key_file:result +{ + rsa_context rsa; + int res; + + memset( &rsa, 0, sizeof( rsa_context ) ); + + res = x509parse_public_keyfile( &rsa, {key_file} ); + + TEST_ASSERT( res == {result} ); + + if( res == 0 ) + { + TEST_ASSERT( rsa_check_pubkey( &rsa ) == 0 ); + } +} +END_CASE + BEGIN_CASE x509parse_crt:crt_data:result_str:result {