ASN1_ITEM_VERIFY(3)
π ASN1_ITEM_VERIFY(3) β signature verification for ASN.1 values
okay so bestie, you know how a signature is like a little wax seal that proves something is really from who it says it's from? this page is about the function that does the seal-checking for ASN.1 values, and it's giving very much "trust but verify" energy β¨
π SYNOPSIS π
it lives in library βlibcryptoβ and you gotta pull in the header first, no skipping:
#include <openssl/x509.h>
and here's the whole signature (yes, a function about signatures, iconic):
int
ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *algor1,
ASN1_BIT_STRING *sig_in, void *val_in, EVP_PKEY *pkey);
π¦ DESCRIPTION π¦
okay so ASN1_item_verify() is literally out here trusting you on one (1) thing: that val_in is an ASN1_VALUE of the type that it says it is. no vibe check on that, it just assumes. π«Ά
from there it does the whole routine:
- it encodes that value into DER format by calling
ASN1_item_i2d(3) - then it verifies, in a way similar to
EVP_DigestVerify(3), thatsig_incontains a valid signature of the resulting byte array
and whose signature is it checking for, you ask? a signature that was created with:
- the signature algorithm
algor1, and - the private key corresponding to the public key
pkey
so like, algor1 is the "how", pkey is the "who", and sig_in is the "proof". match made in heaven if everything lines up π
πΈ RETURN VALUES πΈ
the numbers here are doing a lot, so pay attention bestie:
1β signature verification succeeds. slay! π0β signature verification fails. not slay. π-1β something was wrong with the inputs, specifically if:pkeyisNULLsig_incontains invalid flags- or
algor1requests an invalid or unsupported digest algorithm, or doesn't work with the givenpkey
so like,0means "the signature is bad" and-1means "girl, the arguments are bad". different problems, don't mix them up π
π₯ SEE ALSO π₯
your reading list, go off:
ASN1_BIT_STRING_new(3)ASN1_item_i2d(3)ASN1_item_sign(3)EVP_DigestVerify(3)EVP_PKEY_new(3)OBJ_find_sigid_algs(3)X509_ALGOR_new(3)
π HISTORY π
ASN1_item_verify() first appeared in OpenSSL 0.9.7 and has been available since OpenBSD 3.1. elder icon behavior, honestly β
and that's the whole page, bestie! this served Debian, June 8, 2025, Library Functions Manual, ASN1_ITEM_VERIFY(3) β go verify something responsibly π§π
π¦ 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