X509_GET0_SIGNATURE(3ossl)
β¨ NAME β¨
okay bestie, welcome to the X509_GET0_SIGNATURE(3ossl) page from OpenSSL π this whole squad is here for signature information:
X509_get0_signatureX509_REQ_set0_signatureX509_REQ_set1_signature_algoX509_get_signature_nidX509_get0_tbs_sigalgX509_REQ_get0_signatureX509_REQ_get_signature_nidX509_CRL_get0_signatureX509_CRL_get_signature_nidX509_ACERT_get0_signatureX509_ACERT_get0_info_sigalgX509_ACERT_get_signature_nidX509_get_signature_infoX509_SIG_INFO_getX509_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*psigto the signature ofxand*palgto the signature algorithm ofx. 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()andX509_REQ_set1_signature_algo()β the equivalent setters for the two values ofX509_get0_signature(). yes, the page literally saysX509_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 ofx.X509_get_signature_nid()β returns the NID corresponding to the signature algorithm ofx.X509_REQ_get0_signature(),X509_REQ_get_signature_nid(),X509_CRL_get0_signature()andX509_CRL_get_signature_nid()β perform the same function for certificate requests and CRLs.X509_ACERT_get0_signature(),X509_ACERT_get_signature_nid()andX509_ACERT_get0_info_sigalg()β perform the same function for attribute certificates.X509_get_signature_info()β retrieves information about the signature of certificatex. 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 toNULLif the information is not required.X509_SIG_INFO_get()andX509_SIG_INFO_set()β get and set information about a signature in anX509_SIG_INFOstructure. 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()andX509_CRL_get_signature_nid()β return a NID.X509_get0_signature(),X509_REQ_get0_signature()andX509_CRL_get0_signature()β do not return values.X509_get_signature_info()β returns1if the signature information returned is valid, or0if the information is not available (e.g. unknown algorithms or malformed parameters).X509_REQ_set1_signature_algo()β returns0on success; or1on an error (e.g. null ALGO pointer).X509_REQ_set0_signaturedoes not return an error value.
π SEE ALSO π
d2i_X509(3)ERR_get_error(3)X509_CRL_get0_by_serial(3)X509_get_ext_d2i(3)X509_get_extension_flags(3)X509_get_pubkey(3)X509_get_subject_name(3)X509_get_version(3)X509_NAME_add_entry_by_txt(3)X509_NAME_ENTRY_get_object(3)X509_NAME_get_index_by_NID(3)X509_NAME_print_ex(3)X509_new(3)X509_sign(3)X509V3_get_d2i(3)X509_verify_cert(3)
π HISTORY π
X509_get0_signature()andX509_get_signature_nid()β added in OpenSSL1.0.2.X509_REQ_get0_signature(),X509_REQ_get_signature_nid(),X509_CRL_get0_signature()andX509_CRL_get_signature_nid()β added in OpenSSL1.1.0.X509_REQ_set0_signature()andX509_REQ_set1_signature_algo()β added in OpenSSL1.1.1e.X509_ACERT_get0_signature(),X509_ACERT_get0_info_sigalg()andX509_ACERT_get_signature_nid()β added in OpenSSL3.4.
π COPYRIGHT π
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
- 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