OSSL_CMP_ITAV_NEW_CACERTS(3SSL)
π OSSL_CMP_ITAV_NEW_CACERTS(3SSL) π
okay bestie, gather round, because this is the 3SSL page for a whole little squad of OpenSSL CMP utility functions that handle specific genm and genp messages β¨. It's giving "I speak fluent Certificate Management Protocol and I'm about to make it make sense for you." No cap.
πΈ SYNOPSIS πΈ
#include <openssl/cmp.h>
OSSL_CMP_ITAV *OSSL_CMP_ITAV_new_caCerts(const STACK_OF(X509) *caCerts);
int OSSL_CMP_ITAV_get0_caCerts(const OSSL_CMP_ITAV *itav, STACK_OF(X509) **out);
OSSL_CMP_ITAV *OSSL_CMP_ITAV_new_rootCaCert(const X509 *rootCaCert);
int OSSL_CMP_ITAV_get0_rootCaCert(const OSSL_CMP_ITAV *itav, X509 **out);
OSSL_CMP_ITAV *OSSL_CMP_ITAV_new_rootCaKeyUpdate(const X509 *newWithNew,
const X509 *newWithOld,
const X509 *oldWithNew);
int OSSL_CMP_ITAV_get0_rootCaKeyUpdate(const OSSL_CMP_ITAV *itav,
X509 **newWithNew,
X509 **newWithOld,
X509 **oldWithNew);
OSSL_CMP_CRLSTATUS *OSSL_CMP_CRLSTATUS_new1(const DIST_POINT_NAME *dpn,
const GENERAL_NAMES *issuer,
const ASN1_TIME *thisUpdate);
OSSL_CMP_CRLSTATUS *OSSL_CMP_CRLSTATUS_create(const X509_CRL *crl,
const X509 *cert, int only_DN);
int OSSL_CMP_CRLSTATUS_get0(const OSSL_CMP_CRLSTATUS *crlstatus,
DIST_POINT_NAME **dpn, GENERAL_NAMES **issuer,
ASN1_TIME **thisUpdate);
OSSL_CMP_ITAV
*OSSL_CMP_ITAV_new0_crlStatusList(STACK_OF(OSSL_CMP_CRLSTATUS) *crlStatusList);
int OSSL_CMP_ITAV_get0_crlStatusList(const OSSL_CMP_ITAV *itav,
STACK_OF(OSSL_CMP_CRLSTATUS) **out);
OSSL_CMP_ITAV *OSSL_CMP_ITAV_new_crls(const X509_CRL *crl);
int OSSL_CMP_ITAV_get0_crls(const OSSL_CMP_ITAV *itav, STACK_OF(X509_CRL) **out);
OSSL_CMP_ITAV
*OSSL_CMP_ITAV_new0_certReqTemplate(OSSL_CRMF_CERTTEMPLATE *certTemplate,
OSSL_CMP_ATAVS *keySpec);
int OSSL_CMP_ITAV_get1_certReqTemplate(const OSSL_CMP_ITAV *itav,
OSSL_CRMF_CERTTEMPLATE **certTemplate,
OSSL_CMP_ATAVS **keySpec);
β¨ DESCRIPTION β¨
First thing's first: ITAV is short for InfoTypeAndValue. That's the whole lore. π
OSSL_CMP_ITAV_new_caCerts() makes you a fresh OSSL_CMP_ITAV structure of type caCerts, and it fills it with a copy of the certificate list you handed it. The caCerts argument can legitimately be NULL, and it can hold literally any number of certificates β so like, zero to a whole army, your choice, no judgment π«Ά.
OSSL_CMP_ITAV_get0_caCerts() is picky in the cutest way: it requires that itav has type caCerts. If there are no CA certificates inside itav, it assigns NULL to *out. Otherwise it hands you the internal pointer of type STACK_OF(X509) with the certificates that are present. (Internal pointer = borrow it, don't you dare free it, bestie.)
OSSL_CMP_ITAV_new_rootCaCert() creates a brand-new OSSL_CMP_ITAV structure of type rootCaCert that includes the optionally given certificate.
OSSL_CMP_ITAV_get0_rootCaCert() requires that itav has type rootCaCert. No certificate inside? It assigns NULL to *out. Otherwise you get the internal pointer to the certificate chillin' in the infoValue field.
OSSL_CMP_ITAV_new_rootCaKeyUpdate() creates a new OSSL_CMP_ITAV structure of type rootCaKeyUpdate, and it includes an RootCaKeyUpdateContent structure with the optional newWithNew, newWithOld, and oldWithNew certificates. Big important detail: that RootCaKeyUpdateContent structure gets included only if newWithNew is not NULL. Otherwise? Not included. Periodt.
OSSL_CMP_ITAV_get0_rootCaKeyUpdate() requires that itav has infoType rootCaKeyUpdate. If an update of a root CA certificate is included, then:
- it assigns to
*newWithNewthe internal pointer to the certificate contained in thenewWithNewinfoValuesub-field ofitav. - if
newWithOldis notNULL, it assigns to*newWithOldthe internal pointer to the certificate contained in thenewWithOldinfoValuesub-field ofitav. - if
oldWithNewis notNULL, it assigns to*oldWithNewthe internal pointer to the certificate contained in theoldWithNewinfoValuesub-field ofitav.
And here's the catch π« : each of those pointers gets set to NULL if no root CA certificate update is present or if the respective sub-field isn't included. So like, always check. fr fr.
OSSL_CMP_CRLSTATUS_new1() allocates a new OSSL_CMP_CRLSTATUS structure that contains either a copy of the distribution point name dpn or a copy of the certificate issuer issuer β and giving it both is an error, so pick a lane π. If you pass it, a copy of the CRL issuance time thisUpdate is also included.
OSSL_CMP_CRLSTATUS_create() is the high-level glow-up variant of OSSL_CMP_CRLSTATUS_new1(). Here's the tea β:
- It fills the
thisUpdatefield with a copy of thethisUpdatefield ofcrl, if present. - It fills the
CRLSourcefield with a copy of the first data item found using thecrland/orcertparameters, like this: any available distribution point name is preferred over issuer names. Data fromcert, if present, is preferred over data fromcrl.
If no distribution point names are available, candidate issuer names are taken from the following sources, as far as present:
- the list of distribution points in the first
cRLDistributionPointsextension ofcert, - the
issuerfield of the authority key identifier ofcert, - the issuer DN of
cert, - the
issuerfield of the authority key identifier ofcrl, and - the issuer DN of
crl.
If <only_DN> is set, a candidate issuer name of type GENERAL_NAMES is accepted only if it contains exactly one general name of type directoryName. Strict queen behavior π.
OSSL_CMP_CRLSTATUS_get0() reads the fields of crlstatus and assigns them to *dpn, *issuer, and *thisUpdate. Heads up: *thisUpdate is assigned only if the thisUpdate argument is not NULL. Depending on which choice is present, either *dpn or *issuer will be NULL. And *thisUpdate can also be NULL if the field just isn't present. So many NULLs, I know, keep up bestie π.
OSSL_CMP_ITAV_new0_crlStatusList() creates a new OSSL_CMP_ITAV structure of type crlStatusList that includes the optionally given list of CRL status data, each of which is of type OSSL_CMP_CRLSTATUS.
OSSL_CMP_ITAV_get0_crlStatusList() on success assigns to *out an internal pointer to the list of CRL status data in the infoValue field of itav. That pointer may be NULL if no CRL status data is included. And it is an error if the infoType of itav is not crlStatusList.
OSSL_CMP_ITAV_new_crls() creates a new OSSL_CMP_ITAV structure of type crls including an empty list of CRLs if the crl argument is NULL, or including a singleton list with a copy of the provided CRL otherwise. Cute. Simple. Slays.
OSSL_CMP_ITAV_get0_crls() on success assigns to *out an internal pointer to the list of CRLs contained in the infoValue field of itav. The pointer may be NULL if no CRL is included. And again: it is an error if the infoType of itav is not crls.
OSSL_CMP_ITAV_new0_certReqTemplate() creates an OSSL_CMP_ITAV structure of type certReqTemplate. If certTemplate is NULL then keySpec must also be NULL, and the resulting ITAV can be used in a genm message to obtain the requirements a PKI has on the certificate template used to request certificates, or in a genp message stating that there are no such requirements. Otherwise, the resulting ITAV includes a CertReqTemplateValue structure with certTemplate of type OSSL_CRMF_CERTTEMPLATE and an optional list of key specifications keySpec, each being of type OSSL_CMP_ATAV β and the resulting ATAV can be used in a genp message to provide requirements. Whew, main character energy all around π.
OSSL_CMP_ITAV_get1_certReqTemplate() requires that itav has type certReqTemplate. It assigns NULL to *certTemplate if no OSSL_CRMF_CERTTEMPLATE structure with a certificate template value is in itav, otherwise it gives you a copy of the certTemplate field value. If keySpec is not NULL, it is assigned NULL if the structure is not present in itav or the keySpec field is absent. Otherwise, the function checks that all elements of the keySpec field are of type algId or rsaKeyLen and assigns to *keySpec a copy of the keySpec field.
π NOTES π
CMP is defined in RFC 9810. That's the source material, bestie, go read it if you want the deep lore π¦.
π« RETURN VALUES π«
OSSL_CMP_ITAV_new_caCerts(), OSSL_CMP_ITAV_new_rootCaCert(), OSSL_CMP_ITAV_new_rootCaKeyUpdate(), OSSL_CMP_CRLSTATUS_new1(), OSSL_CMP_CRLSTATUS_create(), OSSL_CMP_ITAV_new0_crlStatusList(), OSSL_CMP_ITAV_new_crls() and OSSL_CMP_ITAV_new0_certReqTemplate() return a pointer to the new ITAV structure on success, or NULL on error. π«Ά
OSSL_CMP_ITAV_get0_caCerts(), OSSL_CMP_ITAV_get0_rootCaCert(), OSSL_CMP_ITAV_get0_rootCaKeyUpdate(), OSSL_CMP_CRLSTATUS_get0(), OSSL_CMP_ITAV_get0_crlStatusList(), OSSL_CMP_ITAV_get0_crls() and OSSL_CMP_ITAV_get1_certReqTemplate() return 1 on success, 0 on error. That's it, that's the dichotomy β¨.
π SEE ALSO π
OSSL_CMP_ITAV_create(3) and OSSL_CMP_ITAV_get0_type(3)
π§ HISTORY π§
OSSL_CMP_ITAV_new_caCerts(), OSSL_CMP_ITAV_get0_caCerts(), OSSL_CMP_ITAV_new_rootCaCert(), OSSL_CMP_ITAV_get0_rootCaCert(), OSSL_CMP_ITAV_new_rootCaKeyUpdate(), and OSSL_CMP_ITAV_get0_rootCaKeyUpdate() were added in OpenSSL 3.2. π
OSSL_CMP_CRLSTATUS_new1(), OSSL_CMP_CRLSTATUS_create(), OSSL_CMP_CRLSTATUS_get0(), OSSL_CMP_ITAV_new0_crlStatusList(), OSSL_CMP_ITAV_get0_crlStatusList(), OSSL_CMP_ITAV_new_crls(), OSSL_CMP_ITAV_get0_crls(), OSSL_CMP_ITAV_new0_certReqTemplate() and OSSL_CMP_ITAV_get1_certReqTemplate() were added in OpenSSL 3.4. Glow-up era π.
Β©οΈ COPYRIGHT Β©οΈ
Copyright 2022-2025 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>.
aaaaand that's the whole page, bestie π every flag, every pointer, every NULL, every error condition, preserved with love and sparkle. iykyk π
okay bye ily, this was OpenSSL 4.0.3, dated 2026-09-29, straight from the OSSL_CMP_ITAV_NEW_CACERTS(3SSL) manual. slay π
β¨
π¦ 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