1*4724848cSchristos=pod 2*4724848cSchristos 3*4724848cSchristos=head1 NAME 4*4724848cSchristos 5*4724848cSchristosSMIME_read_PKCS7 - parse S/MIME message 6*4724848cSchristos 7*4724848cSchristos=head1 SYNOPSIS 8*4724848cSchristos 9*4724848cSchristos #include <openssl/pkcs7.h> 10*4724848cSchristos 11*4724848cSchristos PKCS7 *SMIME_read_PKCS7(BIO *in, BIO **bcont); 12*4724848cSchristos 13*4724848cSchristos=head1 DESCRIPTION 14*4724848cSchristos 15*4724848cSchristosSMIME_read_PKCS7() parses a message in S/MIME format. 16*4724848cSchristos 17*4724848cSchristosB<in> is a BIO to read the message from. 18*4724848cSchristos 19*4724848cSchristosIf cleartext signing is used then the content is saved in 20*4724848cSchristosa memory bio which is written to B<*bcont>, otherwise 21*4724848cSchristosB<*bcont> is set to B<NULL>. 22*4724848cSchristos 23*4724848cSchristosThe parsed PKCS#7 structure is returned or B<NULL> if an 24*4724848cSchristoserror occurred. 25*4724848cSchristos 26*4724848cSchristos=head1 NOTES 27*4724848cSchristos 28*4724848cSchristosIf B<*bcont> is not B<NULL> then the message is clear text 29*4724848cSchristossigned. B<*bcont> can then be passed to PKCS7_verify() with 30*4724848cSchristosthe B<PKCS7_DETACHED> flag set. 31*4724848cSchristos 32*4724848cSchristosOtherwise the type of the returned structure can be determined 33*4724848cSchristosusing PKCS7_type_is_enveloped(), etc. 34*4724848cSchristos 35*4724848cSchristosTo support future functionality if B<bcont> is not B<NULL> 36*4724848cSchristosB<*bcont> should be initialized to B<NULL>. For example: 37*4724848cSchristos 38*4724848cSchristos BIO *cont = NULL; 39*4724848cSchristos PKCS7 *p7; 40*4724848cSchristos 41*4724848cSchristos p7 = SMIME_read_PKCS7(in, &cont); 42*4724848cSchristos 43*4724848cSchristos=head1 BUGS 44*4724848cSchristos 45*4724848cSchristosThe MIME parser used by SMIME_read_PKCS7() is somewhat primitive. 46*4724848cSchristosWhile it will handle most S/MIME messages more complex compound 47*4724848cSchristosformats may not work. 48*4724848cSchristos 49*4724848cSchristosThe parser assumes that the PKCS7 structure is always base64 50*4724848cSchristosencoded and will not handle the case where it is in binary format 51*4724848cSchristosor uses quoted printable format. 52*4724848cSchristos 53*4724848cSchristosThe use of a memory BIO to hold the signed content limits the size 54*4724848cSchristosof message which can be processed due to memory restraints: a 55*4724848cSchristosstreaming single pass option should be available. 56*4724848cSchristos 57*4724848cSchristos=head1 RETURN VALUES 58*4724848cSchristos 59*4724848cSchristosSMIME_read_PKCS7() returns a valid B<PKCS7> structure or B<NULL> 60*4724848cSchristosif an error occurred. The error can be obtained from ERR_get_error(3). 61*4724848cSchristos 62*4724848cSchristos=head1 SEE ALSO 63*4724848cSchristos 64*4724848cSchristosL<ERR_get_error(3)>, 65*4724848cSchristosL<SMIME_read_PKCS7(3)>, L<PKCS7_sign(3)>, 66*4724848cSchristosL<PKCS7_verify(3)>, L<PKCS7_encrypt(3)> 67*4724848cSchristosL<PKCS7_decrypt(3)> 68*4724848cSchristos 69*4724848cSchristos=head1 COPYRIGHT 70*4724848cSchristos 71*4724848cSchristosCopyright 2002-2018 The OpenSSL Project Authors. All Rights Reserved. 72*4724848cSchristos 73*4724848cSchristosLicensed under the OpenSSL license (the "License"). You may not use 74*4724848cSchristosthis file except in compliance with the License. You can obtain a copy 75*4724848cSchristosin the file LICENSE in the source distribution or at 76*4724848cSchristosL<https://www.openssl.org/source/license.html>. 77*4724848cSchristos 78*4724848cSchristos=cut 79