gnutls_pkcs8_info(3)

✨ NAME ✨

gnutls_pkcs8_info β€” bestie, this is an API function and it's literally here to spill the tea on your PKCS 8 structure πŸ’…

(It lives in the gnutls manual, section 3, in case you were wondering where this came from πŸŽ€)


🌸 SYNOPSIS 🌸

#include <gnutls/x509.h>

int gnutls_pkcs8_info(const gnutls_datum_t * data, gnutls_x509_crt_fmt_t
format, unsigned int * schema, unsigned int * cipher, void * salt,
unsigned int * salt_size, unsigned int * iter_count, char ** oid);

okay so it's giving very "eight arguments, no notes" 😭 but we're gonna walk through every single one, don't you worry 🫢


πŸ¦‹ ARGUMENTS πŸ¦‹

  • const gnutls_datum_t * data β€” holds the PKCS 8 data. this is the thing we're snooping on πŸ‘€
  • gnutls_x509_crt_fmt_t format β€” the format of the PKCS 8 data. you gotta tell it what flavor you're handing over πŸ“
  • unsigned int * schema β€” this one comes back indicating the schema as one of gnutls_pkcs_encrypt_flags_t ✨
  • unsigned int * cipher β€” the cipher that got used, reported as a gnutls_cipher_algorithm_t πŸ”₯
  • void * salt β€” PBKDF2 salt, and here's the lil trick: if it's non-NULL then salt_size initially holds its size. so it's a two-way street, okay? πŸ’–
  • unsigned int * salt_size β€” PBKDF2 salt size. yes it does double duty, we already covered that, keep up bestie 😌
  • unsigned int * iter_count β€” PBKDF2 iteration count. the number of times it stirred the pot πŸ₯„
  • char ** oid β€” if it's non-NULL it will contain an allocated null-terminated variable with the OID. like, an actual string, freshly allocated, just for you πŸ‘‘

πŸ’œ DESCRIPTION πŸ’œ

So this function will provide information on the algorithms used in a particular PKCS 8 structure. That's the whole gig. It looks at your blob and tells you what's inside it πŸ•΅οΈβ€β™€οΈ

But here's the plot twist: if the structure algorithms are unknown, the code GNUTLS_E_UNKNOWN_CIPHER_TYPE will be returned, and only oid will be set. That's right β€” only the oid. Everything else is just sitting there unset like πŸ’€

And that's not a bug, that's by design, bestie: oid will be set on encrypted PKCS 8 structures whether supported or not. So it's the one reliable friend in the group chat 🫢

🚨 IMPORTANT: that oid must be deinitialized using gnutls_free(). Do NOT forget. Do NOT be that girl. Free your memory, periodt.

The other variables β€” schema, cipher, salt, salt_size, iter_count β€” are only set on supported structures. If the structure isn't supported, they're giving nothing πŸ™ˆ


⭐ RETURNS ⭐

  • GNUTLS_E_INVALID_REQUEST β€” if the provided structure isn't an encrypted key. like, wrong girl, wrong party 🚫
  • GNUTLS_E_UNKNOWN_CIPHER_TYPE β€” if the structure's encryption isn't supported. we don't know her 😭
  • another negative error code β€” in case of a failure. any other kind of L πŸ’€
  • Zero β€” on success. the slay. the moment. the 0️⃣ we've been waiting for πŸ‘‘

πŸŽ€ SINCE πŸŽ€

3.4.0 β€” she's been around since 3.4.0, an icon, a legend, and she is the moment ✨


🌈 REPORTING BUGS 🌈

Found a bug? Not on my watch, but also please tell the people who can actually fix it:


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 yes, you may copy it, no cap, just keep the notice, bestie πŸ’…


πŸ‘‘ 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/

like, go read the whole thing, it's giving encyclopedia but make it cute πŸ“šβœ¨


okay bye ily, this was gnutls_pkcs8_info(3) from the gnutls manual, version 3.8.13, and honestly? she ate πŸ’…βœ¨πŸ¦‹

πŸ“¦ where this page comes from