Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

rsa_sign(3) [netbsd man page]

RSA_sign(3)							      OpenSSL							       RSA_sign(3)

NAME
RSA_sign, RSA_verify - RSA signatures LIBRARY
libcrypto, -lcrypto SYNOPSIS
#include <openssl/rsa.h> int RSA_sign(int type, const unsigned char *m, unsigned int m_len, unsigned char *sigret, unsigned int *siglen, RSA *rsa); int RSA_verify(int type, const unsigned char *m, unsigned int m_len, unsigned char *sigbuf, unsigned int siglen, RSA *rsa); DESCRIPTION
RSA_sign() signs the message digest m of size m_len using the private key rsa as specified in PKCS #1 v2.0. It stores the signature in sigret and the signature size in siglen. sigret must point to RSA_size(rsa) bytes of memory. Note that PKCS #1 adds meta-data, placing limits on the size of the key that can be used. See RSA_private_encrypt(3) for lower-level operations. type denotes the message digest algorithm that was used to generate m. It usually is one of NID_sha1, NID_ripemd160 and NID_md5; see objects(3) for details. If type is NID_md5_sha1, an SSL signature (MD5 and SHA1 message digests with PKCS #1 padding and no algorithm identifier) is created. RSA_verify() verifies that the signature sigbuf of size siglen matches a given message digest m of size m_len. type denotes the message digest algorithm that was used to generate the signature. rsa is the signer's public key. RETURN VALUES
RSA_sign() returns 1 on success, 0 otherwise. RSA_verify() returns 1 on successful verification, 0 otherwise. The error codes can be obtained by ERR_get_error(3). BUGS
Certain signatures with an improper algorithm identifier are accepted for compatibility with SSLeay 0.4.5 :-) CONFORMING TO
SSL, PKCS #1 v2.0 SEE ALSO
ERR_get_error(3), objects(3), openssl_rsa(3), RSA_private_encrypt(3), RSA_public_decrypt(3) HISTORY
RSA_sign() and RSA_verify() are available in all versions of SSLeay and OpenSSL. 1.0.1i 2014-08-10 RSA_sign(3)

Check Out this Related Man Page

RSA_private_encrypt(3)						      OpenSSL						    RSA_private_encrypt(3)

NAME
RSA_private_encrypt, RSA_public_decrypt - low level signature operations SYNOPSIS
#include <openssl/rsa.h> int RSA_private_encrypt(int flen, unsigned char *from, unsigned char *to, RSA *rsa, int padding); int RSA_public_decrypt(int flen, unsigned char *from, unsigned char *to, RSA *rsa, int padding); DESCRIPTION
These functions handle RSA signatures at a low level. RSA_private_encrypt() signs the flen bytes at from (usually a message digest with an algorithm identifier) using the private key rsa and stores the signature in to. to must point to RSA_size(rsa) bytes of memory. padding denotes one of the following modes: RSA_PKCS1_PADDING PKCS #1 v1.5 padding. This function does not handle the algorithmIdentifier specified in PKCS #1. When generating or verifying PKCS #1 signatures, RSA_sign(3) and RSA_verify(3) should be used. RSA_NO_PADDING 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. RSA_public_decrypt() recovers the message digest from the flen bytes long signature at from using the signer's public key rsa. to must point to a memory section large enough to hold the message digest (which is smaller than RSA_size(rsa) - 11). padding is the padding mode that was used to sign the data. RETURN VALUES
RSA_private_encrypt() returns the size of the signature (i.e., RSA_size(rsa)). RSA_public_decrypt() returns the size of the recovered message digest. On error, -1 is returned; the error codes can be obtained by ERR_get_error(3). SEE ALSO
ERR_get_error(3), rsa(3), RSA_sign(3), RSA_verify(3) HISTORY
The padding argument was added in SSLeay 0.8. RSA_NO_PADDING is available since SSLeay 0.9.0. 0.9.8 2009-04-03 RSA_private_encrypt(3)
Man Page