OSSL_CMP_validate_msg.pod 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. =pod
  2. =head1 NAME
  3. OSSL_CMP_validate_msg,
  4. OSSL_CMP_validate_cert_path
  5. - functions for verifying CMP message protection
  6. =head1 SYNOPSIS
  7. #include <openssl/cmp.h>
  8. int OSSL_CMP_validate_msg(OSSL_CMP_CTX *ctx, OSSL_CMP_MSG *msg);
  9. int OSSL_CMP_validate_cert_path(const OSSL_CMP_CTX *ctx,
  10. X509_STORE *trusted_store, X509 *cert);
  11. =head1 DESCRIPTION
  12. This is the API for validating the protection of CMP messages,
  13. which includes validating CMP message sender certificates and their paths
  14. while optionally checking the revocation status of the certificates(s).
  15. OSSL_CMP_validate_msg() validates the protection of the given I<msg>,
  16. which must be signature-based or using password-based MAC (PBM).
  17. In the former case a suitable trust anchor must be given in the CMP context
  18. I<ctx>, and in the latter case the matching secret must have been set there
  19. using L<OSSL_CMP_CTX_set1_secretValue(3)>.
  20. In case of signature algorithm, the certificate to use for the signature check
  21. is preferably the one provided by a call to L<OSSL_CMP_CTX_set1_srvCert(3)>.
  22. If no such sender cert has been pinned then candidate sender certificates are
  23. taken from the list of certificates received in the I<msg> extraCerts, then any
  24. certificates provided before via L<OSSL_CMP_CTX_set1_untrusted(3)>, and
  25. then all trusted certificates provided via L<OSSL_CMP_CTX_set0_trusted(3)>.
  26. A candidate certificate is acceptable only if it is currently valid
  27. (or the trust store contains a verification callback that overrides the verdict
  28. that the certificate is expired or not yet valid), its subject DN matches
  29. the I<msg> sender DN (as far as present), and its subject key identifier
  30. is present and matches the senderKID (as far as the latter is present).
  31. Each acceptable cert is tried in the given order to see if the message
  32. signature check succeeds and the cert and its path can be verified
  33. using any trust store set via L<OSSL_CMP_CTX_set0_trusted(3)>.
  34. If the option OSSL_CMP_OPT_PERMIT_TA_IN_EXTRACERTS_FOR_IR was set by calling
  35. L<OSSL_CMP_CTX_set_option(3)>, for an Initialization Response (IP) message
  36. any self-issued certificate from the I<msg> extraCerts field may also be used
  37. as trust anchor for the path verification of an acceptable cert if it can be
  38. used also to validate the issued certificate returned in the IP message. This is
  39. according to TS 33.310 [Network Domain Security (NDS); Authentication Framework
  40. (AF)] document specified by the The 3rd Generation Partnership Project (3GPP).
  41. Any cert that has been found as described above is cached and tried first when
  42. validating the signatures of subsequent messages in the same transaction.
  43. OSSL_CMP_validate_cert_path() attempts to validate the given certificate and its
  44. path using the given store of trusted certs (possibly including CRLs and a cert
  45. verification callback) and non-trusted intermediate certs from the I<ctx>.
  46. =head1 NOTES
  47. CMP is defined in RFC 4210 (and CRMF in RFC 4211).
  48. =head1 RETURN VALUES
  49. OSSL_CMP_validate_msg() and OSSL_CMP_validate_cert_path()
  50. return 1 on success, 0 on error or validation failed.
  51. =head1 SEE ALSO
  52. L<OSSL_CMP_CTX_new(3)>, L<OSSL_CMP_exec_certreq(3)>,
  53. L<OSSL_CMP_CTX_set1_secretValue(3)>, L<OSSL_CMP_CTX_set1_srvCert(3)>,
  54. L<OSSL_CMP_CTX_set1_untrusted(3)>, L<OSSL_CMP_CTX_set0_trusted(3)>
  55. =head1 HISTORY
  56. The OpenSSL CMP support was added in OpenSSL 3.0.
  57. =head1 COPYRIGHT
  58. Copyright 2007-2023 The OpenSSL Project Authors. All Rights Reserved.
  59. Licensed under the Apache License 2.0 (the "License"). You may not use
  60. this file except in compliance with the License. You can obtain a copy
  61. in the file LICENSE in the source distribution or at
  62. L<https://www.openssl.org/source/license.html>.
  63. =cut