gnutls_pkcs11_copy_x509_privkey2(3)

πŸ’… gnutls_pkcs11_copy_x509_privkey2 β€” the glow-up edition

okay so bestie, welcome to the gnutls manual, section 3. today's main character is gnutls_pkcs11_copy_x509_privkey2, and she is literally the "put your private key on a token" girlie. sit down, hydrate, let's go. 🫢


✨ NAME ✨

gnutls_pkcs11_copy_x509_privkey2 β€” it's an API function, bestie. that's the whole name. iconic, short, no notes. πŸ‘‘


🌸 SYNOPSIS 🌸

#include <gnutls/pkcs11.h>

int gnutls_pkcs11_copy_x509_privkey2(const char * token_url,
gnutls_x509_privkey_t key, const char * label, const gnutls_datum_t *
cid, unsigned int key_usage, unsigned int flags);

that's the whole vibe check right there. six arguments, one int coming back at you. ✨


πŸŽ€ ARGUMENTS πŸŽ€

  • const char * token_url β€” a PKCS 11 URL that specifies a token. like, which token are we sliding into? this one. πŸ—‚οΈ
  • gnutls_x509_privkey_t key β€” a private key. your little secret. 🀫
  • const char * label β€” a name to be used for the stored data. give it a cute nickname, it deserves one. 🏷️
  • const gnutls_datum_t * cid β€” the CKA_ID to set for the object -if it's NULL, the ID will be derived from the public key. so like, leave it NULL and the universe figures it out for you. ✨
  • unsigned int key_usage β€” one of GNUTLS_KEY_*. pick your fighter. πŸ”₯
  • unsigned int flags β€” one of GNUTLS_PKCS11_OBJ_* flags. seasoning, basically. πŸ§‚

πŸ’– DESCRIPTION πŸ’–

so what does she do? this function will copy a private key into a PKCS 11 token specified by a URL. that's it, that's the job. lowkey powerful, highkey necessary. πŸ’…

and here's the tea you actually need: since 3.6.3, the objects are marked as sensitive by default β€” unless GNUTLS_PKCS11_OBJ_FLAG_MARK_NOT_SENSITIVE is specified. so like, by default she's private-private. no cap. πŸ”’

fr fr, don't go flipping that sensitivity flag unless you actually know what you're doing, bestie. the default is the default for a reason. πŸ’€

⭐ RETURNS ⭐

on success, GNUTLS_E_SUCCESS (0) is returned. otherwise you get a negative error value, which is the function's way of being like "girl, no". 😭


πŸ¦‹ SINCE πŸ¦‹

3.4.0 β€” she's been around a minute. vintage but still serving. πŸ‘‘


πŸ™ˆ REPORTING BUGS πŸ™ˆ

found a bug? don't be shy, report bugs to <bugs@gnutls.org>.

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

they wanna hear from you, for real. 🫢


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/

that's your homework, bestie. go read. πŸ“š


and that's the whole page! this was gnutls_pkcs11_copy_x509_privkey2, page 3 of the gnutls manual, brought to you by gnutls 3.8.13. thanks for scrolling with me, mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from