@@ -13194,6 +13194,16 @@ static int GetRDN(DecodedCert* cert, char* full, word32* idx, int* nid,
1319413194 *nid = NID_favouriteDrink;
1319513195 #endif
1319613196 }
13197+ else if (oidSz == sizeof(attrPkcs9ContentTypeOid) &&
13198+ XMEMCMP(oid, attrPkcs9ContentTypeOid, oidSz) == 0) {
13199+ /* Set the pkcs9_contentType, type string, length and NID. */
13200+ id = ASN_CONTENT_TYPE;
13201+ typeStr = WOLFSSL_CONTENT_TYPE;
13202+ typeStrLen = sizeof(WOLFSSL_CONTENT_TYPE) - 1;
13203+ #ifdef WOLFSSL_X509_NAME_AVAILABLE
13204+ *nid = NID_pkcs9_contentType;
13205+ #endif
13206+ }
1319713207 /* Other OIDs that start with the same values. */
1319813208 else if (oidSz == sizeof(dcOid) && XMEMCMP(oid, dcOid, oidSz-1) == 0) {
1319913209 WOLFSSL_MSG("Unknown pilot attribute type");
@@ -13845,7 +13855,6 @@ static int GetCertName(DecodedCert* cert, char* full, byte* hash, int nameType,
1384513855 nid = NID_userId;
1384613856 #endif /* OPENSSL_EXTRA */
1384713857 break;
13848-
1384913858 case ASN_DOMAIN_COMPONENT:
1385013859 copy = WOLFSSL_DOMAIN_COMPONENT;
1385113860 copyLen = sizeof(WOLFSSL_DOMAIN_COMPONENT) - 1;
@@ -13864,7 +13873,15 @@ static int GetCertName(DecodedCert* cert, char* full, byte* hash, int nameType,
1386413873 nid = NID_favouriteDrink;
1386513874 #endif /* OPENSSL_EXTRA */
1386613875 break;
13867-
13876+ case ASN_CONTENT_TYPE:
13877+ copy = WOLFSSL_CONTENT_TYPE;
13878+ copyLen = sizeof(WOLFSSL_CONTENT_TYPE) - 1;
13879+ #if (defined(OPENSSL_EXTRA) || \
13880+ defined(OPENSSL_EXTRA_X509_SMALL)) \
13881+ && !defined(WOLFCRYPT_ONLY)
13882+ nid = NID_pkcs9_contentType;
13883+ #endif /* OPENSSL_EXTRA */
13884+ break;
1386813885 default:
1386913886 WOLFSSL_MSG("Unknown pilot attribute type");
1387013887 #if (defined(OPENSSL_EXTRA) || \
@@ -26458,6 +26475,9 @@ static int EncodeName(EncodedName* name, const char* nameStr,
2645826475 firstSz = cname->custom.oidSz;
2645926476 break;
2646026477 #endif
26478+ case ASN_CONTENT_TYPE:
26479+ thisLen += (int)sizeof(attrPkcs9ContentTypeOid);
26480+ firstSz = (int)sizeof(attrPkcs9ContentTypeOid);
2646126481 default:
2646226482 thisLen += DN_OID_SZ;
2646326483 firstSz = DN_OID_SZ;
@@ -26522,6 +26542,13 @@ static int EncodeName(EncodedName* name, const char* nameStr,
2652226542 name->encoded[idx++] = nameTag;
2652326543 break;
2652426544 #endif
26545+ case ASN_CONTENT_TYPE:
26546+ XMEMCPY(name->encoded + idx, attrPkcs9ContentTypeOid,
26547+ sizeof(attrPkcs9ContentTypeOid));
26548+ idx += (int)sizeof(attrPkcs9ContentTypeOid);
26549+ /* str type */
26550+ name->encoded[idx++] = nameTag;
26551+ break;
2652526552 default:
2652626553 name->encoded[idx++] = 0x55;
2652726554 name->encoded[idx++] = 0x04;
@@ -26594,6 +26621,10 @@ static int EncodeName(EncodedName* name, const char* nameStr,
2659426621 oidSz = cname->custom.oidSz;
2659526622 break;
2659626623 #endif
26624+ case ASN_CONTENT_TYPE:
26625+ oid = attrPkcs9ContentTypeOid;
26626+ oidSz = sizeof(attrPkcs9ContentTypeOid);
26627+ break;
2659726628 default:
2659826629 /* Construct OID using type. */
2659926630 dnOid[2] = type;
0 commit comments