gnutls_ocsp_req_get_cert_id(3)

πŸ’– gnutls_ocsp_req_get_cert_id β€” the manual page, but make it make sense πŸ’–

okay bestie, so this is a page from the gnutls manual, and today's main character is gnutls_ocsp_req_get_cert_id(3). she's an API function. she's a little niche. she's everything if you're poking at OCSP requests. let's get into it πŸ¦‹


✨ NAME ✨

gnutls_ocsp_req_get_cert_id β€” API function πŸŽ€


🌸 SYNOPSIS 🌸

#include <gnutls/ocsp.h>

int gnutls_ocsp_req_get_cert_id(gnutls_ocsp_req_const_t req, unsigned
indx, gnutls_digest_algorithm_t * digest, gnutls_datum_t *
issuer_name_hash, gnutls_datum_t * issuer_key_hash, gnutls_datum_t *
serial_number);

like yes she takes six arguments. she's high maintenance. she's worth it. πŸ’…


🫢 ARGUMENTS 🫢

  • gnutls_ocsp_req_const_t req β€” this one should contain a gnutls_ocsp_req_t type. it's your request, queen, hand her over.
  • unsigned indx β€” Specifies which extension OID to get. Use (0) to get the first one. πŸ‘‘ (yes that is literally what the docs say, i'm not making it up, i would never)
  • gnutls_digest_algorithm_t * digest β€” an output variable that gets the gnutls_digest_algorithm_t hash algorithm. she's writing back to you, bestie.
  • gnutls_datum_t * issuer_name_hash β€” output buffer with the hash of issuer's DN πŸ“
  • gnutls_datum_t * issuer_key_hash β€” output buffer with the hash of issuer's public key πŸ”‘
  • gnutls_datum_t * serial_number β€” output buffer with the serial number of the certificate to check 🌈

πŸ’œ DESCRIPTION πŸ’œ

so basically, this function will return the certificate information of the indx'ed request in the OCSP request. it's giving "let me look inside this request and pull out the cert tea". β˜•

the information returned corresponds to the CertID structure, and here it is in all her glory:

CertID      ::=     SEQUENCE {
hashAlgorithm       AlgorithmIdentifier, issuerNameHash      OCTET
STRING, -- Hash of Issuer's DN issuerKeyHash       OCTET STRING, -- Hash
of Issuers public key serialNumber   CertificateSerialNumber }
ngl that formatting is a whole journey, but every bit of it matters β€” hashAlgorithm, issuerNameHash (hash of Issuer's DN), issuerKeyHash (hash of Issuers public key), and serialNumber (CertificateSerialNumber). no cap. 🧚

and the best part? each of the pointers to output variables may be NULL to indicate that the caller is not interested in that value. so if you don't care about, say, the serial number, just pass NULL and move on with your life. lowkey iconic of the API designers honestly. πŸ™ˆ


⭐ RETURNS ⭐

  • On success, GNUTLS_E_SUCCESS (0) is returned πŸŽ‰
  • otherwise, a negative error code is returned πŸ’€
  • and if you have reached the last CertID available, GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE will be returned 🫠 (that's your "you've hit the end, bestie, go home" signal)

😭 REPORTING BUGS 😭

found a bug? don't suffer in silence, that's not the vibe. Report bugs 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. 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, visit:

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

and that's the whole page, bestie!! 🌸 this was gnutls version 3.8.13, and the page itself is gnutls_ocsp_req_get_cert_id(3) β€” go forth and read those CertIDs, you absolute icon πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from