OCSP_CERT_TO_ID(3)
Welcome to the OCSP_CERT_TO_ID(3) page, bestie π
β this is the Library Functions Manual, and weβre about to get into the OCSP certificate ID utility functions π
β¨ NAME β¨
okay so this page covers the whole little squad: OCSP_CERTID_new, OCSP_CERTID_free, OCSP_cert_to_id, OCSP_cert_id_new, OCSP_id_issuer_cmp, OCSP_id_cmp, and OCSP_id_get0_info β the OCSP certificate ID utility functions π
πΈ SYNOPSIS πΈ
First up, the library/include situation:
library βlibcryptoβ #include <openssl/ocsp.h>
And here are the prototypes, copied exactly because we do not mess with signatures, periodt:
OCSP_CERTID *
OCSP_CERTID_new(void);
void
OCSP_CERTID_free(OCSP_CERTID *id);
OCSP_CERTID *
OCSP_cert_to_id(const EVP_MD *dgst, const X509 *subject,
const X509 *issuer);
OCSP_CERTID *
OCSP_cert_id_new(const EVP_MD *dgst, const X509_NAME *issuerName,
const ASN1_BIT_STRING *issuerKey, const ASN1_INTEGER *serialNumber);
int
OCSP_id_issuer_cmp(OCSP_CERTID *a, OCSP_CERTID *b);
int
OCSP_id_cmp(OCSP_CERTID *a, OCSP_CERTID *b);
int
OCSP_id_get0_info(ASN1_OCTET_STRING **piNameHash, ASN1_OBJECT **pmd,
ASN1_OCTET_STRING **pikeyHash, ASN1_INTEGER **pserial,
OCSP_CERTID *cid);
π¦ DESCRIPTION π¦
OCSP_CERTID_new() allocates and initializes an empty OCSP_CERTID object, and that object represents an ASN.1 CertID structure defined in RFC 6960. It can store hashes of an issuerβs distinguished name and public key together with a serial number of a certificate. It is used by the OCSP_ONEREQ object described in OCSP_ONEREQ_new(3) and by the OCSP_SINGLERESP object described in OCSP_SINGLERESP_new(3). OCSP_CERTID_free() frees id. π«Ά
OCSP_cert_to_id()β creates and returns a newOCSP_CERTIDobject using message digestdgstfor certificatesubjectwith issuerissuer. IfdgstisNULL, thenSHA-1is used. β¨OCSP_cert_id_new()β creates and returns a newOCSP_CERTIDusingdgstand issuer nameissuerName, issuer key hashissuerKey, and serial numberserialNumber. πΈOCSP_id_issuer_cmp()β compares the hash algorithms, the hashed issuer distinguished names, and the hashed public keys ofOCSP_CERTIDaandb. πOCSP_id_cmp()β comparesOCSP_CERTIDaandbusingOCSP_id_issuer_cmp()followed by a comparison of the certificate serial numbers withASN1_INTEGER_cmp(3). πOCSP_id_get0_info()β returns the issuer name hash, hash OID, issuer key hash, and serial number contained incid. If any of the values are not required, the corresponding parameter can be set toNULL. The values returned byOCSP_id_get0_info()are internal pointers and must not be freed up by an application: they will be freed when the correspondingOCSP_CERTIDobject is freed. π¨
OCSP clients will typically only use OCSP_cert_to_id() or OCSP_cert_id_new(): the other functions are used by responder applications. iykyk π§
π RETURN VALUES π
OCSP_CERTID_new(),OCSP_cert_to_id(), andOCSP_cert_id_new()return either a pointer to a validOCSP_CERTIDobject orNULLif an error occurred. πOCSP_id_cmp()andOCSP_id_issuer_cmp()return0for a match or non-zero otherwise. πOCSP_id_get0_info()returns1for success or0for failure. β
π₯ SEE ALSO π₯
go read these next, bestie:
ASN1_INTEGER_cmp(3)EVP_DigestInit(3)OCSP_request_add1_nonce(3)OCSP_REQUEST_new(3)OCSP_resp_find_status(3)OCSP_response_status(3)OCSP_sendreq_new(3)X509_get_issuer_name(3)X509_NAME_new(3)X509_ocspid_print(3)
π STANDARDS π
RFC 6960: X.509 Internet Public Key Infrastructure Online Certificate Status Protocol, section 4: Details of the Protocol
β HISTORY β
These functions first appeared in OpenSSL 0.9.7 and have been available since OpenBSD 3.2. iconic behavior, honestly π
xoxo, signing off from Debian on June 8, 2025 ππ«Ά
π¦ where this page comes from
- alpine 3.24: libressl-doc 4.3.1-r0 Β· custom
- arch rolling: libressl 4.4.0-1 Β· ISC AND custom:OpenSSL
- Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
- Copyright (c) 2014, 2016 The OpenSSL Project. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms