ASN1_ITEM_DIGEST(3)
πΈ ASN1_ITEM_DIGEST(3) πΈ
okay bestie, welcome to the Library Functions Manual page for ASN1_ITEM_DIGEST(3) β yes, all caps, iconic, we move π
β¨ NAME β¨
ASN1_item_digest β DER-encode and hash an ASN.1 value. That's the whole mission, no cap: DER-encode it, hash it, done π«Ά
π SYNOPSIS π
here's the signature, copied exactly because we do not mess with code, periodt:
#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 π
okay so ASN1_item_digest() assumes that val_in is an ASN1_VALUE of the type specified by it. Then it encodes that value into DER format by calling ASN1_item_i2d(3), hashes the resulting byte array using the digest type by calling EVP_Digest(3), and places the digest value into *md. Unless s is NULL, it also places the length in bytes of the digest into *s.
Providing a buffer *md large enough to contain the digest is your responsibility, bestie β the caller's job, not a vibe we can skip. Providing a buffer of EVP_MAX_MD_SIZE bytes is recommended. That's lowkey the buffer glow-up, slay π§
π RETURN VALUES π
ASN1_item_digest() returns 1 for success or 0 if encoding or hashing fails. That's it β no secret third option, vibe check passed, iykyk π
π¦ SEE ALSO π¦
go read these too, bestie, they're in the group chat π
β HISTORY β
ASN1_item_digest() first appeared in OpenSSL 0.9.7 and has been available since OpenBSD 3.1. history lesson served fresh π
okay that's the page! source/version: Debian; date: September 11, 2022 β mwah, stay hydrated and hash responsibly π
π¦ where this page comes from
- opensuse-leap 16.0: libressl-devel-doc 4.1.0-bp160.1.1 Β· 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