SSL_SESSION_GET0_PEER(3)

πŸ“¦ version 4.4.0, in alpine 3.24, arch rolling

✨ SSL_SESSION_GET0_PEER ✨

okay so bestie, welcome to libssl / libcrypto β€” the <openssl/ssl.h> era of your life πŸ’… this one's a tiny little function page but it's lowkey important, so let's get into it 🫢


🌸 SYNOPSIS 🌸

#include <openssl/ssl.h>

X509 *
SSL_SESSION_get0_peer(SSL_SESSION *s);

πŸ¦‹ DESCRIPTION πŸ¦‹

SSL_SESSION_get0_peer() hands you back a pointer to the peer certificate that's associated with the session s β€” like, the actual cert of the other side of the conversation πŸ‘‘ and if there's no peer certificate available at all? it just gives you NULL. no drama, no error, just NULL. πŸ’€

🚨 the big rule, bestie: the caller should not free the returned value β€” unless X509_up_ref(3) has also been called. so like, don't go freeing that pointer on your own, that's not your business, that pointer isn't yours to yeet πŸ™ˆ please respect the refcount.

it's giving "look but don't touch" energy fr fr ✨


🌈 SEE ALSO 🌈

go read those too, they're iconic in their own right πŸ’–


πŸŽ€ HISTORY πŸŽ€

SSL_SESSION_get0_peer() first appeared in OpenSSL 1.0.1, and it's been available since OpenBSD 5.3. so she's been serving since forever β€” a true veteran πŸ’…β­


okay that's the whole page, you ate that πŸ“ this was Debian's rendering, dated June 8, 2025 β€” and yes, the page title matches the name up top, no cap πŸ’œ mwah, go forth and check those peer certs responsibly 🧚

πŸ“¦ where this page comes from