# Can RSA signing be implemented on top of RSA encryption/decryption?

I need to use RSA-SHA256 signing. Unfortunately not all Microsoft CryptoAPI providers support that. It's possible that I might get a handle to a CryptoAPI provider that can just encrypt/decrypt with RSA, and maybe sign with SHA1, but not SHA256. Also, the private key might be unavailable (say, it could be in a smart card or some such device).

Is it then possible for me to "fill the gaps" myself? I can, after all, calculate the SHA256 hash of the data myself. Can I then somehow encrypt it with the provider and get a valid signature? Simply encrypting the hash doesn't seem to work (it produces the wrong result).

Or is the signing algorithm a modification of the encryption algorithm, and if the provider doesn't support it, then there's physically nothing that I can do?

• Here are two questions and answers on this site that are related and you should understand: crypto.stackexchange.com/questions/12090/… crypto.stackexchange.com/questions/15997/… – mikeazo Nov 11 '14 at 18:12
• @mikeazo - OK, so, no, I can't. Thank you very much! If you make this into an answer, I'll accept it and delete my SO question. – Vilx- Nov 11 '14 at 18:18
• @Vlix, there may be some details about MS CryptoAPI I don't understand. Technically if you MS CryptoAPI can compute $m^d\bmod{N}$ for some specially chosen $m$ (e.g. padding(sha256(your message))) then it may be possible. I'll leave this as is to see if someone else can comment. – mikeazo Nov 11 '14 at 18:35
• @mikeazo - AFAIK I cannot affect the padding. It takes care of that itself. I can only choose whether I want to use PKCS1.5 or OAEP padding when encrypting/decrypting. Since, according to those links, signatures use a different padding algorithm, there's nothing I can do... – Vilx- Nov 11 '14 at 18:39