ossl_cmp_msg_protect.pod 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. =pod
  2. =head1 NAME
  3. ossl_cmp_calc_protection,
  4. ossl_cmp_msg_protect,
  5. ossl_cmp_msg_add_extraCerts
  6. - functions for producing CMP message protection
  7. =head1 SYNOPSIS
  8. #include "cmp_local.h"
  9. ASN1_BIT_STRING *ossl_cmp_calc_protection(const OSSL_CMP_CTX *ctx,
  10. const OSSL_CMP_MSG *msg);
  11. int ossl_cmp_msg_protect(OSSL_CMP_CTX *ctx, OSSL_CMP_MSG *msg);
  12. int ossl_cmp_msg_add_extraCerts(OSSL_CMP_CTX *ctx, OSSL_CMP_MSG *msg);
  13. =head1 DESCRIPTION
  14. ossl_cmp_calc_protection() calculates the protection for the given I<msg>
  15. according to the algorithm and parameters in the message header's protectionAlg
  16. using the credentials, library context, and property criteria in the I<ctx>.
  17. ossl_cmp_msg_protect() (re-)protects the given message I<msg> using an algorithm
  18. depending on the available context information given in the I<ctx>.
  19. If there is a secretValue it selects PBMAC, else if there is a protection cert
  20. it selects Signature and uses L<ossl_cmp_msg_add_extraCerts(3)>.
  21. It also sets the protectionAlg field in the message header accordingly.
  22. ossl_cmp_msg_add_extraCerts() adds elements to the extraCerts field in I<msg>.
  23. If signature-based message protection is used it adds first the CMP signer cert
  24. ctx->cert and then its chain ctx->chain. If this chain is not present in I<ctx>
  25. tries to build it using ctx->untrusted and caches the result in ctx->chain.
  26. In any case all the certificates explicitly specified to be sent out (i.e.,
  27. I<ctx->extraCertsOut>) are added. Note that it will NOT add the root certificate
  28. of the chain, i.e, the trust anchor (unless it is part of extraCertsOut).
  29. =head1 NOTES
  30. CMP is defined in RFC 4210 (and CRMF in RFC 4211).
  31. =head1 RETURN VALUES
  32. ossl_cmp_calc_protection() returns the protection on success, else NULL.
  33. All other functions return 1 on success, 0 on error.
  34. =head1 HISTORY
  35. The OpenSSL CMP support was added in OpenSSL 3.0.
  36. =head1 COPYRIGHT
  37. Copyright 2007-2021 The OpenSSL Project Authors. All Rights Reserved.
  38. Licensed under the Apache License 2.0 (the "License"). You may not use
  39. this file except in compliance with the License. You can obtain a copy
  40. in the file LICENSE in the source distribution or at
  41. L<https://www.openssl.org/source/license.html>.
  42. =cut