gnutls_decode_ber_digest_info(3)

πŸ’– gnutls_decode_ber_digest_info β€” bestie edition πŸ’–

okay so this is a page from the gnutls manual, and it's about gnutls_decode_ber_digest_info, which is lowkey one of those little functions that does exactly one thing and does it slay. it lives in the crypto corner of the library, and it's giving "i crack open RSA signature blobs for you" energy. no cap. πŸŽ€


✨ NAME ✨

gnutls_decode_ber_digest_info β€” literally an API function, that's it, that's the whole name πŸ¦‹


🌸 SYNOPSIS 🌸

#include <gnutls/crypto.h>

int gnutls_decode_ber_digest_info(const gnutls_datum_t * info,
gnutls_digest_algorithm_t * hash, unsigned char * digest, unsigned int *
digest_size);

like yes bestie, one include, one function call, we're so back ✨


🫢 ARGUMENTS 🫢

  • const gnutls_datum_t * info β€” an RSA BER encoded DigestInfo structure. that's the thing you're feeding in, it's the moment, it's the main character of this whole function πŸ’…
  • gnutls_digest_algorithm_t * hash β€” this one's an out-param, bestie. after the call it will contain the hash algorithm of the structure. it gets filled in for you, you don't fill it in πŸŽ€
  • unsigned char * digest β€” also an out-param. this one will contain the hash output of the structure. the actual digest bytes, right there πŸ“
  • unsigned int * digest_size β€” okay so this one is a lil different, pay attention: it will contain the hash size of the structure, BUT before you call, it initially must hold the maximum size of digest. so you're telling it how much room there is, and it tells you how much it actually used. it's a two-way convo, not a one-way vibe check πŸ‘‘

πŸ”₯ DESCRIPTION πŸ”₯

This function will parse an RSA PKCS1 1.5 DigestInfo structure and report the hash algorithm used as well as the digest data.

that's it. that's the whole job. it takes your BER-encoded DigestInfo blob, cracks it open, and hands you back (1) which hash algorithm was used and (2) the digest data itself. iconic behaviour honestly πŸ’–


⭐ RETURNS ⭐

On success, GNUTLS_E_SUCCESS (0) is returned, otherwise an error code is returned.

so like, 0 means we ate and left no crumbs. anything else means something went sideways and you should go read that error code, fr fr πŸ™ˆ


🌈 SINCE 🌈

3.5.0 β€” so it's been around a minute, it's a seasoned queen πŸ‘‘


πŸ’€ REPORTING BUGS πŸ’€

Report bugs to <bugs@gnutls.org>.

Home page: https://www.gnutls.org

found a bug? don't suffer in silence bestie, tell the gnutls girlies directly 🫢


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.

translation: take it, share it, remix it, just keep the receipts and don't be weird about it πŸ’œ


πŸ¦‹ 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 a whole universe, this page is just one star in it ⭐


🌸 and that's the page!! remember: digest_size comes in holding the max size, and leaves holding the actual size. that's the one gotcha that'll getcha. everything else is just vibes and GNUTLS_E_SUCCESS. iykyk πŸ’…

and finally, a lil sign-off from your fave: this page is from gnutls version 3.8.13, and it's dated alongside gnutls_decode_ber_digest_info(3). stay hydrated, read your error codes, and go parse some DigestInfo structures bestie πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from