SMIME_read_CMS.pod 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. =pod
  2. =head1 NAME
  3. SMIME_read_CMS_ex, SMIME_read_CMS - parse S/MIME message
  4. =head1 SYNOPSIS
  5. #include <openssl/cms.h>
  6. CMS_ContentInfo *SMIME_read_CMS_ex(BIO *bio, BIO **bcont,
  7. CMS_ContentInfo **cms);
  8. CMS_ContentInfo *SMIME_read_CMS(BIO *in, BIO **bcont);
  9. =head1 DESCRIPTION
  10. SMIME_read_CMS() parses a message in S/MIME format.
  11. B<in> is a BIO to read the message from.
  12. If cleartext signing is used then the content is saved in a memory bio which is
  13. written to B<*bcont>, otherwise B<*bcont> is set to NULL.
  14. The parsed CMS_ContentInfo structure is returned or NULL if an
  15. error occurred.
  16. SMIME_read_CMS_ex() is similar to SMIME_read_CMS() but can optionally supply a
  17. previously created I<cms> CMS_ContentInfo object. If I<cms> is NULL then it is
  18. identical to SMIME_read_CMS().
  19. To create a I<cms> object use L<CMS_ContentInfo_new_ex(3)>.
  20. =head1 NOTES
  21. If B<*bcont> is not NULL then the message is clear text signed. B<*bcont> can
  22. then be passed to CMS_verify() with the B<CMS_DETACHED> flag set.
  23. Otherwise the type of the returned structure can be determined
  24. using CMS_get0_type().
  25. To support future functionality if B<bcont> is not NULL B<*bcont> should be
  26. initialized to NULL. For example:
  27. BIO *cont = NULL;
  28. CMS_ContentInfo *cms;
  29. cms = SMIME_read_CMS(in, &cont);
  30. =head1 BUGS
  31. The MIME parser used by SMIME_read_CMS() is somewhat primitive. While it will
  32. handle most S/MIME messages more complex compound formats may not work.
  33. The parser assumes that the CMS_ContentInfo structure is always base64 encoded
  34. and will not handle the case where it is in binary format or uses quoted
  35. printable format.
  36. The use of a memory BIO to hold the signed content limits the size of message
  37. which can be processed due to memory restraints: a streaming single pass option
  38. should be available.
  39. =head1 RETURN VALUES
  40. SMIME_read_CMS_ex() and SMIME_read_CMS() return a valid B<CMS_ContentInfo>
  41. structure or B<NULL> if an error occurred. The error can be obtained from
  42. ERR_get_error(3).
  43. =head1 SEE ALSO
  44. L<ERR_get_error(3)>,
  45. L<CMS_sign(3)>,
  46. L<CMS_verify(3)>,
  47. L<CMS_encrypt(3)>,
  48. L<CMS_decrypt(3)>
  49. =head1 HISTORY
  50. The function SMIME_read_CMS_ex() was added in OpenSSL 3.0.
  51. =head1 COPYRIGHT
  52. Copyright 2008-2020 The OpenSSL Project Authors. All Rights Reserved.
  53. Licensed under the Apache License 2.0 (the "License"). You may not use
  54. this file except in compliance with the License. You can obtain a copy
  55. in the file LICENSE in the source distribution or at
  56. L<https://www.openssl.org/source/license.html>.
  57. =cut