gnutls_pkcs7_get_crt_raw2(3)
π gnutls_pkcs7_get_crt_raw2(3) β the gnutls manual, bestie edition π
okay so real talk, this is a page from the gnutls manual and it's about pulling one (1) single certificate out of a PKCS7 pile. let's get into it π
β¨ NAME β¨
gnutls_pkcs7_get_crt_raw2 β API function π
(yes that's literally all it says, it's an API function, she's mysterious like that)
πΈ SYNOPSIS πΈ
#include <gnutls/pkcs7.h>
int gnutls_pkcs7_get_crt_raw2(gnutls_pkcs7_t pkcs7, unsigned indx,
gnutls_datum_t * cert);
that's the whole vibe, no cap β¨
π¦ ARGUMENTS π¦
gnutls_pkcs7_t pkcs7β bestie, this one should contain agnutls_pkcs7_ttype. that's it, that's the requirement πunsigned indxβ it contains the index of the certificate to extract, so like, which one you want out of the pile π’gnutls_datum_t * certβ this will hold the contents of the certificate. β οΈ and listen, it must be deallocated withgnutls_free()β don't you dare leak her, that's not the move π«Ά
π DESCRIPTION π
so this function will return a certificate of the PKCS7 or RFC2630 certificate set. iconic behaviour, honestly π
and here's the important part: after the last certificate has been read GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE will be returned. so when you hit the end she tells you it's the end. no guessing games π
π RETURNS π
On success, GNUTLS_E_SUCCESS (that's 0, the beautiful zero β¨) is returned, otherwise you get a negative error value. boo. π
and if the provided buffer is not long enough, then certificate_size is updated and GNUTLS_E_SHORT_MEMORY_BUFFER is returned. so she's like "okay here's how much space I actually need, try again" π
β SINCE β
3.4.2 β vintage, but still eating π
π REPORTING BUGS π
found a bug? Report bugs to <bugs@gnutls.org>. she reads her emails fr fr π§
Home page: https://www.gnutls.org
π 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. β free as in freedom and also free as in slay π
π§ SEE ALSO π§
The full documentation for gnutls is maintained as a Texinfo manual. and if the /usr/share/doc/gnutls/ directory does not contain the HTML form, go visit:
https://www.gnutls.org/manual/
like, go read it, it's giving β¨
heads up bestie: if thatcertbuffer is shorter than the cert, you're gettingGNUTLS_E_SHORT_MEMORY_BUFFERandcertificate_sizegets updated, so check it and come back. and alwaysgnutls_free()at the end. iykyk π
k bye that's the whole page π this was gnutls 3.8.13, gnutls_pkcs7_get_crt_raw2(3), mwah π ππ¦πΈ
π¦ 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