OSSL_CMP_MSG_GET0_HEADER(3SSL)
π OSSL_CMP_MSG_get0_header(3SSL) β bestie, let's talk CMP messages π
okay so this is the manual page for a whole lil squad of functions that manipulate CMP messages β that's Certificate Management Protocol, iykyk. We're in OpenSSL land, and this is the 3SSL manual. Grab a boba, we're going in. π§β¨
πΈ NAME πΈ
Meet the cast π β these are the function(s) manipulating CMP messages:
OSSL_CMP_MSG_get0_headerOSSL_CMP_MSG_get_bodytypeOSSL_CMP_MSG_get0_certreq_publickeyOSSL_CMP_MSG_update_transactionIDOSSL_CMP_MSG_update_recipNonceOSSL_CMP_CTX_setup_CRMOSSL_CMP_MSG_readOSSL_CMP_MSG_writed2i_OSSL_CMP_MSG_bioi2d_OSSL_CMP_MSG_bio
β¨ SYNOPSIS β¨
lowkey just include the header and you're set:
#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 bestie, function by function, no skips:
OSSL_CMP_MSG_get0_header()β hands you the header of the given CMP message. that's it, that's the vibe. πOSSL_CMP_MSG_get_bodytype()β tells you the body type of the given CMP message.OSSL_CMP_MSG_get0_certreq_publickey()β expects thatmsgis a certificate request message and returns the public key in its certificate template, if it's there.OSSL_CMP_MSG_update_transactionID()β updates thetransactionIDfield in the header of the given message according to theCMP_CTX. Ifctxdoes not contain a transaction ID, a fresh one is created before. The message gets re-protected (if protecting requests is required).OSSL_CMP_MSG_update_recipNonce()β updates therecipNoncefield in the header of the given message according to theCMP_CTX. The message gets re-protected (if protecting requests is required).
π« OSSL_CMP_CTX_setup_CRM() β the main character π«
It creates a CRMF certificate request message from various information provided in the CMP context argument ctx, for inclusion in a CMP request message based on details contained in ctx. The rid argument defines the request identifier to use, which typically is 0.
π The subject DN in the certificate template
It's the first available value of these, in order:
- any subject name in
ctxset viaOSSL_CMP_CTX_set1_subjectName(3)β but if it's the NULL-DN (i.e., any empty sequence of RDNs), no subject is included, - 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 thectxdoes not include a Subject Alternative Name.
π The public key included
Also the first available value of these:
- 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 set of X.509 extensions
Computed like this, periodt:
If a PKCS#10 CSR is present in ctx, default extensions are taken from there; otherwise the empty set is taken as the initial value. If there is a reference certificate in ctx and it contains Subject Alternative Names (SANs) and OSSL_CMP_OPT_SUBJECTALTNAME_NODEFAULT is 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 the ctx via OSSL_CMP_CTX_set0_reqExtensions(3). The SANs are further overridden by any SANs included in ctx via OSSL_CMP_CTX_push1_subjectAltName(3). Finally, policies are overridden by any policies included in ctx via OSSL_CMP_CTX_push0_policy(3).
also,OSSL_CMP_CTX_setup_CRM()sets the regToken controloldCertIDfor KUR messages using the issuer name and serial number of the reference certificate, if present. π
π The file + BIO girlies π
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. It assigns a pointer to the new structure to*msgifmsgis not NULL.i2d_OSSL_CMP_MSG_bio()β writes theOSSL_CMP_MSGmsgin ASN.1 encoding to BIObio.
π NOTES π
CMP is defined in RFC 9810. (yes, the whole thing. iconic.) π
π₯ RETURN VALUES π₯
OSSL_CMP_MSG_get0_header()returns the intended pointer value as described above, orNULLif the respective entry does not 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 π«Ά
the whole friend group, all linked up:
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 lore)
- 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>.
and that's a wrap bestie π this was page OSSL_CMP_MSG_GET0_HEADER(3SSL) from OpenSSL, version 4.0.3, dated 2026-09-29 β go forth and encode responsibly, ily π«Άβ¨π
π¦ 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