X509_VERIFY(3SSL)

✨ NAME ✨

okay so this page is about the signature-checking girlies: X509_verify, X509_self_signed, X509_REQ_verify_ex, X509_REQ_verify, X509_CRL_verify, and X509_ACERT_verify β€” they verify certificate, certificate request, or CRL signatures. πŸ’–

They live in the 3SSL manual, which is giving very "the OpenSSL docs bestie" energy, iykyk.


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <openssl/x509.h>

int X509_verify(X509 *x, EVP_PKEY *pkey);
int X509_self_signed(const X509 *cert, int verify_signature);

int X509_REQ_verify_ex(X509_REQ *a, EVP_PKEY *pkey, OSSL_LIB_CTX *libctx,
                       const char *propq);
int X509_REQ_verify(X509_REQ *a, EVP_PKEY *r);
int X509_CRL_verify(X509_CRL *a, EVP_PKEY *r);

#include <openssl/x509_acert.h>
int X509_ACERT_verify(X509_CRL *a, EVP_PKEY *r);

πŸ’– DESCRIPTION πŸ’–

X509_verify() verifies the signature of certificate x using public key pkey. And the way that it does only the signature check?? Nothing else, bestie. No other checks β€” so pls don't come for it about certificate chain validity, because it is literally not doing that. πŸ™ˆ

X509_self_signed() checks whether certificate cert is self-signed. For it to succeed, a whole little checklist has to match: the issuer and subject names must match, the components of the authority key identifier (if present) must match the subject key identifier, etc. The signature itself is actually verified only if verify_signature is 1 β€” because for explicitly trusted certificates, that verification is, and I quote, "not worth the effort". slay, honestly. πŸ’…

X509_REQ_verify_ex(), X509_REQ_verify(), X509_CRL_verify() and X509_ACERT_verify() verify the signatures of certificate requests, CRLs and attribute certificates respectively. 🌸


πŸŽ€ RETURN VALUES πŸŽ€

X509_verify(), X509_REQ_verify_ex(), X509_REQ_verify() and X509_CRL_verify() return 1 if the signature is valid and 0 if the signature check fails.

But if the signature could not be checked at all β€” because it was ill-formed, the certificate or the request was not complete, or some other error occurred β€” then -1 is returned. πŸ’€

X509_self_signed() returns the same values, but it also returns 1 if all respective fields match and verify_signature is 0. 🫢


🌈 SEE ALSO 🌈


⭐ HISTORY ⭐

The X509_verify(), X509_REQ_verify(), and X509_CRL_verify() functions are available in all versions of OpenSSL. ancient icons, fr fr. πŸ‘‘

X509_REQ_verify_ex() and X509_self_signed() were added in OpenSSL 3.0.

X509_ACERT_verify() was added in OpenSSL 3.4.

And X509_self_signed() had its cert parameter modified to be const in OpenSSL 4.0 β€” glow-up era. ✨


Copyright 2015-2026 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.


ngl bestie, that license paragraph means what it means β€” don't skip it, don't remix it, just respect it. πŸŽ€

and that's the whole page!! this was version 4.0.3, dated 2026-09-29, from the X509_VERIFY(3SSL) page. mwah, go verify some signatures responsibly. πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from