Topic: RSA Unpadding error with wc_SignatureVerify
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:
ret = wc_RsaUnPad_ex(key->data, key->dataLen, &pad, 0, pad_type,
hash, mgf, label, labelSz, saltLen,
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?