RSA_SIGN_ASN1_OCTET_STRING(3SSL)

πŸ’– RSA_SIGN_ASN1_OCTET_STRING πŸ’–

okay bestie, so this is a page from the OpenSSL manual β€” specifically the 3SSL section β€” and it's all about RSA_sign_ASN1_OCTET_STRING and RSA_verify_ASN1_OCTET_STRING. short version? they're RSA signatures. long version? sit down, we have lore. πŸŽ€

Before we go any further though: literally every function on this page is deprecated, and I'm not being dramatic for once. πŸ’€


✨ NAME ✨

RSA_sign_ASN1_OCTET_STRING, RSA_verify_ASN1_OCTET_STRING β€” RSA signatures, bb. that's the whole vibe. πŸ¦‹


🌸 SYNOPSIS 🌸

okay so first you gotta include the header:

#include <openssl/rsa.h>

and here's the part where I need you to breathe. The following functions have been deprecated since OpenSSL 3.0, and you can hide them entirely by defining OPENSSL_API_COMPAT with a suitable version value β€” go peek at openssl_user_macros(7) if you wanna know which value counts as "suitable". πŸ‘‘

int RSA_sign_ASN1_OCTET_STRING(int dummy, unsigned char *m,
                               unsigned int m_len, unsigned char *sigret,
                               unsigned int *siglen, RSA *rsa);

int RSA_verify_ASN1_OCTET_STRING(int dummy, 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. Applications should instead use EVP PKEY APIs. like, that's the assignment, bestie. πŸ’–

RSA_sign_ASN1_OCTET_STRING() signs the octet string m of size m_len using the private key rsa represented in DER, using PKCS #1 padding. It stores the signature in sigret and the signature size in siglen. and here's the thing β€” sigret must point to RSA_size(rsa) bytes of memory. not "roughly", not "like, around that much". exactly that. don't play with it. πŸ™ˆ

dummy is ignored. it's giving decorative. it's giving set dressing. it's there, that's all. ✨

okay and here's the caveat that actually matters: the random number generator must be seeded when you call RSA_sign_ASN1_OCTET_STRING(). If the automatic seeding or reseeding of the OpenSSL CSPRNG fails due to external circumstances (see RAND(7)), the operation will fail. no notes, that's just how it is. 😭

RSA_verify_ASN1_OCTET_STRING() verifies that the signature sigbuf of size siglen is the DER representation of a given octet string m of size m_len. dummy is ignored β€” yes, again, iconic behaviour honestly. and rsa here is the signer's public key. 🫢


πŸ‘‘ RETURN VALUES πŸ‘‘

  • RSA_sign_ASN1_OCTET_STRING() returns 1 on success, 0 otherwise.
  • RSA_verify_ASN1_OCTET_STRING() returns 1 on successful verification, 0 otherwise.

and where do the error codes come from, I hear you ask? ERR_get_error(3), that's where. go get 'em. πŸ”


πŸ’€ BUGS πŸ’€

These functions serve no recognizable purpose.

that's it. that's the bug report. the OpenSSL devs really said "no purpose, no cap" and moved on. I'm obsessed with the honesty ngl. πŸ’€βœ¨


🌈 SEE ALSO 🌈

ERR_get_error(3), RAND_bytes(3), RSA_sign(3), RSA_verify(3), RAND(7)

go read those instead, fr fr. iykyk. 🧚


⭐ HISTORY ⭐

All of these functions were deprecated in OpenSSL 3.0. periodt. πŸŽ€


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


okay and that's the whole page!! 🫢 this was OpenSSL 4.0.3, dated 2026-09-29 β€” and like, if you're actually about to call these functions... bestie, don't, they're deprecated and they serve no recognizable purpose. go use the EVP PKEY APIs instead. love u, bye!! πŸ’–πŸŒΈβœ¨

πŸ“¦ where this page comes from