---
name: "libressl-X509_digest"
section: "3"
platform: "linux"
package: "libressl"
version: "4.4.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/libressl-X509_digest"
---

# libressl-X509\_digest(3)

get digests of various objects

## NAME

**X509\_digest**, **X509\_CRL\_digest**, **X509\_pubkey\_digest**, **X509\_NAME\_digest**, **X509\_REQ\_digest**, **PKCS7\_ISSUER\_AND\_SERIAL\_digest** – get digests of various objects

## SYNOPSIS

Crypto Library (libcrypto, -lcrypto)

**#include \<openssl/x509.h\>**

*int*\

**X509\_digest**(*const X509 \*data*, *const EVP\_MD \*type*, *unsigned char \*md*, *unsigned int \*len*);

*int*\

**X509\_CRL\_digest**(*const X509\_CRL \*data*, *const EVP\_MD \*type*, *unsigned char \*md*, *unsigned int \*len*);

*int*\

**X509\_pubkey\_digest**(*const X509 \*data*, *const EVP\_MD \*type*, *unsigned char \*md*, *unsigned int \*len*);

*int*\

**X509\_REQ\_digest**(*const X509\_REQ \*data*, *const EVP\_MD \*type*, *unsigned char \*md*, *unsigned int \*len*);

*int*\

**X509\_NAME\_digest**(*const X509\_NAME \*data*, *const EVP\_MD \*type*, *unsigned char \*md*, *unsigned int \*len*);

**#include \<openssl/pkcs7.h\>**

*int*\

**PKCS7\_ISSUER\_AND\_SERIAL\_digest**(*PKCS7\_ISSUER\_AND\_SERIAL \*data*, *const EVP\_MD \*type*, *unsigned char \*md*, *unsigned int \*len*);

## DESCRIPTION

**X509\_pubkey\_digest**() returns a digest of the DER representation of the public key contained in *data*. All other functions described here return a digest of the DER representation of their entire *data* object.

The *type* parameter specifies the digest to be used, such as EVP\_sha1(3). *md* is a pointer to the buffer where the digest will be copied and is assumed to be large enough; a size of at least EVP\_MAX\_MD\_SIZE bytes is suggested. The *len* parameter, if not NULL, points to a place where the digest size will be stored.

## RETURN VALUES

These functions return 1 for success or 0 for failure.

## SEE ALSO

EVP\_get\_digestbyname(3), X509\_cmp(3), X509\_CRL\_new(3), X509\_NAME\_new(3), X509\_new(3), X509\_REQ\_new(3)

## HISTORY

**X509\_digest**(), **X509\_NAME\_digest**(), and **PKCS7\_ISSUER\_AND\_SERIAL\_digest**() first appeared in SSLeay 0.6.5 and have been available since OpenBSD 2.4.

**X509\_CRL\_digest**() and **X509\_REQ\_digest**() first appeared in OpenSSL 0.9.6 and have been available since OpenBSD 2.9.

**X509\_pubkey\_digest**() first appeared in OpenSSL 0.9.7 and has been available since OpenBSD 3.2.
