owner-openssl-us...@openssl.org wrote on 10/28/2010 03:07:18 AM: > From: Bob Dijck <di...@turnhout.tokheim.com> > > I am trying to implement a signing function in C++ using RSA. > Here’s how I wanted to do this: > - First I calculate the SHA1 hash (not using openssl but another > implementation). > - But then what? Should I use RSA_private_encrypt or rsa_sign? > When I use RSA_private_encrypt the result is different from when I > use rsa_sign… The openssl support pages mention that in case of > RSA_PKCS1_PADDING (that’s the one I use) I should use rsa_sign. Is > there any way around this? > > I thought that signing was a two step process: hash + RSA encryption > of hash. Am I doing something wrong?
There are two other steps. It's: - hash - prepend an OID - prepend a pad - RSA private key operation If you're application likes openssl's standard OID and pad, you can use rsa_sign. If not, you can do whatever you like.