Topic: RSA callbacks
As specified in rfc5246 (TLS v1.2) for signature calculation and verification, the RSASSA-PKCS1-v1_5 signature scheme is used.
I would like to use my own RSA callbacks for for signing and verifiying, however, the role of the callbacks is not clear and confusing for me.
This is what I think that the callbacks shall do:
For the RSA sign callback:
1- encode the message -> EM = EMSA-PKCS1-V1_5-ENCODE (M) with [M -> the message], [EM -> the encoded message]
2- sign the encoded message
For the RSA verify callback:
1- decrypt the signature which will result on the encoded message (EM)
(The role of the verify callback function is to only decrypt the signature? shall it decode the decrypted signature?)
After the verify callback is called, I think another wolfssl function is called to do the following:
1- encode the received message EM' = EMSA-PKCS1-V1_5-ENCODE (M)
2- compare EM' with EM and succeed if EM' is equal to EM
Is my understanding correct? what shall the RSA callbacks do exactly?
Thanks in advance,