X509_GET0_SIGNATURE(3ossl)

πŸ“¦
version 15.1 Β· 2 versions
, in freebsd 15.1

✨ NAME ✨

okay bestie, welcome to the X509_GET0_SIGNATURE(3ossl) page from OpenSSL πŸ’– this whole squad is here for signature information:

  • X509_get0_signature
  • X509_REQ_set0_signature
  • X509_REQ_set1_signature_algo
  • X509_get_signature_nid
  • X509_get0_tbs_sigalg
  • X509_REQ_get0_signature
  • X509_REQ_get_signature_nid
  • X509_CRL_get0_signature
  • X509_CRL_get_signature_nid
  • X509_ACERT_get0_signature
  • X509_ACERT_get0_info_sigalg
  • X509_ACERT_get_signature_nid
  • X509_get_signature_info
  • X509_SIG_INFO_get
  • X509_SIG_INFO_set
  • signature information

πŸ¦‹ SYNOPSIS πŸ¦‹

        #include <openssl/x509.h>

        void X509_get0_signature(const ASN1_BIT_STRING **psig,
                                 const X509_ALGOR **palg,
                                 const X509 *x);
        void X509_REQ_set0_signature(X509_REQ *req, ASN1_BIT_STRING *psig);
        int X509_REQ_set1_signature_algo(X509_REQ *req, X509_ALGOR *palg);
        int X509_get_signature_nid(const X509 *x);
        const X509_ALGOR *X509_get0_tbs_sigalg(const X509 *x);

        void X509_REQ_get0_signature(const X509_REQ *crl,
                                     const ASN1_BIT_STRING **psig,
                                     const X509_ALGOR **palg);
        int X509_REQ_get_signature_nid(const X509_REQ *crl);

        const X509_ALGOR *X509_ACERT_get0_info_sigalg(const X509_ACERT *x);

        void X509_CRL_get0_signature(const X509_CRL *crl,
                                     const ASN1_BIT_STRING **psig,
                                     const X509_ALGOR **palg);
        int X509_CRL_get_signature_nid(const X509_CRL *crl);

        int X509_get_signature_info(X509 *x, int *mdnid, int *pknid, int *secbits,
                                    uint32_t *flags);

        int X509_SIG_INFO_get(const X509_SIG_INFO *siginf, int *mdnid, int *pknid,
                             int *secbits, uint32_t *flags);
        void X509_SIG_INFO_set(X509_SIG_INFO *siginf, int mdnid, int pknid,
                               int secbits, uint32_t flags);

        #include <openssl/x509_acert.h>

        void X509_ACERT_get0_signature(const X509_ACERT *x,
                                       const ASN1_BIT_STRING **psig,
                                       const X509_ALGOR **palg);
        int X509_ACERT_get_signature_nid(const X509_ACERT *x);
       =head1 DESCRIPTION

and yes, that stray =head1 DESCRIPTION line is literally in the synopsis β€” not me, bestie πŸ’…


🌸 DESCRIPTION 🌸

  • X509_get0_signature() β€” sets *psig to the signature of x and *palg to the signature algorithm of x. the values it hands back are internal pointers, so MUST NOT free them after the call.
⚠️ bestie, this is the important part: those returned pointers are internal. MUST NOT be freed after the call. periodt. πŸ’€
  • X509_set0_signature() and X509_REQ_set1_signature_algo() β€” the equivalent setters for the two values of X509_get0_signature(). yes, the page literally says X509_set0_signature() here; we are not fixing it, we are reporting the vibe πŸ’…
  • X509_get0_tbs_sigalg() β€” returns the signature algorithm in the signed portion of x.
  • X509_get_signature_nid() β€” returns the NID corresponding to the signature algorithm of x.
  • X509_REQ_get0_signature(), X509_REQ_get_signature_nid(), X509_CRL_get0_signature() and X509_CRL_get_signature_nid() β€” perform the same function for certificate requests and CRLs.
  • X509_ACERT_get0_signature(), X509_ACERT_get_signature_nid() and X509_ACERT_get0_info_sigalg() β€” perform the same function for attribute certificates.
  • X509_get_signature_info() β€” retrieves information about the signature of certificate x. the NID of the signing digest is written to *mdnid, the public key algorithm to *pknid, the effective security bits to *secbits, and flag details to *flags. any of the parameters can be set to NULL if the information is not required.
  • X509_SIG_INFO_get() and X509_SIG_INFO_set() β€” get and set information about a signature in an X509_SIG_INFO structure. they are only used by implementations of algorithms which need to set custom signature information: most applications will never need to call them. lowkey niche, highkey iconic πŸŽ€

🧚 NOTES 🧚

these functions provide lower level access to signatures in certificates, for when an application wishes to analyse or generate a signature in a form where X509_sign() et al is not appropriate β€” for example a non standard or unsupported format. it's giving "I know what I'm doing" energy, fr fr.

the security bits returned by X509_get_signature_info() refers to information available from the certificate signature, such as the signing digest. in some cases the actual security of the signature is less because the signing key is less secure: for example a certificate signed using SHA-512 and a 1024 bit RSA key. so like… the vibes say SHA-512 but the key is not serving what the digest is serving, okay? πŸ™ˆ


🫢 RETURN VALUES 🫢

  • X509_get_signature_nid(), X509_REQ_get_signature_nid() and X509_CRL_get_signature_nid() β€” return a NID.
  • X509_get0_signature(), X509_REQ_get0_signature() and X509_CRL_get0_signature() β€” do not return values.
  • X509_get_signature_info() β€” returns 1 if the signature information returned is valid, or 0 if the information is not available (e.g. unknown algorithms or malformed parameters).
  • X509_REQ_set1_signature_algo() β€” returns 0 on success; or 1 on an error (e.g. null ALGO pointer). X509_REQ_set0_signature does not return an error value.

πŸ’œ SEE ALSO πŸ’œ


πŸ‘‘ HISTORY πŸ‘‘

  • X509_get0_signature() and X509_get_signature_nid() β€” added in OpenSSL 1.0.2.
  • X509_REQ_get0_signature(), X509_REQ_get_signature_nid(), X509_CRL_get0_signature() and X509_CRL_get_signature_nid() β€” added in OpenSSL 1.1.0.
  • X509_REQ_set0_signature() and X509_REQ_set1_signature_algo() β€” added in OpenSSL 1.1.1e.
  • X509_ACERT_get0_signature(), X509_ACERT_get0_info_sigalg() and X509_ACERT_get_signature_nid() β€” added in OpenSSL 3.4.

Copyright 2015-2024 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 that's the whole page, bestie πŸ’– this iconic X509_GET0_SIGNATURE(3ossl) manual is from OpenSSL 3.5.6, dated 2026-04-07 β€” slay, no cap. πŸŽ€

πŸ“¦ where this page comes from