Hi @msjcard
Thanks for your support.
I generated more CSR and some with length signature = 71 fails too... I'm going to share more examples.
When dumping bad_csr1.csr, I verify that its missing an 00 in the signature. The following error is diplayed:
281473519351472:error:0D07209B:asn1 encoding routines:ASN1_get_object:too long:../openssl-1.1.1d/crypto/asn1/asn1_lib.c:91:
281473519351472:error:0D068066:asn1 encoding routines:asn1_check_tlen:bad object header:../openssl-1.1.1d/crypto/asn1/tasn_dec.c:1118:
281473519351472:error:0D07803A:asn1 encoding routines:asn1_item_embed_d2i:nested asn1 error:../openssl-1.1.1d/crypto/asn1/tasn_dec.c:290:Type=ECDSA_SIG
281473519351472:error:0D0C5006:asn1 encoding routines:ASN1_item_verify:EVP lib:../openssl-1.1.1d/crypto/asn1/a_verify.c:170:
The others csr I check that extraBits field is being set to non-zero.
I tried to set ASN1 BIT STRING to zero with no success but maybe I'm doing it wrong.
X509_REQ_get0_signature((const X509_REQ *)csr_out, (const ASN1_BIT_STRING **)&sig, &tmp_algo);
memset(sig, 0, sizeof(ASN1_BIT_STRING));
X509_ALGOR *algo = (X509_ALGOR *)tmp_algo;
X509_ALGOR_set0(algo, OBJ_nid2obj(type), V_ASN1_NULL, NULL);
len = ASN1_BIT_STRING_set(sig, p_signature, signatureLen);
Thanks in advance