Skip PKCS8 header check in wc_CreatePKCS8Key with WOLFSSL_NO_ASN_STRICT

This commit is contained in:
Lealem Amedie
2025-04-22 16:58:04 -06:00
parent 882eaa5df8
commit 5fe086b388

View File

@ -8231,11 +8231,16 @@ int wc_CreatePKCS8Key(byte* out, word32* outSz, byte* key, word32 keySz,
ret = BAD_FUNC_ARG;
}
#ifndef WOLFSSL_NO_ASN_STRICT
/* Sanity check: make sure key doesn't have PKCS #8 header. */
if (ToTraditionalInline_ex(key, &keyIdx, keySz, &tmpAlgId) >= 0) {
(void)tmpAlgId;
ret = ASN_PARSE_E;
}
#else
(void)keyIdx;
(void)tmpAlgId;
#endif
CALLOC_ASNSETDATA(dataASN, pkcs8KeyASN_Length-1, ret, NULL);