diff --git a/ctaocrypt/src/asn.c b/ctaocrypt/src/asn.c index 4ee25bee4..145c11a44 100644 --- a/ctaocrypt/src/asn.c +++ b/ctaocrypt/src/asn.c @@ -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); diff --git a/cyassl/ctaocrypt/asn.h b/cyassl/ctaocrypt/asn.h index eadf8c1f8..1e6d34cf4 100644 --- a/cyassl/ctaocrypt/asn.h +++ b/cyassl/ctaocrypt/asn.h @@ -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 */