gnutls_certificate_type_get2(3)

✨ gnutls_certificate_type_get2 ✨

okay bestie, welcome to the gnutls manual page for gnutls_certificate_type_get2(3) β€” yes it's a whole function and yes it's iconic πŸ’… let's get into it


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <gnutls/gnutls.h>

gnutls_certificate_type_t gnutls_certificate_type_get2(gnutls_session_t
session, gnutls_ctype_target_t target);

like. look at her. she's serving signature πŸŽ€


🌸 ARGUMENTS 🌸

  • gnutls_session_t session β€” bestie this is a gnutls_session_t type. that's the whole vibe. it's your session 🫢
  • gnutls_ctype_target_t target β€” and this one is a gnutls_ctype_target_t type. mhm. exactly what it says on the tin ✨

πŸ’– DESCRIPTION πŸ’–

so what does she do. she returns the type of certificate that a side is negotiated to use. periodt πŸ’…

by default the certificate type is X.509 β€” that's the default, no cap β€” unless an alternative certificate type got enabled by gnutls_init() and then negotiated during the session. so like, only if someone actually turned that on 🌈

now the target parameter? she's the one who decides whose negotiated certificate type you're asking about:

  • GNUTLS_CTYPE_CLIENT β€” gimme the negotiated cert type for the client πŸ’™
  • GNUTLS_CTYPE_SERVER β€” gimme the negotiated cert type for the server πŸ’œ

and then, plot twist, in P2P mode connection setups where you genuinely don't know in advance who's gonna be the client and who's gonna be the server (main character chaos energy honestly 😭), you can use these flags instead:

  • GNUTLS_CTYPE_OURS β€” retrieves the corresponding cert type for us πŸ‘‘
  • GNUTLS_CTYPE_PEERS β€” retrieves the corresponding cert type for our peers 🧚

also important bestie: resumed sessions will return the certificate type that was negotiated and used in the original session. the original one. not a new one. so that means this function can be used to reliably determine the type of the certificate returned by gnutls_certificate_get_peers(). slay πŸ”₯ that's genuinely useful, fr fr.


⭐ RETURNS ⭐

the currently used gnutls_certificate_type_t certificate type β€” for the client or the server, depending on what you asked for. simple as πŸŽ€


πŸ•°οΈ SINCE πŸ•°οΈ

3.6.4 β€” she's been here a minute, she's a seasoned queen πŸ‘‘


πŸ™ˆ REPORTING BUGS πŸ™ˆ

found a bug? not me gatekeeping β€” report it, please and thank you πŸ’Œ


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 like. keep the notice. that's the rule. respect the queen's paperwork πŸ’…)


πŸ‘€ 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/

iykyk ✨


lowkey a reminder: the descriptions above are the whole truth and nothing but β€” don't go assuming extra behaviour, bestie, the manpage said what it said 🌸

and that's the page!! this lil beauty lives in the gnutls manual, version 3.8.13, dated alongside gnutls_certificate_type_get2(3) πŸŽ€ go forth and negotiate your certificate types responsibly, mwah πŸ’‹πŸ¦‹βœ¨

πŸ“¦ where this page comes from