gnutls_privkey_import_ext3(3)

πŸ’– gnutls_privkey_import_ext3(3) πŸ’–

okay bestie, this one lives in the gnutls manual (the whole library's docs, yk) and it's literally the glow-up that lets you be the private key. no cap.


✨ NAME ✨

gnutls_privkey_import_ext3 β€” API function 🫢


✨ SYNOPSIS ✨

#include <gnutls/abstract.h>

int gnutls_privkey_import_ext3(gnutls_privkey_t pkey, void * userdata,
gnutls_privkey_sign_func sign_fn, gnutls_privkey_decrypt_func
decrypt_fn, gnutls_privkey_deinit_func deinit_fn,
gnutls_privkey_info_func info_fn, unsigned int flags);

✨ ARGUMENTS ✨

  • gnutls_privkey_t pkey β€” the private key itself, the main character πŸ’…
  • void * userdata β€” private data that gets handed over to the callbacks, like a lil snack you pack for them
  • gnutls_privkey_sign_func sign_fn β€” the callback that handles signature operations ✍️
  • gnutls_privkey_decrypt_func decrypt_fn β€” the callback that handles decryption operations πŸ”“
  • gnutls_privkey_deinit_func deinit_fn β€” a deinitialization function, aka the goodbye-hug function
  • gnutls_privkey_info_func info_fn β€” returns info about the public key algorithm, and it should not be NULL 🚫
  • unsigned int flags β€” flags for the import 🚩

✨ DESCRIPTION ✨

So basically this function associates the callbacks you give it with the gnutls_privkey_t type. ✨

At least one of the two callbacks (sign_fn or decrypt_fn) must be non-null. and if you hand over a deinitialization function, then flags is assumed to contain GNUTLS_PRIVKEY_IMPORT_AUTO_RELEASE. that's just how it is, periodt.

Heads up bestie: the signing function is supposed to "raw" sign data β€” like, without any hashing or preprocessing. none. zero. In the case of RSA the DigestInfo will be provided, and your signing function is expected to do the PKCS 1 1.5 padding and the exponentiation. yes, you. it's giving DIY πŸ’€

The info_fn must provide information on the algorithms supported by this private key, and it should support the flags GNUTLS_PRIVKEY_INFO_PK_ALGO and GNUTLS_PRIVKEY_INFO_SIGN_ALGO. It must return -1 on unknown flags. no guessing, no improvising πŸ”₯


✨ RETURNS ✨

On success, GNUTLS_E_SUCCESS (0) is returned πŸŽ€ otherwise you get a negative error value. it's giving "we're so back" vs "it's over". 😭


✨ SINCE ✨

3.4.0 β€” an icon, honestly, a legend, been here forever πŸ‘‘


✨ REPORTING BUGS ✨

found a bug? spill it 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 generous, we love to see it 🌈


✨ 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 version 3.8.13, page gnutls_privkey_import_ext3(3), mwah πŸ’– go raw-sign something iconic βœ¨πŸ¦‹πŸŽ€

πŸ“¦ where this page comes from