Add test for x509parse_public_keyfile_ec
This commit is contained in:
parent
26833c2fc6
commit
1bc6931f8c
4 changed files with 33 additions and 0 deletions
BIN
tests/data_files/ec_pub.der
Normal file
BIN
tests/data_files/ec_pub.der
Normal file
Binary file not shown.
4
tests/data_files/ec_pub.pem
Normal file
4
tests/data_files/ec_pub.pem
Normal file
|
@ -0,0 +1,4 @@
|
|||
-----BEGIN PUBLIC KEY-----
|
||||
ME4wEAYHKoZIzj0CAQYFK4EEACEDOgAEb3GKqedAJ2/1CRdhjIRhQO+4erL49GlI
|
||||
QrBg7frKWrc6ZrnjgXgdHt68Tux/2IyRuff+lvGn32s=
|
||||
-----END PUBLIC KEY-----
|
|
@ -186,6 +186,14 @@ X509 Parse Public RSA Key #1 (PKCS#8 wrapped)
|
|||
depends_on:POLARSSL_MD5_C:POLARSSL_PEM_C:POLARSSL_FS_IO
|
||||
x509parse_public_keyfile_rsa:"data_files/format_gen.pub":0
|
||||
|
||||
X509 Parse Public EC Key #1 (RFC 5480, DER)
|
||||
depends_on:POLARSSL_ECP_C:POLARSSL_FS_IO
|
||||
x509parse_public_keyfile_ec:"data_files/ec_pub.der":0
|
||||
|
||||
X509 Parse Public EC Key #2 (RFC 5480, PEM)
|
||||
depends_on:POLARSSL_PEM_C:POLARSSL_ECP_C:POLARSSL_FS_IO
|
||||
x509parse_public_keyfile_ec:"data_files/ec_pub.pem":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"
|
||||
|
|
|
@ -179,6 +179,27 @@ x509parse_public_keyfile_rsa:key_file:result
|
|||
}
|
||||
END_CASE
|
||||
|
||||
BEGIN_CASE
|
||||
x509parse_public_keyfile_ec:key_file:result
|
||||
{
|
||||
ecp_keypair eckey;
|
||||
int res;
|
||||
|
||||
ecp_keypair_init( &eckey );
|
||||
|
||||
res = x509parse_public_keyfile_ec( &eckey, {key_file} );
|
||||
|
||||
TEST_ASSERT( res == {result} );
|
||||
|
||||
if( res == 0 )
|
||||
{
|
||||
TEST_ASSERT( ecp_check_pubkey( &eckey.grp, &eckey.Q ) == 0 );
|
||||
}
|
||||
|
||||
ecp_keypair_free( &eckey );
|
||||
}
|
||||
END_CASE
|
||||
|
||||
BEGIN_CASE
|
||||
x509parse_crt:crt_data:result_str:result
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue