RSA_SIGN(3ossl)

πŸ“¦ version 3.5.0, in opensuse-leap 16.0

πŸ’… RSA_SIGN(3ossl) πŸ’…

okay so this is a page from the OpenSSL manual, and bestie, it's giving ✨legacy✨ β€” we're talking RSA_sign and RSA_verify, the OG RSA signature girlies. Buckle up πŸŽ€


🌸 NAME 🌸

RSA_sign, RSA_verify β€” RSA signatures, no cap πŸ”


✨ SYNOPSIS ✨

#include <openssl/rsa.h>

okay so important heads-up first: the following functions have been deprecated since OpenSSL 3.0, and you can make them vanish entirely by defining OPENSSL_API_COMPAT with a suitable version value β€” check openssl_user_macros(7) for how that works 🫢

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. Like, every single one. The glow-up you actually want is EVP_PKEY_sign_init(3), EVP_PKEY_sign(3), EVP_PKEY_verify_init(3) and EVP_PKEY_verify(3) β€” applications should use those instead, fr fr πŸ’―

So, what does the old stuff do?

  • 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. Now listen πŸ‘ sigret must point to RSA_size(rsa) bytes of memory. Also note that PKCS #1 adds meta-data, which places limits on the size of the key that can be used 🫠 For lower-level operations, see RSA_private_encrypt(3).
  • type denotes the message digest algorithm that was used to generate m. And 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() β€” 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, and rsa is the signer's public key πŸ”

πŸ‘‘ RETURN VALUES πŸ‘‘

  • RSA_sign() returns 1 on success and 0 for failure.
  • RSA_verify() returns 1 on successful verification and 0 for failure.

Need the deets on what went wrong? The error codes can be obtained by ERR_get_error(3) πŸ’€


🌈 CONFORMING TO 🌈

SSL, PKCS #1 v2.0 β€” she's certified, she's compliant, she's iconic ✨


πŸ”₯ SEE ALSO πŸ”₯

iykyk, go read those next πŸ“š


πŸ’€ HISTORY πŸ’€

All of these functions were deprecated in OpenSSL 3.0. That's the whole story. RIP to a real one πŸ•―οΈ


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>.


and that's the whole page, bestie 🫢 this was OpenSSL 3.5.0, dated 2026-09-25 β€” RSA_SIGN(3ossl), signing off πŸ’œβœ¨

πŸ“¦ where this page comes from