OSSL_CMP_MSG_GET0_HEADER(3ossl)
π OSSL_CMP_MSG_GET0_HEADER β the 3ossl manual, but make it make sense π
okay bestie, gather round π«Ά this is the OpenSSL manual page for a whole lil squad of functions that manipulate CMP messages. yes, all ten of them. yes, we're doing all ten. slay.
β¨ NAME β¨
OSSL_CMP_MSG_get0_header, OSSL_CMP_MSG_get_bodytype, OSSL_CMP_MSG_get0_certreq_publickey, OSSL_CMP_MSG_update_transactionID, OSSL_CMP_MSG_update_recipNonce, OSSL_CMP_CTX_setup_CRM, OSSL_CMP_MSG_read, OSSL_CMP_MSG_write, d2i_OSSL_CMP_MSG_bio, i2d_OSSL_CMP_MSG_bio β literally just functions for manipulating CMP messages π
πΈ SYNOPSIS πΈ
#include <openssl/cmp.h>
OSSL_CMP_PKIHEADER *OSSL_CMP_MSG_get0_header(const OSSL_CMP_MSG *msg);
int OSSL_CMP_MSG_get_bodytype(const OSSL_CMP_MSG *msg);
X509_PUBKEY *OSSL_CMP_MSG_get0_certreq_publickey(const OSSL_CMP_MSG *msg);
int OSSL_CMP_MSG_update_transactionID(OSSL_CMP_CTX *ctx, OSSL_CMP_MSG *msg);
int OSSL_CMP_MSG_update_recipNonce(OSSL_CMP_CTX *ctx, OSSL_CMP_MSG *msg);
OSSL_CRMF_MSG *OSSL_CMP_CTX_setup_CRM(OSSL_CMP_CTX *ctx, int for_KUR, int rid);
OSSL_CMP_MSG *OSSL_CMP_MSG_read(const char *file, OSSL_LIB_CTX *libctx, const char *propq);
int OSSL_CMP_MSG_write(const char *file, const OSSL_CMP_MSG *msg);
OSSL_CMP_MSG *d2i_OSSL_CMP_MSG_bio(BIO *bio, OSSL_CMP_MSG **msg);
int i2d_OSSL_CMP_MSG_bio(BIO *bio, const OSSL_CMP_MSG *msg);
π¦ DESCRIPTION π¦
okay so, function by function, no cap:
OSSL_CMP_MSG_get0_header()β hands you back the header of the CMP message you passed in. that's it, that's the whole job πOSSL_CMP_MSG_get_bodytype()β gives you the body type of the given CMP message.OSSL_CMP_MSG_get0_certreq_publickey()β expectsmsgto be a certificate request message, and if there's a public key chilling in its certificate template, it returns that key. if not, no key, no drama πOSSL_CMP_MSG_update_transactionID()β updates thetransactionIDfield in the header of the given message, following whatever theCMP_CTXsays. and listen: ifctxdoesn't already have a transaction ID, a fresh one gets created first β¨. then the message gets re-protected β but only if protecting requests is required. iykyk.OSSL_CMP_MSG_update_recipNonce()β same energy, different field: it updates therecipNoncefield in the header of the given message according to theCMP_CTX. and yep, the message gets re-protected too (if protecting requests is required).OSSL_CMP_CTX_setup_CRM()β this one's the main character fr. it creates a CRMF certificate request message out of all the various info provided in the CMP context argumentctx, so it can go into a CMP request message based on the details contained inctx. theridargument defines the request identifier to use β and typically that's just0.
π the subject DN tea π
the subject DN that ends up in the certificate template is the first available</> value from this list, in order:
- any subject name in
ctxthat was set viaOSSL_CMP_CTX_set1_subjectName(3)β but lowkey if it's the NULL-DN (i.e., any empty sequence of RDNs), then no subject is included at all π - the subject field of any PKCS#10 CSR set in
ctxviaOSSL_CMP_CTX_set1_p10CSR(3) - the subject field of any reference certificate given in
ctx(seeOSSL_CMP_CTX_set1_oldCert(3)) β but only iffor_KURis nonzero, or ifctxdoesn't include a Subject Alternative Name
π§ the public key tea π§
and the public key that gets included? also the first available value from this list:
- the public key derived from any key set via
OSSL_CMP_CTX_set0_newPkey(3) - the public key of any PKCS#10 CSR given in
ctx - the public key of any reference certificate given in
ctx(seeOSSL_CMP_CTX_set1_oldCert(3)) - the public key derived from any client's private key set via
OSSL_CMP_CTX_set1_pkey(3)
π the extensions tea π
the set of X.509 extensions to include is computed like this, bestie, follow along:
- if a PKCS#10 CSR is present in
ctx, the default extensions are taken from there. otherwise, the empty set is the initial value. - if there's a reference certificate in
ctxand it contains Subject Alternative Names (SANs) andOSSL_CMP_OPT_SUBJECTALTNAME_NODEFAULTis not set, those SANs override any SANs from the PKCS#10 CSR. - the extensions are further augmented or overridden by any extensions with the same OIDs included in
ctxviaOSSL_CMP_CTX_set0_reqExtensions(3). - the SANs are further overridden by any SANs included in
ctxviaOSSL_CMP_CTX_push1_subjectAltName(3). - and finally, policies are overridden by any policies included in
ctxviaOSSL_CMP_CTX_push0_policy(3).
also, OSSL_CMP_CTX_setup_CRM() sets the regToken control oldCertID for KUR messages using the issuer name and serial number of the reference certificate β if present. periodt.
OSSL_CMP_MSG_read()β loads a DER-encodedOSSL_CMP_MSGfromfile.OSSL_CMP_MSG_write()β stores the givenOSSL_CMP_MSGtofilein DER encoding.d2i_OSSL_CMP_MSG_bio()β parses an ASN.1-encodedOSSL_CMP_MSGfrom the BIObio. and ifmsgis notNULL, it assigns a pointer to the new structure to*msgβ¨i2d_OSSL_CMP_MSG_bio()β writes theOSSL_CMP_MSGmsgin ASN.1 encoding to the BIObio.
π NOTES π
CMP is defined in RFC 9810. that's the vibe check, that's the source of truth π
π RETURN VALUES π
OSSL_CMP_MSG_get0_header()β returns the intended pointer value as described above, orNULLif the respective entry doesn't exist, and on error.OSSL_CMP_MSG_get_bodytype()β returns the body type, or-1on error.OSSL_CMP_MSG_get0_certreq_publickey()β returns a public key, orNULLon error.OSSL_CMP_CTX_setup_CRM()β returns a pointer to anOSSL_CRMF_MSGon success,NULLon error.d2i_OSSL_CMP_MSG_bio()β returns the parsed message, orNULLon error.OSSL_CMP_MSG_read()andd2i_OSSL_CMP_MSG_bio()β return the parsed CMP message, orNULLon error.OSSL_CMP_MSG_write()β returns the number of bytes successfully encoded, or a negative value if an error occurs.i2d_OSSL_CMP_MSG_bio(),OSSL_CMP_MSG_update_transactionID(), andOSSL_CMP_MSG_update_recipNonce()β return1on success,0on error.
π SEE ALSO π
OSSL_CMP_CTX_set1_subjectName(3), OSSL_CMP_CTX_set1_p10CSR(3), OSSL_CMP_CTX_set1_oldCert(3), OSSL_CMP_CTX_set0_newPkey(3), OSSL_CMP_CTX_set1_pkey(3), OSSL_CMP_CTX_set0_reqExtensions(3), OSSL_CMP_CTX_push1_subjectAltName(3), OSSL_CMP_CTX_push0_policy(3)
β HISTORY β
- the OpenSSL CMP support was added in OpenSSL 3.0.
OSSL_CMP_MSG_update_recipNonce()was added in OpenSSL 3.0.9.OSSL_CMP_MSG_get0_certreq_publickey()was added in OpenSSL 3.3.
π COPYRIGHT π
Copyright 2007-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>.
π«Ά that's the whole page, bestie. go forth and manipulate some CMP messages responsibly π β¨
and that's a wrap on the 3.5.9 version, dated 2026-09-29 β OpenSSL gang, we ate ππ
π¦ where this page comes from
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms