GNUTLS_PKCS11_TOKEN_GET_MECHANISM(3)

πŸ’– gnutls_pkcs11_token_get_mechanism(3) πŸ’–

okay bestie, so this one lives in the gnutls manual, and it's a lil API function that goes digging through your PKCS 11 token to find out what crypto mechanisms it can actually do. iykyk 🫢


✨ NAME ✨

gnutls_pkcs11_token_get_mechanism β€” API function


🌸 SYNOPSIS 🌸

#include <gnutls/pkcs11.h>

int gnutls_pkcs11_token_get_mechanism(const char * url, unsigned int
idx, unsigned long * mechanism);

πŸŽ€ ARGUMENTS πŸŽ€

  • const char * url β€” this should contain a PKCS 11 URL. that's it, that's the whole vibe πŸ’…
  • unsigned int idx β€” the index of the mechanism, like which one in the list you're asking about
  • unsigned long * mechanism β€” the PKCS 11 mechanism ID lands here 🫢

πŸ¦‹ DESCRIPTION πŸ¦‹

so like, this function will return the names of the supported mechanisms by the token. no cap.

here's the move: you call it with an increasing index until it returns GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE. that's how you know you've hit the end of the list, bestie β€” it's giving "no more for you, go home" 😭

so you just keep bumping that index up, one at a time, collecting mechanisms, and when you get GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE back? you're done. periodt. πŸ‘‘


πŸ’œ RETURNS πŸ’œ

GNUTLS_E_SUCCESS (0) on success β€” slay ✨ β€” or a negative error code on error. (yes the negative ones are the sad ones, we don't love those)


⭐ SINCE ⭐

2.12.0 β€” an elder, a legend, iconic since way back πŸ’«


πŸ™ˆ REPORTING BUGS πŸ™ˆ

found a bug? not me being the messenger but β€” report bugs to <bugs@gnutls.org>. they wanna hear it, fr fr.

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.


🌈 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/

mwah πŸ’‹ that's the whole page. this is gnutls version 3.8.13, page gnutls_pkcs11_token_get_mechanism(3), and that's a wrap bestie β€” go enumerate some mechanisms, you absolute main character πŸ§šπŸ’–

πŸ“¦ where this page comes from