1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-08-07 06:42:56 +03:00

Add x509_crt_check_key_usage()

This commit is contained in:
Manuel Pégourié-Gonnard
2014-04-09 09:50:03 +02:00
committed by Paul Bakker
parent 0f79babd4b
commit 603116c570
5 changed files with 85 additions and 0 deletions

View File

@@ -1360,6 +1360,17 @@ int x509_crt_info( char *buf, size_t size, const char *prefix,
return( (int) ( size - n ) );
}
#if defined(POLARSSL_X509_CHECK_KEY_USAGE)
int x509_crt_check_key_usage( const x509_crt *crt, int usage )
{
if( ( crt->ext_types & EXT_KEY_USAGE ) != 0 &&
( crt->key_usage & usage ) != usage )
return( POLARSSL_ERR_X509_BAD_INPUT_DATA );
return( 0 );
}
#endif
#if defined(POLARSSL_X509_CRL_PARSE_C)
/*
* Return 1 if the certificate is revoked, or 0 otherwise.