mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-08-01 10:06:53 +03:00
Add certificate policy oid x509 extension
Add the `MBEDTLS_OID_X509_EXT_CERTIFICATE_POLICIES` to the list of supported x509 extensions, in `mbedtls_oid_get_x509_ext_type()`.
This commit is contained in:
@ -33,3 +33,27 @@ oid_get_extended_key_usage:"5533445566":""
|
||||
|
||||
OID get Ext Key Usage wrong oid - id-ce-authorityKeyIdentifier
|
||||
oid_get_extended_key_usage:"551D23":""
|
||||
|
||||
OID get x509 extension - id-ce-basicConstraints
|
||||
oid_get_x509_extension:"551D13":MBEDTLS_OID_X509_EXT_BASIC_CONSTRAINTS
|
||||
|
||||
OID get x509 extension - id-ce-keyUsage
|
||||
oid_get_x509_extension:"551D0F":MBEDTLS_OID_X509_EXT_KEY_USAGE
|
||||
|
||||
OID get x509 extension - id-ce-extKeyUsage
|
||||
oid_get_x509_extension:"551D25":MBEDTLS_OID_X509_EXT_EXTENDED_KEY_USAGE
|
||||
|
||||
OID get x509 extension - id-ce-subjectAltName
|
||||
oid_get_x509_extension:"551D11":MBEDTLS_OID_X509_EXT_SUBJECT_ALT_NAME
|
||||
|
||||
OID get x509 extension - id-netscape-certtype
|
||||
oid_get_x509_extension:"6086480186F8420101":MBEDTLS_OID_X509_EXT_NS_CERT_TYPE
|
||||
|
||||
OID get x509 extension - id-ce-certificatePolicies
|
||||
oid_get_x509_extension:"551D20":MBEDTLS_OID_X509_EXT_CERTIFICATE_POLICIES
|
||||
|
||||
OID get x509 extension - invalid oid
|
||||
oid_get_x509_extension:"5533445566":0
|
||||
|
||||
OID get x509 extension - wrong oid - id-ce
|
||||
oid_get_x509_extension:"551D":0
|
||||
|
@ -55,3 +55,26 @@ void oid_get_extended_key_usage( data_t *oid, char *result_str )
|
||||
}
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void oid_get_x509_extension( data_t *oid, int exp_type )
|
||||
{
|
||||
mbedtls_asn1_buf ext_oid = { 0, 0, NULL };
|
||||
int ret;
|
||||
int ext_type;
|
||||
|
||||
ext_oid.tag = MBEDTLS_ASN1_OID;
|
||||
ext_oid.p = oid->x;
|
||||
ext_oid.len = oid->len;
|
||||
|
||||
ret = mbedtls_oid_get_x509_ext_type( &ext_oid, &ext_type );
|
||||
if( exp_type == 0 )
|
||||
{
|
||||
TEST_ASSERT( ret == MBEDTLS_ERR_OID_NOT_FOUND );
|
||||
}
|
||||
else
|
||||
{
|
||||
TEST_ASSERT( ext_type == exp_type );
|
||||
}
|
||||
}
|
||||
/* END_CASE */
|
||||
|
Reference in New Issue
Block a user