---
name: "X509_get0_signature"
section: "3ssl"
platform: "linux"
package: "openssl"
version: "3.6.5-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/X509_get0_signature"
---

# X509\_get0\_signature(3ssl)

signature information

## NAME

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\_CRL\_get0\_tbs\_sigalg, X509\_get\_signature\_info, X509\_SIG\_INFO\_get, X509\_SIG\_INFO\_set, X509\_ACERT\_get0\_signature, X509\_ACERT\_get0\_info\_sigalg, X509\_ACERT\_get\_signature\_nid - 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);
 const X509_ALGOR *X509_CRL_get0_tbs_sigalg(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
```

**X509\_get0\_signature()** sets **\*psig** to the signature of **x** and **\*palg** to the signature algorithm of **x**. The values returned are internal pointers which **MUST NOT** be freed up after the call.

**X509\_set0\_signature()** and **X509\_REQ\_set1\_signature\_algo()** are the equivalent setters for the two values of **X509\_get0\_signature()**.

**X509\_get0\_tbs\_sigalg()** and **X509\_CRL\_get0\_tbs\_sigalg()** return the signature algorithm in the signed portion of the certificate or CRL.

**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\_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.

**X509\_ACERT\_get0\_signature()**, **X509\_ACERT\_get\_signature\_nid()** and **X509\_ACERT\_get0\_info\_sigalg()** perform the same function for attribute certificates.

## NOTES

These functions provide lower level access to signatures in certificates where 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).

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.

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

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

The **X509\_get0\_signature()** and **X509\_get\_signature\_nid()** functions were added in OpenSSL 1.0.2.

The **X509\_REQ\_get0\_signature()**, **X509\_REQ\_get\_signature\_nid()**, **X509\_CRL\_get0\_signature()** and **X509\_CRL\_get\_signature\_nid()** were added in OpenSSL 1.1.0.

The **X509\_REQ\_set0\_signature()** and **X509\_REQ\_set1\_signature\_algo()** were added in OpenSSL 1.1.1e.

The **X509\_ACERT\_get0\_signature()**, **X509\_ACERT\_get0\_info\_sigalg()** and **X509\_ACERT\_get\_signature\_nid()** functions were added in OpenSSL 3.4.

The **X509\_CRL\_get0\_tbs\_sigalg()** function was added in OpenSSL 3.6.

## COPYRIGHT

Copyright 2015-2025 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\>.
