2
0

SMIME_read_PKCS7.pod 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. =pod
  2. =head1 NAME
  3. SMIME_read_PKCS7_ex, SMIME_read_PKCS7 - parse S/MIME message
  4. =head1 SYNOPSIS
  5. #include <openssl/pkcs7.h>
  6. PKCS7 *SMIME_read_PKCS7_ex(BIO *bio, BIO **bcont, PKCS7 **p7);
  7. PKCS7 *SMIME_read_PKCS7(BIO *in, BIO **bcont);
  8. =head1 DESCRIPTION
  9. SMIME_read_PKCS7() parses a message in S/MIME format.
  10. B<in> is a BIO to read the message from.
  11. If cleartext signing is used then the content is saved in
  12. a memory bio which is written to B<*bcont>, otherwise
  13. B<*bcont> is set to B<NULL>.
  14. The parsed PKCS#7 structure is returned or B<NULL> if an
  15. error occurred.
  16. SMIME_read_PKCS7_ex() is similar to SMIME_read_PKCS7() but can optionally supply
  17. a previously created I<p7> PKCS#7 object. If I<p7> is NULL then it is identical
  18. to SMIME_read_PKCS7().
  19. To create a I<p7> object use L<PKCS7_new_ex(3)>.
  20. =head1 NOTES
  21. If B<*bcont> is not B<NULL> then the message is clear text
  22. signed. B<*bcont> can then be passed to PKCS7_verify() with
  23. the B<PKCS7_DETACHED> flag set.
  24. Otherwise the type of the returned structure can be determined
  25. using PKCS7_type_is_enveloped(), etc.
  26. To support future functionality if B<bcont> is not B<NULL>
  27. B<*bcont> should be initialized to B<NULL>. For example:
  28. BIO *cont = NULL;
  29. PKCS7 *p7;
  30. p7 = SMIME_read_PKCS7(in, &cont);
  31. =head1 BUGS
  32. The MIME parser used by SMIME_read_PKCS7() is somewhat primitive.
  33. While it will handle most S/MIME messages more complex compound
  34. formats may not work.
  35. The parser assumes that the PKCS7 structure is always base64
  36. encoded and will not handle the case where it is in binary format
  37. or uses quoted printable format.
  38. The use of a memory BIO to hold the signed content limits the size
  39. of message which can be processed due to memory restraints: a
  40. streaming single pass option should be available.
  41. =head1 RETURN VALUES
  42. SMIME_read_PKCS7_ex() and SMIME_read_PKCS7() return a valid B<PKCS7> structure
  43. or B<NULL> if an error occurred. The error can be obtained from ERR_get_error(3).
  44. =head1 SEE ALSO
  45. L<ERR_get_error(3)>,
  46. L<SMIME_read_PKCS7(3)>, L<PKCS7_sign(3)>,
  47. L<PKCS7_verify(3)>, L<PKCS7_encrypt(3)>
  48. L<PKCS7_decrypt(3)>
  49. =head1 HISTORY
  50. The function SMIME_read_PKCS7_ex() was added in OpenSSL 3.0.
  51. =head1 COPYRIGHT
  52. Copyright 2002-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