Extracting SubjectKeyId and AuthorityKeyId in case of x509 V3 extensions. Updating mbedtls_x509_crt_free function to also free the new dynamic elements (issuer field of AuthorityKeyId).

A few tests are also added which test the feature with a correct certificate and multiple ones with erroneous ASN1 tags.

Signed-off-by: toth92g <toth92g@gmail.com>
This commit is contained in:
toth92g 2021-02-12 16:11:17 +01:00 committed by Przemek Stekiel
parent 56f59d749c
commit a41954d0cf
14 changed files with 437 additions and 2 deletions

View file

@ -319,7 +319,17 @@ static const oid_x509_ext_t oid_x509_ext[] =
MBEDTLS_OID_X509_EXT_CERTIFICATE_POLICIES,
},
{
NULL_OID_DESCRIPTOR,
{ ADD_LEN(MBEDTLS_OID_SUBJECT_KEY_IDENTIFIER), "id-ce-subjectKeyIdentifier",
"Subject Key Identifier" },
MBEDTLS_OID_X509_EXT_SUBJECT_KEY_IDENTIFIER,
},
{
{ ADD_LEN(MBEDTLS_OID_AUTHORITY_KEY_IDENTIFIER), "id-ce-authorityKeyIdentifier",
"Authority Key Identifier" },
MBEDTLS_OID_X509_EXT_AUTHORITY_KEY_IDENTIFIER,
},
{
{ NULL, 0, NULL, NULL },
0,
},
};