RSA_SIGN(3SSL)
π RSA_SIGN(3SSL) β bestie's guide to RSA signatures π
okay so likeβ¦ this is the RSA_SIGN page from the OpenSSL manuals, and babes, I'm gonna be so real with you: everything here is lowkey deprecated π but we're still gonna learn it because sometimes you gotta read the old lore to understand the new lore. iykyk. π
π¦ NAME π¦
RSA_sign, RSA_verify β RSA signatures β¨
πΈ SYNOPSIS πΈ
#include <openssl/rsa.h>
The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value β peep openssl_user_macros(7) for the tea:
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 π
fr fr, every single function on this page is deprecated. no cap. if you're out here building something new, bestie, the apps of your dreams should be using EVP_PKEY_sign_init(3), EVP_PKEY_sign(3), EVP_PKEY_verify_init(3) and EVP_PKEY_verify(3) instead. those are the it-girls now. π
so what does RSA_sign() actually do? it takes the message digest m of size m_len, and signs it using the private key rsa, following RSASSA-PKCS1-v1_5 exactly as specified in RFC 3447. slay. β¨ it drops the signature into sigret and the signature size into siglen. and here's the thing you literally cannot forget: sigret must point to RSA_size(rsa) bytes of memory. periodt. also note that PKCS #1 adds meta-data, which places limits on the size of the key that can be used π β so don't come crying when your key is too tiny. for lower-level operations, go peek at RSA_private_encrypt(3).
type is the whole vibe-setter here β it denotes the message digest algorithm that was used to generate m. π§ and if type is NID_md5_sha1, then an SSL signature gets created, which is MD5 and SHA1 message digests with PKCS #1 padding and no algorithm identifier. iconic ancient behaviour, honestly.
now RSA_verify() is the vibe checker π΅οΈββοΈ β it 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 actual error codes? you can grab them with ERR_get_error(3). π
π CONFORMING TO π
SSL, PKCS #1 v2.0 π
π SEE ALSO π
π HISTORY π
all of these functions were deprecated in OpenSSL 3.0. the way that time flies π
β 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>.
and that's the whole page, bestie!! π«Ά this was version 4.0.3, dated 2026-09-29, brought to you by the OpenSSL girlies. go forth and use the EVP functions instead, mwah πβ¨
π¦ where this page comes from
- ubuntu stonking: libssl-doc 4.0.3-1ubuntu1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms