X509_VERIFY(3)
πΈ NAME πΈ
This is the X509_VERIFY(3) library functions manual page, bestie π. The whole function squad is x509_verify, x509_verify_ctx_new, x509_verify_ctx_free, x509_verify_ctx_set_max_depth, x509_verify_ctx_set_max_signatures, x509_verify_ctx_set_max_chains, x509_verify_ctx_set_purpose, x509_verify_ctx_set_intermediates, x509_verify_ctx_error_string, x509_verify_ctx_error_depth, and x509_verify_ctx_chain β and their whole mission is to discover and verify X.509 certificate chains. Slay β¨.
β¨ SYNOPSIS β¨
#include <openssl/x509_verify.h>
size_t
x509_verify(X509_VERIFY_CTX *ctx, X509 *leaf, char *name);
X509_VERIFY_CTX *
x509_verify_ctx_new(STACK_OF(X509) *roots);
void
x509_verify_ctx_free(X509_VERIFY_CTX *ctx);
int
x509_verify_ctx_set_max_depth(X509_VERIFY_CTX *ctx, size_t max);
int
x509_verify_ctx_set_max_signatures(X509_VERIFY_CTX *ctx, size_t max);
int
x509_verify_ctx_set_max_chains(X509_VERIFY_CTX *ctx, size_t max);
int
x509_verify_ctx_set_purpose(X509_VERIFY_CTX *ctx, int purpose_id);
int
x509_verify_ctx_set_intermediates(X509_VERIFY_CTX *ctx,
STACK_OF(X509) *intermediates);
const char *
x509_verify_ctx_error_string(X509_VERIFY_CTX *ctx);
size_t
x509_verify_ctx_error_depth(X509_VERIFY_CTX *ctx);
STACK_OF(X509) *
x509_verify_ctx_chain(X509_VERIFY_CTX *ctx, size_t index);
π DESCRIPTION π
okay so x509_verify() is literally the main character here: it attempts to discover and validate all certificate chains for the name from the leaf certificate based on the parameters in ctx. Multiple chains may be built and validated β itβs giving overachiever energy π₯.
Important caveat, no cap: revocation checking is not done by this function, and should be performed by the caller on any returned chains if so desired. iykyk π.
x509_verify_ctx_new()β allocates a new context using the trustedroots. In case of success, it increments the reference count ofroots. π«Άx509_verify_ctx_free()β freesctxand decrements the reference count of therootsandintermediatesassociated with it. IfctxisNULL, no action occurs. πx509_verify_ctx_set_max_depth()β sets the maximum depth of certificate chains that will be constructed tomax, which can be in the range from1to the default of32. π±x509_verify_ctx_set_max_signatures()β sets the maximum number of public key signature operations that will be used when verifying certificate chains tomax, which can be in the range from1to100000. The default is256. β¨x509_verify_ctx_set_max_chains()β sets the maximum number of chains which may be returned tomax, which can be in the range from1to the default of8. πx509_verify_ctx_set_purpose()β sets the certificate purpose for validation topurpose_id. TheX509_PURPOSE_*constants listed inX509_check_purpose(3)can be used. πx509_verify_ctx_set_intermediates()β provides some intermediate certificates, typically received from the peer, to be used for building chains. In case of success, this function increases the reference count ofintermediates. π¦x509_verify_ctx_error_string()β extracts a description of the last error encountered by a previous call tox509_verify()fromctx. πx509_verify_ctx_error_depth()β extracts the depth of the last error encountered by a previous call tox509_verify()fromctx. πx509_verify_ctx_chain()β extracts the validated chain with the givenindexfromctxafter a previous call tox509_verify(). Theindexstarts at0, and it is an error to pass a number greater than or equal to the return value ofx509_verify(). The returned chain is neither copied, nor is its reference count increased. π§
π¦ RETURN VALUES π¦
x509_verify()returns the number of chains successfully built and validated or0on failure. πx509_verify_ctx_new()returns a newly allocated context orNULLon failure. πΈx509_verify_ctx_set_max_depth(),x509_verify_ctx_set_max_signatures(),x509_verify_ctx_set_max_chains(),x509_verify_ctx_set_purpose(), andx509_verify_ctx_set_intermediates()return1on success or0on failure. βx509_verify_ctx_error_string()returns a pointer to a human readable error string. If no error occurred,"ok"is returned. π«Άx509_verify_ctx_chain()returns an internal pointer to a validated chain orNULLifindexis greater than or equal to the number of chains that were successfully built and validated. The returned pointer becomes invalid whenctxis destroyed. β
π SEE ALSO π
X509_verify_cert(3) π
π HISTORY π
These functions first appeared in OpenBSD 6.8. π
π AUTHORS π
Bob Beck <beck@openbsd.org> π
π
cute little sign-off bestie: this X509_VERIFY(3) page is from Debian, dated September 14, 2020. go verify those chains and slay β¨π«Ά
π¦ where this page comes from
- opensuse-leap 16.0: libressl-devel-doc 4.1.0-bp160.1.1 Β· OpenSSL
- Copyright (c) 2020 Bob Beck <beck@openbsd.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms