gnutls_tpm_privkey_generate(3)

πŸ’– gnutls_tpm_privkey_generate πŸ’–

okay bestie, welcome to the gnutls manual β€” yes, that's the manual name, she's iconic, she's been here forever πŸŽ€

✨ NAME ✨

gnutls_tpm_privkey_generate β€” an API function, and she's the one who makes your TPM chip ✨birth✨ a private key


🌸 SYNOPSIS 🌸

#include <gnutls/tpm.h>

int gnutls_tpm_privkey_generate(gnutls_pk_algorithm_t pk, unsigned int
bits, const char * srk_password, const char * key_password,
gnutls_tpmkey_fmt_t format, gnutls_x509_crt_fmt_t pub_format,
gnutls_datum_t * privkey, gnutls_datum_t * pubkey, unsigned int flags);

like, look at all those arguments. she's high maintenance but she's worth it πŸ’…


πŸ¦‹ ARGUMENTS πŸ¦‹

okay so let's meet the cast, one by one, no skips:

  • gnutls_pk_algorithm_t pk β€” the public key algorithm, aka what flavor of key we're making here
  • unsigned int bits β€” the security bits, the ~strength~ number
  • const char * srk_password β€” a password to protect the exported key. it's optional, so no pressure bestie 🫢
  • const char * key_password β€” the password for the TPM. also optional πŸ’œ
  • gnutls_tpmkey_fmt_t format β€” the format of the private key
  • gnutls_x509_crt_fmt_t pub_format β€” the format of the public key
  • gnutls_datum_t * privkey β€” the generated key, the moment we've all been waiting for 😭
  • gnutls_datum_t * pubkey β€” the corresponding public key, and heads up, it may be null
  • unsigned int flags β€” should be a list of GNUTLS_TPM_* flags

πŸ‘‘ DESCRIPTION πŸ‘‘

so what does she actually do? This function will generate a private key in the TPM chip. and no, the key does not leave home β€” the private key will be generated within the chip and will be exported in a wrapped with TPM's master key form. yes, "wrapped with TPM's master key form", that's the vibe, that's the whole point πŸ”₯

Furthermore, the wrapped key can be protected with the provided password β€” you know, that srk_password we met up there.

lowkey important note: bits in TPM is a quantized value. If the input value is not one of the allowed values, then it will be quantized to one of 512, 1024, 2048, 4096, 8192 and 16384. so don't come in here with your random little numbers and expect them to survive, bestie πŸ’€ she's rounding you to the nearest one of those, periodt.

Allowed flags are:

(that's it. that's the list. she said "allowed flags are:" and then… nothing. iconic honestly πŸ™ˆ)


⭐ RETURNS ⭐

On success, GNUTLS_E_SUCCESS (0) is returned, otherwise a negative error value. so if you see a negative number, that's your sign, it's giving "something went wrong" 😭


🌈 SINCE 🌈

3.1.0 β€” she's been around, she's a veteran, main character energy from day one πŸ‘‘


πŸ“ REPORTING BUGS πŸ“

found a bug? don't be shy, tell the girlies:


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, copy it, share it, remix it β€” just keep the receipts, bestie πŸ’–)


πŸ’œ 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/

iykyk β€” go read the whole Texinfo manual, she's long but she's thorough 🌸


okay that's the whole page, we ate and left no crumbs πŸ’… this was gnutls manual, version 3.8.13 β€” thanks for reading bestie, go generate some keys in your TPM and slay βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from