NAME
RSAprivateencrypt, RSApublicdecrypt - low level signature
operationsSYNOPSIS
#include
int RSAprivateencrypt(int flen, unsigned char *from, unsigned char *to, RSA *rsa, int padding); int RSApublicdecrypt(int flen, unsigned char *from, unsigned char *to, RSA *rsa, int padding);DESCRIPTION
These functions handle RSA signatures at a low level. RSAprivateencrypt() signs the fflleenn bytes at ffrroomm (usually a message digest with an algorithm identifier) using the private key rrssaa and stores the signature in ttoo. ttoo must point to RRSSAAssiizzee((rrssaa)) bytes of memory. ppaaddddiinngg denotes one of the following modes: RSAPKCS1PADDINGPKCS #1 v1.5 padding. This function does not handle the
aallggoorriitthhmmIIddeennttiiffiieerr specified in PKCS #1. When generating or
verifying PKCS #1 signatures, RSAsign(3) and RSAverify(3) should
be used. RSANOPADDING Raw RSA signature. This mode should only be used to implement cryptographically sound padding modes in the application code. Signing user data directly with RSA is insecure. RSApublicdecrypt() recovers the message digest from the fflleenn bytes long signature at ffrroomm using the signer's public key rrssaa. ttoo must point to a memory section large enough to hold the message digest (which issmaller than RRSSAAssiizzee((rrssaa)) - 1111). ppaaddddiinngg is the padding mode that was
used to sign the data.RETURN VALUES
RSAprivateencrypt() returns the size of the signature (i.e., RSAsize(rsa)). RSApublicdecrypt() returns the size of the recovered message digest.On error, -1 is returned; the error codes can be obtained by
ERRgeterror(3).SEE ALSO
ERRgeterror(3), rsa(3), RSAsign(3), RSAverify(3) HISTORY The ppaaddddiinngg argument was added in SSLeay 0.8. RSANOPADDING is available since SSLeay 0.9.0.0.9.7l 2002-09-25 RSAprivateencrypt(3)