SSL_GET_VERIFY_RESULT(3)
π SSL_GET_VERIFY_RESULT(3) β the manual page, but make it make sense
okay bestie, so this one's from the libssl / libcrypto corner of the world (yes, that libssl, the one you already have a complicated relationship with π«Ά). It lives in SSL_GET_VERIFY_RESULT(3) land, and honestly it's a tiny little page that does one tiny little thing, but the way it does it is highkey a trap if you don't read the fine print. Let's get into it β¨
π NAME π
SSL_get_verify_result β get the result of peer certificate verification. that's it. that's the whole job. it tells you what went down when the other side's cert got checked π
πΈ SYNOPSIS πΈ
library βlibsslβ libcrypto
#include <openssl/ssl.h>
long
SSL_get_verify_result(const SSL *ssl);
like, you pull in the header, you hand it a pointer to your SSL (const, it's not gonna touch it, it's a good polite function π), and it hands you back a long. that long is the whole tea. read on π
π¦ DESCRIPTION π¦
So SSL_get_verify_result() returns the result of verifying the X509 certificate that the peer presented β if any. that "if any" is doing a LOT of heavy lifting, bestie, we'll get to that in BUGS. π
Here's the thing that gets people: SSL_get_verify_result() can only ever hand you back one error code, but certificate verification can fail for like, a million reasons at the same time π. So which one do you get? Only the last verification error that occurred during processing. that's the one that survives. the rest? gone. ghosts. π»
And because the verification result is part of the established session, it gets restored when a session is reused β so it follows you around, it's loyal like that. β¨
π§ RETURN VALUES π§
here's the whole menu of what you can get back:
X509_V_OKβ the verification succeeded, or no peer certificate was presented. yes, both. we'll talk. π- Any other value β those are documented over in
openssl(1), go look there, I'm not your search engine (affectionate) π
π SEE ALSO π
the whole friend group, go say hi:
openssl(1), ssl(3), SSL_CTX_set_verify(3), SSL_get0_peername(3), SSL_get_peer_certificate(3), SSL_set_verify_result(3)
π HISTORY π
SSL_get_verify_result() first appeared way back in SSLeay 0.6.1, and it's been available since OpenBSD 2.4. like, this function is vintage. it's been serving looks since before you were born. iconic behavior, no cap. β
π BUGS π
okay so here's the part where you need to be seated, bestie:
If no peer certificate was presented, the returned result code is X509_V_OK.
read that again. π No cert = no verification error occurred = X509_V_OK. But β and this is the entire point β that does not indicate success. It's giving "everything's fine" energy while absolutely nothing is fine. π«
Which is why SSL_get_verify_result() is only useful in connection with SSL_get_peer_certificate(3). Check whether a peer cert even exists first, then trust this result. Do not skip that step. Do not pass go. Do not collect $200. π
that's the page!! π courtesy of the Debian build, dated June 8, 2025 β mwah, go verify some certs responsibly, and remember: X509_V_OK is not always the slay you think it is β¨π
π¦ 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) 2000, 2001, 2005 The OpenSSL Project. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms