mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-08-02 20:24:39 +02:00
Decode the serialNumber field in the X.509 names
This commit is contained in:
@@ -1578,8 +1578,8 @@ static int GetName(DecodedCert* cert, int nameType)
|
|||||||
cert->maxIdx) < 0)
|
cert->maxIdx) < 0)
|
||||||
return ASN_PARSE_E;
|
return ASN_PARSE_E;
|
||||||
|
|
||||||
if ( (strLen + 4) > (int)(ASN_NAME_MAX - idx)) {
|
if ( (strLen + 14) > (int)(ASN_NAME_MAX - idx)) {
|
||||||
/* include biggest pre fix header too 4 = "/CN=" */
|
/* include biggest pre fix header too 4 = "/serialNumber=" */
|
||||||
CYASSL_MSG("ASN Name too big, skipping");
|
CYASSL_MSG("ASN Name too big, skipping");
|
||||||
tooBig = TRUE;
|
tooBig = TRUE;
|
||||||
}
|
}
|
||||||
@@ -1674,6 +1674,13 @@ static int GetName(DecodedCert* cert, int nameType)
|
|||||||
}
|
}
|
||||||
#endif /* CYASSL_CERT_GEN */
|
#endif /* CYASSL_CERT_GEN */
|
||||||
}
|
}
|
||||||
|
else if (id == ASN_SERIAL_NUMBER) {
|
||||||
|
if (!tooBig) {
|
||||||
|
XMEMCPY(&full[idx], "/serialNumber=", 14);
|
||||||
|
idx += 14;
|
||||||
|
copy = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (copy && !tooBig) {
|
if (copy && !tooBig) {
|
||||||
XMEMCPY(&full[idx], &cert->source[cert->srcIdx], strLen);
|
XMEMCPY(&full[idx], &cert->source[cert->srcIdx], strLen);
|
||||||
|
@@ -78,6 +78,7 @@ enum ASN_Flags{
|
|||||||
enum DN_Tags {
|
enum DN_Tags {
|
||||||
ASN_COMMON_NAME = 0x03, /* CN */
|
ASN_COMMON_NAME = 0x03, /* CN */
|
||||||
ASN_SUR_NAME = 0x04, /* SN */
|
ASN_SUR_NAME = 0x04, /* SN */
|
||||||
|
ASN_SERIAL_NUMBER = 0x05, /* serialNumber */
|
||||||
ASN_COUNTRY_NAME = 0x06, /* C */
|
ASN_COUNTRY_NAME = 0x06, /* C */
|
||||||
ASN_LOCALITY_NAME = 0x07, /* L */
|
ASN_LOCALITY_NAME = 0x07, /* L */
|
||||||
ASN_STATE_NAME = 0x08, /* ST */
|
ASN_STATE_NAME = 0x08, /* ST */
|
||||||
|
Reference in New Issue
Block a user