x509parse_crt() and x509parse_crt_der() return X509 password related codes

POLARSSL_ERR_X509_PASSWORD_MISMATCH is returned instead of
POLARSSL_ERR_PEM_PASSWORD_MISMATCH and
POLARSSL_ERR_X509_PASSWORD_REQUIRED instead of
POLARSSL_ERR_PEM_PASSWORD_REQUIRED

Rationale: For PKCS#8 encrypted keys the same are returned
This commit is contained in:
Paul Bakker 2013-06-17 15:58:04 +02:00
parent 1fc7dfe2e2
commit b495d3a2c7
2 changed files with 6 additions and 2 deletions

View File

@ -2354,6 +2354,10 @@ int x509parse_key( rsa_context *rsa, const unsigned char *key, size_t keylen,
pem_free( &pem ); pem_free( &pem );
return( ret ); return( ret );
} }
else if( ret == POLARSSL_ERR_PEM_PASSWORD_MISMATCH )
return( POLARSSL_ERR_X509_PASSWORD_MISMATCH );
else if( ret == POLARSSL_ERR_PEM_PASSWORD_REQUIRED )
return( POLARSSL_ERR_X509_PASSWORD_REQUIRED );
else if( ret != POLARSSL_ERR_PEM_NO_HEADER_FOOTER_PRESENT ) else if( ret != POLARSSL_ERR_PEM_NO_HEADER_FOOTER_PRESENT )
return( ret ); return( ret );

View File

@ -80,7 +80,7 @@ x509_crl_info:"data_files/crl_sha512.pem":"CRL version \: 1\nissuer name \:
X509 Parse Key #1 (No password when required) X509 Parse Key #1 (No password when required)
depends_on:POLARSSL_MD5_C:POLARSSL_PEM_C:POLARSSL_FS_IO depends_on:POLARSSL_MD5_C:POLARSSL_PEM_C:POLARSSL_FS_IO
x509parse_keyfile:"data_files/test-ca.key":NULL:POLARSSL_ERR_PEM_PASSWORD_REQUIRED x509parse_keyfile:"data_files/test-ca.key":NULL:POLARSSL_ERR_X509_PASSWORD_REQUIRED
X509 Parse Key #2 (Correct password) X509 Parse Key #2 (Correct password)
depends_on:POLARSSL_MD5_C:POLARSSL_PEM_C:POLARSSL_FS_IO depends_on:POLARSSL_MD5_C:POLARSSL_PEM_C:POLARSSL_FS_IO
@ -88,7 +88,7 @@ x509parse_keyfile:"data_files/test-ca.key":"PolarSSLTest":0
X509 Parse Key #3 (Wrong password) X509 Parse Key #3 (Wrong password)
depends_on:POLARSSL_MD5_C:POLARSSL_PEM_C:POLARSSL_FS_IO depends_on:POLARSSL_MD5_C:POLARSSL_PEM_C:POLARSSL_FS_IO
x509parse_keyfile:"data_files/test-ca.key":"PolarSSLWRONG":POLARSSL_ERR_PEM_PASSWORD_MISMATCH x509parse_keyfile:"data_files/test-ca.key":"PolarSSLWRONG":POLARSSL_ERR_X509_PASSWORD_MISMATCH
X509 Parse Key #4 (DES Encrypted) X509 Parse Key #4 (DES Encrypted)
depends_on:POLARSSL_MD5_C:POLARSSL_DES_C:POLARSSL_PEM_C:POLARSSL_FS_IO depends_on:POLARSSL_MD5_C:POLARSSL_DES_C:POLARSSL_PEM_C:POLARSSL_FS_IO