gnutls_verify_stored_pubkey(3)

πŸ’– gnutls_verify_stored_pubkey β€” the vibe check for stored public keys πŸ’–

okay bestie, welcome to the gnutls manual, page gnutls_verify_stored_pubkey(3). this one's an API function and it's literally here to answer one question: do i already know this key, or is this a stranger? πŸ•΅οΈβ™€οΈβœ¨


🌸 NAME 🌸

gnutls_verify_stored_pubkey β€” API function. that's it, that's the name, she's giving utility icon πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

#include <gnutls/gnutls.h>

int gnutls_verify_stored_pubkey(const char * db_name, gnutls_tdb_t tdb,
const char * host, const char * service, gnutls_certificate_type_t
cert_type, const gnutls_datum_t * cert, unsigned int flags);

look at that signature. seven whole arguments. she's high maintenance but she's worth it 🫢


✨ ARGUMENTS ✨

  • const char * db_name β€” a file specifying the stored keys. pass NULL and you get the default one, no big deal πŸ’β™€οΈ
  • gnutls_tdb_t tdb β€” a storage structure, or NULL to use the default. yes you can bring your own, we love a custom setup πŸ”₯
  • const char * host β€” the peer's name. who are we even talking to rn πŸ‘€
  • const char * service β€” non-NULL if this key is specific to a service (e.g. http). very "this key has a job" energy πŸ’Ό
  • gnutls_certificate_type_t cert_type β€” the type of the certificate. gotta label your cert bestie, no mystery boxes πŸ“¦
  • const gnutls_datum_t * cert β€” the raw (der) data of the certificate. raw, unfiltered, der-encoded, iconic 🌈
  • unsigned int flags β€” should be 0. that's it. zero. nothing else. don't get creative, she said what she said πŸ’€

πŸ’« DESCRIPTION πŸ’«

so what does this function actually DO. bestie, it will try to verify a raw public-key, or a public-key that came to you via a raw (DER-encoded) certificate, using a list of stored public keys. basically: cross-referencing the group chat receipts πŸ“‹βœ¨

heads up: the service field, if it's non-NULL, should be a port number. not vibes. a number. πŸ”’

the db_name variable, if it's non-null, specifies a custom backend for the retrieval of entries. if it's NULL, the default file backend gets used. and on POSIX-like systems that file backend is literally the $HOME/.gnutls/known_hosts file. yes, same energy as your ssh known_hosts, she's not new here πŸ’…

now the important part, and i need you to actually read this one: if a custom storage backend is provided, the retrieval function should return GNUTLS_E_CERTIFICATE_KEY_MISMATCH if the host/service pair is found but the key doesn't match, GNUTLS_E_NO_CERTIFICATE_FOUND if no such host/service with the given key is found, and 0 if it was found. the storage function should return 0 on success. like, that's the contract, that's the whole deal, no negotiating 🀝

and as of GnuTLS 3.6.6, this function also verifies raw public keys. glow-up era fr fr ⭐


πŸ‘‘ RETURNS πŸ‘‘

  • no associated public key found? you're getting GNUTLS_E_NO_CERTIFICATE_FOUND. she doesn't know them 😭
  • key found but it does NOT match? GNUTLS_E_CERTIFICATE_KEY_MISMATCH. red flag, block them 🚩
  • on success, GNUTLS_E_SUCCESS (0) is returned. slay πŸŽ‰
  • or a negative error value on other errors. yeah, sometimes life is like that πŸ’€

πŸ¦‹ SINCE πŸ¦‹

3.0.13 β€” an elder, a legend, been here since forever πŸ‘‘


πŸ› REPORTING BUGS πŸ›

found a bug? do NOT suffer in silence bestie, tell someone. report bugs to <bugs@gnutls.org>.

home page: https://www.gnutls.org 🏠


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, share it, remix it, just keep the receipts 🫢


πŸ” 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, visit

https://www.gnutls.org/manual/

go read it, it's giving scholarly 🧚


and that's the whole page, bestie. no cap, every flag, every return value, every file path β€” all accounted for πŸ’–

this was gnutls version 3.8.13, gnutls_verify_stored_pubkey(3), and yes it's a whole 3.8.13 situation. mwah, stay verified βœ¨πŸ’…πŸŽ€

πŸ“¦ where this page comes from