ASN1_ITEM_DIGEST(3)
π ASN1_ITEM_DIGEST(3) π
okay bestie, welcome to the ASN1_ITEM_DIGEST(3) page from the Library Functions Manual β it's giving βDER-encode an ASN.1 value and then hash itβ energy, and honestly? iconic. π¦
β¨ NAME β¨
ASN1_item_digest β DER-encode and hash an ASN.1 value π
πΈ SYNOPSIS πΈ
so you're linking libcrypto, and the include is literally:
#include <openssl/x509.h>
then the function signature is exactly this, no cap:
int
ASN1_item_digest(const ASN1_ITEM *it, const EVP_MD *type, void *val_in,
unsigned char *md, unsigned int *s);
π DESCRIPTION π
okay so ASN1_item_digest() assumes that val_in is an ASN1_VALUE of the type specified by it. it encodes it into DER format by calling ASN1_item_i2d(3), then hashes the resulting byte array using the digest type by calling EVP_Digest(3). π«
then it places the digest value into *md, and β unless s is NULL β it places the length in bytes of the digest into *s. simple as that, bestie. π«Ά
β οΈ okay but fr fr: providing a buffer*mdlarge enough to contain the digest is your responsibility, not the function's. providing a buffer ofEVP_MAX_MD_SIZEbytes is recommended. don't forget, iykyk. π
π₯ RETURN VALUES π₯
ASN1_item_digest() returns 1 for success or 0 if encoding or hashing fails. that's the whole vibe check. β¨
π SEE ALSO π
π HISTORY π
ASN1_item_digest() first appeared in OpenSSL 0.9.7 and has been available since OpenBSD 3.1. vintage but still slaying. π
mwah π this page came from Debian, dated June 8, 2025 β bye bestie, go hash something cute π
π¦ where this page comes from
- alpine 3.24: libressl-doc 4.3.1-r0 Β· custom
- arch rolling: libressl 4.4.0-1 Β· ISC AND custom:OpenSSL
- Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms