---
name: "libressl-ASN1_item_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-ASN1_item_digest"
---

# libressl-ASN1\_item\_digest(3)

DER-encode and hash an ASN.1 value

## NAME

**ASN1\_item\_digest** – DER-encode and hash an ASN.1 value

## SYNOPSIS

Crypto Library (libcrypto, -lcrypto)

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

*int*\

**ASN1\_item\_digest**(*const ASN1\_ITEM \*it*, *const EVP\_MD \*type*, *void \*val\_in*, *unsigned char \*md*, *unsigned int \*s*);

## DESCRIPTION

**ASN1\_item\_digest**() assumes that *val\_in* is an *ASN1\_VALUE* of the type specified by *it*, encodes it into DER format by calling ASN1\_item\_i2d(3), hashes the resulting byte array using the digest *type* by calling EVP\_Digest(3), places the digest value into \**md*, and, unless *s* is NULL, places the length in bytes of the digest into \**s*. Providing a buffer \**md* large enough to contain the digest is the responsibility of the caller; providing a buffer of EVP\_MAX\_MD\_SIZE bytes is recommended.

## RETURN VALUES

**ASN1\_item\_digest**() returns 1 for success or 0 if encoding or hashing fails.

## SEE ALSO

ASN1\_item\_i2d(3), ASN1\_item\_sign(3), EVP\_Digest(3)

## HISTORY

**ASN1\_item\_digest**() first appeared in OpenSSL 0.9.7 and has been available since OpenBSD 3.1.
