OCSP_CERT_TO_ID(3SSL)
π OCSP_CERT_TO_ID π
okay bestie, welcome to the 3SSL manual page β yes that's the manual section, it's giving OpenSSL and it's giving β¨certificate ID utility functionsβ¨. Pull up a chair, grab a boba, we're doing this.
πΈ NAME πΈ
OCSP_cert_to_id, OCSP_cert_id_new, OCSP_CERTID_free, OCSP_id_issuer_cmp, OCSP_id_cmp, OCSP_id_get0_info β the OCSP certificate ID utility functions. literally the whole little friend group of functions that build, compare, inspect and yeet OCSP certificate IDs π
β¨ SYNOPSIS β¨
#include <openssl/ocsp.h>
OCSP_CERTID *OCSP_cert_to_id(const EVP_MD *dgst,
X509 *subject, X509 *issuer);
OCSP_CERTID *OCSP_cert_id_new(const EVP_MD *dgst,
X509_NAME *issuerName,
ASN1_BIT_STRING *issuerKey,
ASN1_INTEGER *serialNumber);
void OCSP_CERTID_free(OCSP_CERTID *id);
int OCSP_id_issuer_cmp(const OCSP_CERTID *a, const OCSP_CERTID *b);
int OCSP_id_cmp(const OCSP_CERTID *a, const 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);
look at those signatures. immaculate. no notes π
π¦ DESCRIPTION π¦
okay so, let's go function by function, no cap:
OCSP_cert_to_id()creates and returns a brand newOCSP_CERTIDstructure, using message digest dgst for the certificate subject with issuer issuer. oh and bestie, important: if dgst isNULLthen SHA1 gets used. default behaviour, iconic behaviour.OCSP_cert_id_new()creates and returns a newOCSP_CERTIDusing dgst plus issuer name issuerName, issuer key hash issuerKey and serial number serialNumber. it's the DIY build-your-own-ID version, we love a hands-on queen π«ΆOCSP_CERTID_free()frees up id. and if the argument isNULL? nothing happens. it just vibes. no crash, no drama, we respect that energy.OCSP_id_cmp()comparesOCSP_CERTIDa and b. the whole thing. full comparison. πOCSP_id_issuer_cmp()compares only the issuer name ofOCSP_CERTIDa and b. just the issuer name, nothing else, it's a very focused queen.OCSP_id_get0_info()returns the issuer name hash, hash OID, issuer key hash and serial number contained in cid. and here's the cute part: if any of those values are not required, the corresponding parameter can be set toNULL. build your own little info bundle, pick and choose, slay.
π RETURN VALUES π
the receipts, bestie:
OCSP_cert_to_id()andOCSP_cert_id_new()return either a pointer to a validOCSP_CERTIDstructure, orNULLif an error occurred.NULL= something went wrong, we don't gatekeep bad news πOCSP_id_cmp()andOCSP_id_issuer_cmp()return zero for a match and nonzero otherwise. yes zero means match, which is lowkey cursed but that's C for you, periodt.OCSP_CERTID_free()does not return a value. it just does its thing and leaves. mysterious. main character.OCSP_id_get0_info()returns1for success and0for failure. classic. old reliable. β
π NOTES π
okay crucial context, don't skip this part:
- OCSP clients will typically only use
OCSP_cert_to_id()orOCSP_cert_id_new(). the other functions? those are used by responder applications. so like, know which one you are, iykyk. - the values returned by
OCSP_id_get0_info()are internal pointers and MUST NOT be freed up by an application: they will be freed when the correspondingOCSP_CERTIDstructure is freed.
β οΈ bestie i am BEGGING you β do notfree()those pointers. they are borrowed, not yours. theOCSP_CERTIDowns them and it will handle the cleanup when it goes. touching them yourself is how you get a double-free and a very bad afternoon. π
π SEE ALSO π
go read these next, they're all in the same friend group:
crypto(7), OCSP_request_add1_nonce(3), OCSP_REQUEST_new(3), OCSP_resp_find_status(3), OCSP_response_status(3), OCSP_sendreq_new(3)
π COPYRIGHT π
Copyright 2015-2024 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.
and that's the whole page, bestie π«Ά this was OpenSSL version 4.0.3, dated 2026-09-29, and yes we ate. no crumbs. go forth and build those certificate IDs πβ¨πΈ
π¦ where this page comes from
- ubuntu stonking: libssl-doc 4.0.3-1ubuntu1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms