OSSL_CMP_VALIDATE_MSG(3ossl)

πŸ“¦
version 15.1 Β· 2 versions
, in freebsd 15.1

πŸ’… OSSL_CMP_VALIDATE_MSG β€” the ossl girlies' guide to CMP message protection πŸŽ€

okay bestie, so this page is from the ossl manual family, and it's literally all about OSSL_CMP_validate_msg and OSSL_CMP_validate_cert_path β€” the two functions that do the "wait, is this CMP message actually from who it says it is" vibe check. πŸ’–


✨ NAME ✨

OSSL_CMP_validate_msg, OSSL_CMP_validate_cert_path β€” the functions for verifying CMP message protection, no cap.


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <openssl/cmp.h>
int OSSL_CMP_validate_msg(OSSL_CMP_CTX *ctx, OSSL_CMP_MSG *msg);
int OSSL_CMP_validate_cert_path(const OSSL_CMP_CTX *ctx,
                                X509_STORE *trusted_store, X509 *cert);

🌸 DESCRIPTION 🌸

So this is the API for validating the protection of CMP messages β€” and that includes validating CMP message sender certificates and their paths, while optionally checking the revocation status of the certificate(s). iykyk, it's giving "trust but verify" main character energy. ✨

πŸ’œ OSSL_CMP_validate_msg() β€” the big one

OSSL_CMP_validate_msg() validates the protection of the given msg, which must be either signature-based or using password-based MAC (PBM). Fr fr, those are the only two options:

  • signature-based β†’ a suitable trust anchor must be given in the CMP context ctx
  • PBM β†’ the matching secret must have been set there using OSSL_CMP_CTX_set1_secretValue(3)

🧚 the signature-algorithm detective work

In the case of signature algorithm, the certificate used for the signature check is preferably the one provided by a call to OSSL_CMP_CTX_set1_srvCert(3). Slay, pinned and done.

If no such sender cert has been pinned, then candidate sender certificates get gathered up in this exact order:

  1. certificates received in the msg extraCerts
  2. then any certificates provided before via OSSL_CMP_CTX_set1_untrusted(3)
  3. then all trusted certificates provided via OSSL_CMP_CTX_set0_trusted(3)

And a candidate certificate is acceptable only if all of this is true:

  • it is currently valid (or the trust store contains a verification callback that overrides the verdict that the certificate is expired or not yet valid) πŸ™ˆ
  • its subject DN matches the msg sender DN (as far as present)
  • its subject key identifier is present and matches the senderKID (as far as the latter is present)

Then each acceptable cert is tried in the given order to see if the message signature check succeeds and the cert and its path can be verified using any trust store set via OSSL_CMP_CTX_set0_trusted(3). Obsessed with an orderly queue. πŸ’…

πŸ‘‘ the OSSL_CMP_OPT_PERMIT_TA_IN_EXTRACERTS_FOR_IR situation

Okay so if the option OSSL_CMP_OPT_PERMIT_TA_IN_EXTRACERTS_FOR_IR was set by calling OSSL_CMP_CTX_set_option(3), then for an Initialization Response (IP) message, any self-issued certificate from the msg extraCerts field may be used as a trust anchor for the path verification of an 'acceptable' cert β€” but only if it can be used also to validate the issued certificate returned in the IP message.

This is according to the TS 33.310 [Network Domain Security (NDS); Authentication Framework (AF)] document specified by The 3rd Generation Partnership Project (3GPP). 🫢

⚠️ NOTE THAT USING THIS OPTION IS DANGEROUS β€” the certificate obtained this way has not been authenticated (at least not at CMP level). Taking it over as a trust anchor implements trust-on-first-use (TOFU). Like, literally TOFU. πŸ“ proceed with awareness.

πŸŽ€ caching, because we're efficient

Any cert that has been found as described above is cached and tried first when validating the signatures of subsequent messages in the same transaction. iconic behavior honestly.

πŸ’– OSSL_CMP_validate_cert_path() β€” the path checker

OSSL_CMP_validate_cert_path() attempts to validate the given cert and its path using:

  • the given store of trusted certs (trusted_store, possibly including CRLs and a cert verification callback)
  • non-trusted intermediate certs from the ctx

πŸ“ NOTES πŸ“

CMP is defined in RFC 9810. periodt. ⭐


🌈 RETURN VALUES 🌈

OSSL_CMP_validate_msg() and OSSL_CMP_validate_cert_path() return 1 on success, 0 on error or validation failed. Simple. Binary. We love a boolean moment. πŸ’€


🫢 SEE ALSO 🫢


πŸ‘‘ HISTORY πŸ‘‘

The OpenSSL CMP support was added in OpenSSL 3.0. a whole era. ✨


Copyright 2007-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>.


πŸŽ€ and that's the page bestie!! this one shipped as part of 3.5.6, dated 2026-04-07, and it lives in the OSSL_CMP_VALIDATE_MSG(3ossl) manual β€” go verify some message protection, you've got this πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from