SSL_SESSION_GET0_PEER(3SSL)

πŸ’– SSL_SESSION_get0_peer β€” the 3SSL manual, bestie edition πŸ’–

okay so you're in the 3SSL section of the OpenSSL manuals, and this one is genuinely so short and so sweet. it's giving "small function, big main character energy" ✨


🌸 NAME 🌸

SSL_SESSION_get0_peer β€” get details about peer's certificate for a session 🫢

like. that's the whole gig. you hand it a session, it hands you the cert.


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <openssl/ssl.h>

X509 *SSL_SESSION_get0_peer(SSL_SESSION *s);

no cap, that's it. one include, one function, one line πŸ’…


πŸŽ€ DESCRIPTION πŸŽ€

okay so SSL_SESSION_get0_peer() returns the peer certificate that's associated with the session s β€” or NULL if there is no peer certificate available. that's the whole vibe check.

the s is your SSL_SESSION *, and the thing it gives back is an X509 *. iconic.

πŸ’€ IMPORTANT ONE, DO NOT SKIP: the caller should not free the returned value. like, do not X509_free() it, bestie, that's not yours. the only exception is if X509_up_ref(3) has also been called β€” then you've bumped the ref count and now you're a co-owner and you can free your share. otherwise: hands off, no touching, look but don't free πŸ™ˆ

⭐ RETURN VALUES ⭐

  • SSL_SESSION_get0_peer() returns a pointer to the peer certificate πŸŽ€
  • or NULL if no peer certificate is available 😭

that's the whole range. two outcomes. perfection.


🌈 SEE ALSO 🌈

go read that one too, it's the gateway drug, fr fr 🧚


Copyright 2017 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>.


and that's the page, bestie!! slay, periodt, ate and left no crumbs πŸ’…βœ¨

this lil gem is from OpenSSL 4.0.3, dated 2026-09-29, and it lives under the name SSL_SESSION_GET0_PEER(3SSL). take care of her πŸ«ΆπŸŽ€πŸ¦‹

πŸ“¦ where this page comes from