CMS_final.pod 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. =pod
  2. =head1 NAME
  3. CMS_final, CMS_final_digest - finalise a CMS_ContentInfo structure
  4. =head1 SYNOPSIS
  5. #include <openssl/cms.h>
  6. int CMS_final(CMS_ContentInfo *cms, BIO *data, BIO *dcont, unsigned int flags);
  7. int CMS_final_digest(CMS_ContentInfo *cms, const unsigned char *md,
  8. unsigned int mdlen, BIO *dcont, unsigned int flags);
  9. =head1 DESCRIPTION
  10. CMS_final() finalises the structure B<cms>. Its purpose is to perform any
  11. operations necessary on B<cms> (digest computation for example) and set the
  12. appropriate fields. The parameter B<data> contains the content to be
  13. processed. The B<dcont> parameter contains a BIO to write content to after
  14. processing: this is only used with detached data and will usually be set to
  15. NULL.
  16. CMS_final_digest() finalises the structure B<cms> using a pre-computed digest,
  17. rather than computing the digest from the original data.
  18. =head1 NOTES
  19. These functions will normally be called when the B<CMS_PARTIAL> flag is used. It
  20. should only be used when streaming is not performed because the streaming
  21. I/O functions perform finalisation operations internally.
  22. To sign a pre-computed digest, L<CMS_sign(3)> or CMS_sign_ex() is called
  23. with the B<data> parameter set to NULL before the CMS structure is finalised
  24. with the digest provided to CMS_final_digest() in binary form.
  25. When signing a pre-computed digest, the security relies on the digest and its
  26. computation from the original message being trusted.
  27. =head1 RETURN VALUES
  28. CMS_final() and CMS_final_digest() return 1 for success or 0 for failure.
  29. =head1 SEE ALSO
  30. L<ERR_get_error(3)>, L<CMS_sign(3)>,
  31. L<CMS_encrypt(3)>
  32. =head1 HISTORY
  33. CMS_final_digest() was added in OpenSSL 3.2.
  34. =head1 COPYRIGHT
  35. Copyright 2008-2022 The OpenSSL Project Authors. All Rights Reserved.
  36. Licensed under the Apache License 2.0 (the "License"). You may not use
  37. this file except in compliance with the License. You can obtain a copy
  38. in the file LICENSE in the source distribution or at
  39. L<https://www.openssl.org/source/license.html>.
  40. =cut