RSA_SIGN(3ossl)
π RSA_SIGN(3ossl) β aka the RSA signatures page
okay bestie so this is a page from the OpenSSL manual, and it's giving "vintage, but please don't use it" energy. It's all about RSA_sign and RSA_verify, the old-school way to do RSA signatures. Grab a π, sit down, and let's get into it.
β¨ NAME β¨
RSA_sign, RSA_verify β RSA signatures, literally what it says on the tin π
π¦ SYNOPSIS π¦
First thing, you gotta include the header:
#include <openssl/rsa.h>
β οΈ Real talk, bestie: the following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by definingOPENSSL_API_COMPATwith a suitable version value β seeopenssl_user_macros(7)for the deets. So like... they're still here, but they're giving "left on read" energy. π
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 πΈ
All of the functions described on this page are deprecated. Every single one. Not a vibe check they passed, ngl. Applications should instead use EVP_PKEY_sign_init(3), EVP_PKEY_sign(3), EVP_PKEY_verify_init(3) and EVP_PKEY_verify(3) β those are the main characters now, periodt. π
π RSA_sign() β the glow-up
RSA_sign() signs the message digest m of size m_len using the private key rsa, using 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 β like, that's the assignment, don't skimp on it.
Note that PKCS #1 adds meta-data, placing limits on the size of the key that can be used. So the key size has a ceiling, iykyk. For lower-level operations, see RSA_private_encrypt(3).
type denotes the message digest algorithm that was used to generate m. And here's a lil special case for you: if type is NID_md5_sha1, an SSL signature is created β that's MD5 and SHA1 message digests with PKCS #1 padding and no algorithm identifier. π
π RSA_verify() β the dupe check
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()returns1on success and0for failure.RSA_verify()returns1on successful verification and0for failure.
The error codes can be obtained by ERR_get_error(3). Slay, now you can actually debug. π
π CONFORMING TO π
SSL, PKCS #1 v2.0 β she's certified, she's standards-compliant, she's iconic. β¨
π§ SEE ALSO π§
Go read those too, bestie, they're the supporting cast. π
π HISTORY π
All of these functions were deprecated in OpenSSL 3.0. That's the whole history section, no cap. π
π COPYRIGHT π
Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>. π«Ά
aaaand that's the page, bestie! πΈ This was OpenSSL 3.5.6, dated 2026-04-07, and it goes out to you with all the RSA_SIGN(3ossl) love. Now go use the EVP functions instead, fr fr. ππ¦β
π¦ where this page comes from
- freebsd 15.1: base 15.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms