gnutls_pkcs7_verify(3)

๐Ÿ’– gnutls_pkcs7_verify(3) ๐Ÿ’–

okay bestie, welcome to the gnutls manual, page gnutls_pkcs7_verify(3). this one is lowkey a whole vibe โ€” it's the API function that checks whether some data actually matches a signature sitting inside a PKCS 7 structure. let's get into it ๐ŸŽ€


โœจ NAME โœจ

gnutls_pkcs7_verify โ€” API function ๐Ÿซถ


โœจ SYNOPSIS โœจ

#include <gnutls/pkcs7.h>

int gnutls_pkcs7_verify(gnutls_pkcs7_t pkcs7, gnutls_x509_trust_list_t
tl, gnutls_typed_vdata_st * vdata, unsigned int vdata_size, unsigned
idx, const gnutls_datum_t * data, unsigned flags);

like yes, that's a lot of arguments. we'll go through every single one, no skipping, periodt ๐Ÿ’…


โœจ ARGUMENTS โœจ

  • gnutls_pkcs7_t pkcs7 โ€” this should contain a gnutls_pkcs7_t type. it's the PKCS 7 structure we're vibing with ๐Ÿ’œ
  • gnutls_x509_trust_list_t tl โ€” a list of trusted certificates. the guest list for this party, fr fr ๐Ÿ”ฅ
  • gnutls_typed_vdata_st * vdata โ€” an array of typed data โœจ
  • unsigned int vdata_size โ€” the number of data elements. how many are in that array ๐Ÿ‘‘
  • unsigned idx โ€” the index of the signature info to check. which one are we looking at ๐Ÿ‘€
  • const gnutls_datum_t * data โ€” the data to be verified, or NULL ๐Ÿฆ‹
  • unsigned flags โ€” zero, or an OR list of gnutls_certificate_verify_flags ๐ŸŒธ

โœจ DESCRIPTION โœจ

so the way this works is: this function verifies the provided data against the signature that's present in the SignedData of the PKCS 7 structure. that's the whole main character moment ๐Ÿ’…

and if the data you passed in is NULL? not a problem bestie โ€” then the data in the encapsulatedContent field gets used instead. iconic behaviour honestly ๐ŸŽ€


โœจ RETURNS โœจ

on success, GNUTLS_E_SUCCESS (0) is returned ๐ŸŽ‰ otherwise you get a negative error value, and we do NOT love that for us ๐Ÿ˜ญ

specifically:

  • a verification error results in a GNUTLS_E_PK_SIG_VERIFY_FAILED
  • the lack of encapsulated data to verify results in a GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE
ngl if you see one of those negative values, something did not slay. read it, don't ignore it ๐Ÿ™ˆ

โœจ SINCE โœจ

3.4.2 โ€” she's been around a minute, a true veteran ๐Ÿ’–


โœจ REPORTING BUGS โœจ

found a bug? don't gatekeep it, report it to <bugs@gnutls.org> ๐Ÿ“ฎ

home page: https://www.gnutls.org ๐ŸŒˆ


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 like, go off, but keep the receipts 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/

and that's the whole page, no cap ๐Ÿ’… this was gnutls, version 3.8.13, on the gnutls_pkcs7_verify(3) page โ€” go verify something and slay โœจ๐ŸŽ€๐Ÿ’–

๐Ÿ“ฆ where this page comes from