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 ofdigest. 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 π
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_sizecomes in holding the max size, and leaves holding the actual size. that's the one gotcha that'll getcha. everything else is just vibes andGNUTLS_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
- alpine 3.22: gnutls-doc 3.8.13-r0 Β· LGPL-2.1-or-later
- alpine 3.23: gnutls-doc 3.8.13-r0 Β· LGPL-2.1-or-later
- alpine 3.24: gnutls-doc 3.8.13-r0 Β· LGPL-2.1-or-later
- arch rolling: gnutls 3.8.13-3 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- fedora 43: gnutls-devel 3.8.13-1.fc43 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- fedora 43: gnutls-devel 3.8.13-1.fc43 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- fedora 44: gnutls-devel 3.8.13-1.fc44 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- fedora 44: gnutls-devel 3.8.13-1.fc44 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- ubuntu stonking: gnutls-doc 3.8.13-1ubuntu1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms