gnutls_pkcs12_bag_enc_info(3)

πŸ’– gnutls_pkcs12_bag_enc_info(3) β€” the gnutls girlies' guide πŸ’–

okay bestie, sit down, hydrate, because we're diving into gnutls's PKCS#12 corner and honestly? it's giving ✨forensics✨.


🌸 NAME 🌸

gnutls_pkcs12_bag_enc_info β€” literally the API function that spills the tea on how your encrypted bag was encrypted πŸ”


πŸŽ€ SYNOPSIS πŸŽ€

#include <gnutls/pkcs12.h>

int gnutls_pkcs12_bag_enc_info(gnutls_pkcs12_bag_t bag, unsigned int *
schema, unsigned int * cipher, void * salt, unsigned int * salt_size,
unsigned int * iter_count, char ** oid);

πŸ¦‹ ARGUMENTS πŸ¦‹

  • gnutls_pkcs12_bag_t bag β€” the bag. the main character. the whole point. πŸ‘œ
  • unsigned int * schema β€” this one tells you the schema, and it's one of gnutls_pkcs_encrypt_flags_t. pick your fighter.
  • unsigned int * cipher β€” the cipher that got used, expressed as a gnutls_cipher_algorithm_t.
  • void * salt β€” the PBKDF2 salt, bestie. and listen: if this is non-NULL, then salt_size is initially holding its size. read that twice. πŸ™ˆ
  • unsigned int * salt_size β€” the PBKDF2 salt size. yes it's a whole separate thing, yes it matters.
  • unsigned int * iter_count β€” the PBKDF2 iteration count. the grind never stops, and neither does this number. πŸ’ͺ
  • char ** oid β€” if this isn't NULL, it's gonna hold an allocated null-terminated variable with the OID. allocated. as in yours to free. remember that. 🫢

✨ DESCRIPTION ✨

so this function right here? it hands you the info about which encryption algorithms were used in an encrypted bag. that's the whole job. that's the assignment.

but here's the plot twist 😭 β€” if the structure's algorithms are unknown, you get GNUTLS_E_UNKNOWN_CIPHER_TYPE back, and only oid gets set. just oid. everyone else stays quiet.

and like… oid will be set on encrypted bags whether supported or not. supported? oid's there. unsupported? oid's still there. iconic behavior honestly. but you HAVE to deinitialize it with gnutls_free(), no cap, or that's a leak and we don't do leaks in this house πŸš«πŸ’§

the other variables? they only get set on supported structures. sorry to the unsupported ones. vibe check failed. πŸ’€


🌈 RETURNS 🌈

  • GNUTLS_E_INVALID_REQUEST β€” if the bag you handed over isn't even encrypted. bestie. it's giving "you brought me a plain bag and asked about its encryption."
  • GNUTLS_E_UNKNOWN_CIPHER_TYPE β€” if the structure's encryption isn't supported. it's real, it's encrypted, we just don't speak that language. πŸ˜”
  • another negative error code β€” if something else went wrong, as failures do.
  • Zero β€” on success. slay. πŸŽ‰

πŸ› REPORTING BUGS πŸ›

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


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 license vibe β€” keep the notice, keep the freedom, no royalty, periodt. πŸ’…)


πŸ’œ 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, then bestie, just go here:

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


and that's the whole page, my love β€” gnutls 3.8.13, gnutls_pkcs12_bag_enc_info(3), straight from the gnutls manual, rewritten with love and a concerning amount of emoji. now go free that oid 🫢✨

πŸ“¦ where this page comes from