Decode the serialNumber field in the X.509 names

This commit is contained in:
John Safranek 2013-09-15 22:10:58 -07:00
parent 49f82c4717
commit e564b614bf
2 changed files with 10 additions and 2 deletions

View File

@ -1578,8 +1578,8 @@ static int GetName(DecodedCert* cert, int nameType)
cert->maxIdx) < 0)
return ASN_PARSE_E;
if ( (strLen + 4) > (int)(ASN_NAME_MAX - idx)) {
/* include biggest pre fix header too 4 = "/CN=" */
if ( (strLen + 14) > (int)(ASN_NAME_MAX - idx)) {
/* include biggest pre fix header too 4 = "/serialNumber=" */
CYASSL_MSG("ASN Name too big, skipping");
tooBig = TRUE;
}
@ -1674,6 +1674,13 @@ static int GetName(DecodedCert* cert, int nameType)
}
#endif /* CYASSL_CERT_GEN */
}
else if (id == ASN_SERIAL_NUMBER) {
if (!tooBig) {
XMEMCPY(&full[idx], "/serialNumber=", 14);
idx += 14;
copy = TRUE;
}
}
if (copy && !tooBig) {
XMEMCPY(&full[idx], &cert->source[cert->srcIdx], strLen);

View File

@ -78,6 +78,7 @@ enum ASN_Flags{
enum DN_Tags {
ASN_COMMON_NAME = 0x03, /* CN */
ASN_SUR_NAME = 0x04, /* SN */
ASN_SERIAL_NUMBER = 0x05, /* serialNumber */
ASN_COUNTRY_NAME = 0x06, /* C */
ASN_LOCALITY_NAME = 0x07, /* L */
ASN_STATE_NAME = 0x08, /* ST */