X509_CHECK_PRIVATE_KEY(3)
π NAME π
okay bestie, this is the X509_CHECK_PRIVATE_KEY(3) library functions manual page, and it's about two functions: X509_check_private_key and X509_REQ_check_private_key. Their whole thing is comparing public key components. That's the assignment. That's the vibe. π
β¨ SYNOPSIS β¨
library βlibcryptoβ #include <openssl/x509.h>
int
X509_check_private_key(const X509 *x, const EVP_PKEY *k);
int
X509_REQ_check_private_key(X509_REQ *x, EVP_PKEY *k);
π¦ DESCRIPTION π¦
Real talk: these functions are seriously misnamed. Not me making it up β that's literally what the page says. X509_check_private_key() compares the public key components (e.g. exponent and modulus of an RSA key) and parameters (e.g. EC params of an EC key) of k with the corresponding properties of x. π§
And here's the plot twist: despite the name, it neither checks whether k contains private key components at all, nor, if any are present, whether they are consistent with the public key components. The name is lowkey giving catfish. π
X509_REQ_check_private_key() is equivalent to X509_check_private_key() β except that it compares to the public key contained in a certificate request. Same energy, different object. π
π₯ RETURN VALUES π₯
These functions return 1 if the public key components and parameters match, or 0 if they do not match or if an error occurs. So yeah: 1 = we love to see it, 0 = something's off (or it errored). π
On error or mismatch, a reason code can be obtained using ERR_get_error(3). Go get that context, bestie. π
π SEE ALSO π
π HISTORY π
X509_check_private_key() first appeared in SSLeay 0.6.5 and has been available since OpenBSD 2.4. An icon, honestly. β¨
X509_REQ_check_private_key() first appeared in OpenSSL 0.9.8 and has been available since OpenBSD 4.5. We love a late arrival with main character energy. π«Ά
This page is from Debian, dated June 8, 2025, and its manual name is X509_CHECK_PRIVATE_KEY(3). Byeee β go compare those public key components 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) 2017 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