@@ -13194,6 +13194,18 @@ static int GetRDN(DecodedCert* cert, char* full, word32* idx, int* nid,
1319413194 *nid = NID_favouriteDrink;
1319513195 #endif
1319613196 }
13197+ #ifdef WOLFSSL_CERT_REQ
13198+ else if (oidSz == sizeof(attrPkcs9ContentTypeOid) &&
13199+ XMEMCMP(oid, attrPkcs9ContentTypeOid, oidSz) == 0) {
13200+ /* Set the pkcs9_contentType, type string, length and NID. */
13201+ id = ASN_CONTENT_TYPE;
13202+ typeStr = WOLFSSL_CONTENT_TYPE;
13203+ typeStrLen = sizeof(WOLFSSL_CONTENT_TYPE) - 1;
13204+ #ifdef WOLFSSL_X509_NAME_AVAILABLE
13205+ *nid = NID_pkcs9_contentType;
13206+ #endif
13207+ }
13208+ #endif
1319713209 /* Other OIDs that start with the same values. */
1319813210 else if (oidSz == sizeof(dcOid) && XMEMCMP(oid, dcOid, oidSz-1) == 0) {
1319913211 WOLFSSL_MSG("Unknown pilot attribute type");
@@ -13845,7 +13857,6 @@ static int GetCertName(DecodedCert* cert, char* full, byte* hash, int nameType,
1384513857 nid = NID_userId;
1384613858 #endif /* OPENSSL_EXTRA */
1384713859 break;
13848-
1384913860 case ASN_DOMAIN_COMPONENT:
1385013861 copy = WOLFSSL_DOMAIN_COMPONENT;
1385113862 copyLen = sizeof(WOLFSSL_DOMAIN_COMPONENT) - 1;
@@ -13864,7 +13875,15 @@ static int GetCertName(DecodedCert* cert, char* full, byte* hash, int nameType,
1386413875 nid = NID_favouriteDrink;
1386513876 #endif /* OPENSSL_EXTRA */
1386613877 break;
13867-
13878+ case ASN_CONTENT_TYPE:
13879+ copy = WOLFSSL_CONTENT_TYPE;
13880+ copyLen = sizeof(WOLFSSL_CONTENT_TYPE) - 1;
13881+ #if (defined(OPENSSL_EXTRA) || \
13882+ defined(OPENSSL_EXTRA_X509_SMALL)) \
13883+ && !defined(WOLFCRYPT_ONLY)
13884+ nid = NID_pkcs9_contentType;
13885+ #endif /* OPENSSL_EXTRA */
13886+ break;
1386813887 default:
1386913888 WOLFSSL_MSG("Unknown pilot attribute type");
1387013889 #if (defined(OPENSSL_EXTRA) || \
@@ -26457,6 +26476,12 @@ static int EncodeName(EncodedName* name, const char* nameStr,
2645726476 thisLen += cname->custom.oidSz;
2645826477 firstSz = cname->custom.oidSz;
2645926478 break;
26479+ #endif
26480+ #ifdef WOLFSSL_CERT_REQ
26481+ case ASN_CONTENT_TYPE:
26482+ thisLen += (int)sizeof(attrPkcs9ContentTypeOid);
26483+ firstSz = (int)sizeof(attrPkcs9ContentTypeOid);
26484+ break;
2646026485 #endif
2646126486 default:
2646226487 thisLen += DN_OID_SZ;
@@ -26521,6 +26546,15 @@ static int EncodeName(EncodedName* name, const char* nameStr,
2652126546 /* str type */
2652226547 name->encoded[idx++] = nameTag;
2652326548 break;
26549+ #endif
26550+ #ifdef WOLFSSL_CERT_REQ
26551+ case ASN_CONTENT_TYPE:
26552+ XMEMCPY(name->encoded + idx, attrPkcs9ContentTypeOid,
26553+ sizeof(attrPkcs9ContentTypeOid));
26554+ idx += (int)sizeof(attrPkcs9ContentTypeOid);
26555+ /* str type */
26556+ name->encoded[idx++] = nameTag;
26557+ break;
2652426558 #endif
2652526559 default:
2652626560 name->encoded[idx++] = 0x55;
@@ -26593,6 +26627,12 @@ static int EncodeName(EncodedName* name, const char* nameStr,
2659326627 oid = cname->custom.oid;
2659426628 oidSz = cname->custom.oidSz;
2659526629 break;
26630+ #endif
26631+ #ifdef WOLFSSL_CERT_REQ
26632+ case ASN_CONTENT_TYPE:
26633+ oid = attrPkcs9ContentTypeOid;
26634+ oidSz = sizeof(attrPkcs9ContentTypeOid);
26635+ break;
2659626636 #endif
2659726637 default:
2659826638 /* Construct OID using type. */
0 commit comments