RSA_SIGN(3)

πŸ“¦ version 4.4.0, in alpine 3.24, arch rolling

πŸ’… RSA_SIGN(3) β€” RSA signatures, but make it make sense

okay so bestie, this page comes from the Library Functions Manual, and it’s all about RSA_sign and RSA_verify doing their RSA signature thing. If you need to sign a message digest or verify a signature, this is your lane. No cap, every detail is down below. 🫢


✨ NAME ✨

RSA_sign, RSA_verify β€” RSA signatures

🌸 SYNOPSIS 🌸

first, the library + include situation, literally:

       library β€œlibcrypto” #include <openssl/rsa.h>

and the signatures, exactly:

       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, and it does it with RSASSA-PKCS1-v1_5 as specified in RFC 3447. It stores the signature in sigret and the signature size in siglen. sigret must point to RSA_size(rsa) bytes of memory.

heads up bestie: PKCS #1 adds meta-data, placing limits on the size of the key that can be used. Need the lower-level operations tea? See RSA_private_encrypt(3).

type denotes the message digest algorithm that was used to generate m. If type is NID_md5_sha1, an SSL signature (MD5 and SHA-1 message digests with PKCS #1 padding and no algorithm identifier) is created. that’s the little special case, iykyk. πŸ’…

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. RSA_verify() returns 1 on successful verification. periodt. ✨

The error codes can be obtained by ERR_get_error(3).

πŸ¦‹ SEE ALSO πŸ¦‹

go touch these other pages, bestie:

🌈 STANDARDS 🌈

SSL, PKCS #1 v2.0

πŸ‘‘ HISTORY πŸ‘‘

RSA_sign() first appeared in SSLeay 0.4.4. RSA_verify() first appeared in SSLeay 0.6.0. Both functions have been available since OpenBSD 2.4.


mwah πŸ’‹ β€” source/version vibes: Debian, date: June 8, 2025, page: RSA_SIGN(3). bye bestie πŸ’–πŸ§š

πŸ“¦ where this page comes from