gnutls_store_pubkey(3)
π gnutls_store_pubkey β the manual page, but make it cute π
okay bestie, welcome to the gnutls manual, section 3. today's main character is gnutls_store_pubkey, and she's literally the API function that files your peer's public key away so you don't have to re-verify it every single time. no cap. π
β¨ NAME β¨
gnutls_store_pubkey β API function π
π¦ SYNOPSIS π¦
#include <gnutls/gnutls.h>
int gnutls_store_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, time_t expiration, unsigned int flags);
like look at her. eight arguments. she's that girl. π
πΈ ARGUMENTS πΈ
const char * db_nameβ a file that says where the stored keys live. passNULLif you want the default one, bestie.gnutls_tdb_t tdbβ a storage structure, orNULLto just use the default. π«Άconst char * hostβ the peer's name. yes, their name. πconst char * serviceβ non-NULLif this key is specific to a service (thinkhttp). otherwise leave it be.gnutls_certificate_type_t cert_typeβ the type of the certificate.const gnutls_datum_t * certβ the actual data of the certificate.time_t expirationβ when this key expires. use0to disable expiration entirely (immortal key era β¨).unsigned int flagsβ should be0. that's it. that's the whole vibe check.
π DESCRIPTION π
so this function stores a raw public-key β or a public-key that came in via a raw (DER-encoded) certificate β into the list of stored public keys. the key stays considered valid until the expiration time you handed over. periodt. π₯
the tdb variable, if it's non-null, specifies a custom backend for storing entries. if it's NULL? then the default file backend gets used, no questions asked. π«
unless you provide an alternative tdb, the storage format is a textual format β one line per host, fields separated by '|'. and the contents of those fields, in order, are:
- a format-identifier, which is set to
'g0' - the hostname that the rest of the data applies to
- the numeric port or host name
- the expiration time in seconds since the epoch (
0for no expiration) - a base64 encoding of the raw (DER) public key information (SPKI) of the peer
as of GnuTLS 3.6.6, this function also accepts raw public keys. glow-up behavior fr fr. π
β RETURNS β
on success, GNUTLS_E_SUCCESS (0) is returned. otherwise you get a negative error value. π she's not mad, she's just disappointed.
π SINCE π
3.0.13 β vintage, but in a chic way. π
π 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 like, go off, 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/
and that's the whole page, bestie!! π this was gnutls 3.8.13, manual section 3, and yes we are absolutely obsessed with her. 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