1 (edited by ron.haber 2019-07-11 10:46:14)

Topic: RSA Unpadding error with wc_SignatureVerify

Hi,

I have a signed file that I need to verify from a separate RSA encrypted signature. I am currently using:
wc_SignatureVerify(WC_HASH_TYPE_SHA256, WC_SIGNATURE_TYPE_RSA, file_data_buffer, file_length,
                hash_data_buffer, hash_length, &public_key, sizeof(RsaKey))
where hash_data_buffer is the buffer that contains the RSA encrypted hash used for verification.
I have confirmed that RSA public key is correct.
When I run the code I get an output error -201 which I have narrowed down to the wc_RsaUnPad function in rsa.c.
Basically what I've noticed is that there is a buffer pointer that is being initialized and remains NULL as such:
        byte* pad;
        ret = wc_RsaUnPad_ex(key->data, key->dataLen, &pad, 0, pad_type,
                             hash, mgf, label, labelSz, saltLen,
                             mp_count_bits(&key->n), key->heap);
As well, I have tried having it point to an empty buffer but still receive the same unpadding error.
My padding type is PKCSV15.
What is it I could be doing wrong?

Share

Re: RSA Unpadding error with wc_SignatureVerify

NOTE: Being worked on via zendesk through support@wolfssl.com