These are not allowed in X.509 certificates according to RFC 5480 and
some newer validations apparently explicitly check for this.
Note that WolfSSL rejects such keys, by default. Only when compiled with
WOLFSSL_NO_ASN_STRICT are they accepted.
}
idx = 0;
- if (wc_EccPrivateKeyDecode(key.ptr, &idx, &this->ec, key.len) < 0)
+ if (wc_EccPrivateKeyDecode(key.ptr, &idx, &this->ec, key.len) < 0 ||
+ this->ec.idx == -1)
{
destroy(this);
return NULL;
idx = 0;
ret = wc_EccPublicKeyDecode(blob.ptr, &idx, &this->ec, blob.len);
- if (ret < 0)
+ if (ret < 0 || this->ec.idx == -1)
{
destroy(this);
return NULL;