GNUTLS_PKCS11_OBJ_GET_PK_ALGORITHM(3)

πŸ’– gnutls_pkcs11_obj_get_pk_algorithm(3) πŸ’–

okay bestie, sit down, we're reading a gnutls manpage together and honestly? it's giving "small function, big feelings". this is part of the gnutls manual, and it's about peeking at a PKCS#11 object and finding out what kind of key it's hiding. πŸŽ€


✨ NAME ✨

gnutls_pkcs11_obj_get_pk_algorithm β€” an API function, no cap 🫢


🌸 SYNOPSIS 🌸

#include <gnutls/pkcs11.h>

int gnutls_pkcs11_obj_get_pk_algorithm(gnutls_pkcs11_obj_t obj, unsigned
       int * bits);

πŸ¦‹ ARGUMENTS πŸ¦‹

  • gnutls_pkcs11_obj_t obj β€” the pkcs11 object itself. the main character of this whole story πŸ’…
  • unsigned int * bits β€” this little pointer is gonna hold stuff for you. specifically: the rsa/dsa bit count, or the ecc curve. so here's the tea β€” you hand this function a pkcs11 object that already has privkey_type initialized, and on success it tells you the algorithm type. and if the algo type is GNUTLS_PK_RSA or GNUTLS_PK_DSA, it stores the number of bits in there. but if the algo type is GNUTLS_PK_ECDSA, it stores the curve instead. same pointer, different vibes, iykyk. 😭

⭐ DESCRIPTION ⭐

so like... the return value needs to be checked, okay? you have to check it, because only then do you know whether bits is representing the ecc curve or the number of bits. one pointer, two possible meanings, and it's on you to figure out which one you got. no shortcuts, bestie. πŸ”₯


πŸ’œ RETURNS πŸ’œ

the private key algorithm associated with the object on success ✨ β€” or an error code if it didn't work out. either way, check it. πŸ™ˆ


🌈 SINCE 🌈

3.8.13 β€” she's new-ish, she's fresh, she's here. πŸ‘‘


πŸ“ REPORTING BUGS πŸ“

found a bug? don't suffer in silence, tell the devs:


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. (yes, that's the whole thing, verbatim, go wild, just keep the notice πŸ’–)


πŸ” SEE ALSO πŸ”

the full documentation for gnutls is maintained as a Texinfo manual. so if the /usr/share/doc/gnutls/ directory does not contain the HTML form, just go visit:

https://www.gnutls.org/manual/


and that's the whole page, bestie!! go forth, check your return values, and slay πŸ’…βœ¨

mwah πŸ’‹ β€” this was gnutls version 3.8.13, signing off 🫢

πŸ“¦ where this page comes from