gnutls_pkcs11_privkey_generate3(3)
π gnutls_pkcs11_privkey_generate3 π
okay bestie, so this one lives in the gnutls manual, and it's literally the glow-up machine for private keys. it's an API function, it's iconic, and we're gonna go through it together. grab a strawberry π
β¨ NAME β¨
gnutls_pkcs11_privkey_generate3 β API function
π¦ SYNOPSIS π¦
#include <gnutls/pkcs11.h>
int gnutls_pkcs11_privkey_generate3(const char * url,
gnutls_pk_algorithm_t pk, unsigned int bits, const char * label, const
gnutls_datum_t * cid, gnutls_x509_crt_fmt_t fmt, gnutls_datum_t *
pubkey, unsigned int key_usage, unsigned int flags);
π ARGUMENTS π
const char * urlβ a token URL. this is where the magic happens, the address of the lil token that's gonna hold your new key β¨gnutls_pk_algorithm_t pkβ the public key algorithm. which flavor of key are we making, bestieunsigned int bitsβ the security bits. how much security are we giving πconst char * labelβ a label. a cute lil name tag for your keyconst gnutls_datum_t * cidβ theCKA_IDto use for the new objectgnutls_x509_crt_fmt_t fmtβ the format of output params.PEMorDERgnutls_datum_t * pubkeyβ will hold the public key (may beNULL)unsigned int key_usageβ one ofGNUTLS_KEY_*unsigned int flagsβ zero, or an OR'ed sequence ofGNUTLS_PKCS11_OBJ_FLAGs
πΈ DESCRIPTION πΈ
so basically this function will generate a private key in the token specified by the url. the private key gets generated within the token and it will not be exportable β no cap, it's staying home, it's not leaving the house π β¨
this function will store the DER-encoded public key in the SubjectPublicKeyInfo format in pubkey. and heads up: that pubkey should be deinitialized using gnutls_free().
not me forgetting to free it... bestie don't be like me, call gnutls_free() π
note that when generating an elliptic curve key, the curve can be substituted in the place of the bits parameter using the GNUTLS_CURVE_TO_BITS() macro. sneaky but iconic π¦
since 3.6.3 the objects are marked as sensitive by default unless GNUTLS_PKCS11_OBJ_FLAG_MARK_NOT_SENSITIVE is specified. so yeah, sensitive is the default vibe now π
β RETURNS β
on success, GNUTLS_E_SUCCESS (0) is returned, otherwise a negative error value. simple as that, periodt.
π SINCE π
3.4.0
π REPORTING BUGS π
found a bug? tell the girlies at <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. slay, that's the license, go off π«Ά
π₯ 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_pkcs11_privkey_generate3(3) from the gnutls manual, version 3.8.13, and it's giving main character energy fr fr. go generate some keys, stay unexportable, and remember: deinitialize with gnutls_free(). 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