gnutls_certificate_get_peers(3)
π gnutls_certificate_get_peers β an API function, bestie π
okay so this is a page from the gnutls manual, and today's main character is gnutls_certificate_get_peers. she's an API function. she's lowkey iconic. let's get into it π¦
β¨ SYNOPSIS β¨
#include <gnutls/gnutls.h>
const gnutls_datum_t * gnutls_certificate_get_peers(gnutls_session_t
session, unsigned int * list_size);
like, yes, that's the whole vibe. one include, one function, two arguments, periodt π
π ARGUMENTS π
gnutls_session_t sessionβ it's a gnutls session. that's it, that's the girl. she's the session you're working with πΈunsigned int * list_sizeβ this is where the length of the certificate list goes. and no cap, this one may beNULL, so if you don't care about the size you can literally just passNULLand move on π
π DESCRIPTION π
okay so what does she actually do. she gets you the peer's raw certificate (chain) β the one the peer sent, exactly as sent. and when we say raw, we mean raw format (that's DER encoded for X.509). it's giving unprocessed, no filter, the original π
so in the case of an X.509, there may be a certificate list present. and here's the tea: the list is provided as sent by the server. the server is supposed to send its own certificate as the first certificate in the list, then the issuer's certificate after it, then the issuer's issuer, etc. β a cute little lineage, very ancestral, very lineage-tracking β¨
but π some servers literally violate this principle, so on certain occasions this may be an unsorted list. so don't come for the ordering, okay? it's not her fault, it's the server's.
and then β this is important β in resumed sessions, this function will return the peer's certificate list as used in the first/original session. so it's not re-asking the peer, it's remembering. nostalgia core fr fr π₯Ή
π RETURNS π
she returns a pointer to a gnutls_datum_t that contains the peer's certificates. or NULL in case of an error, or if no certificate was used. so like, NULL = something went wrong OR there was simply no cert. either way, check before you dereference, bestie, i'm begging π«Ά
π REPORTING BUGS π
found a bug? spill it to <bugs@gnutls.org>.
home page: https://www.gnutls.org
π COPYRIGHT π
Copyright Β© 2001-2023 Free Software Foundation, Inc., and others.
Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved.
(so yes, you can share this around, just keep the receipts, okay? π)
π¦ SEE ALSO π¦
the full documentation for gnutls is maintained as a Texinfo manual. if the /usr/share/doc/gnutls/ directory does not contain the HTML form, go visit:
https://www.gnutls.org/manual/
and that's the whole page, bestie π this was gnutls_certificate_get_peers, part of the gnutls manual, version 3.8.13. go read your peer's certs responsibly, mwah π
β¨
π¦ where this page comes from
- alpine 3.22: gnutls-doc 3.8.13-r0 Β· LGPL-2.1-or-later
- alpine 3.23: gnutls-doc 3.8.13-r0 Β· LGPL-2.1-or-later
- alpine 3.24: gnutls-doc 3.8.13-r0 Β· LGPL-2.1-or-later
- arch rolling: gnutls 3.8.13-3 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- fedora 43: gnutls-devel 3.8.13-1.fc43 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- fedora 43: gnutls-devel 3.8.13-1.fc43 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- fedora 44: gnutls-devel 3.8.13-1.fc44 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- fedora 44: gnutls-devel 3.8.13-1.fc44 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- ubuntu stonking: gnutls-doc 3.8.13-1ubuntu1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms