1 1.1 christos =pod 2 1.1 christos 3 1.1 christos =head1 NAME 4 1.1 christos 5 1.1.1.2 christos SMIME_read_PKCS7_ex, SMIME_read_PKCS7 - parse S/MIME message 6 1.1 christos 7 1.1 christos =head1 SYNOPSIS 8 1.1 christos 9 1.1 christos #include <openssl/pkcs7.h> 10 1.1 christos 11 1.1.1.2 christos PKCS7 *SMIME_read_PKCS7_ex(BIO *bio, BIO **bcont, PKCS7 **p7); 12 1.1 christos PKCS7 *SMIME_read_PKCS7(BIO *in, BIO **bcont); 13 1.1 christos 14 1.1 christos =head1 DESCRIPTION 15 1.1 christos 16 1.1 christos SMIME_read_PKCS7() parses a message in S/MIME format. 17 1.1 christos 18 1.1 christos B<in> is a BIO to read the message from. 19 1.1 christos 20 1.1 christos If cleartext signing is used then the content is saved in 21 1.1 christos a memory bio which is written to B<*bcont>, otherwise 22 1.1 christos B<*bcont> is set to B<NULL>. 23 1.1 christos 24 1.1 christos The parsed PKCS#7 structure is returned or B<NULL> if an 25 1.1 christos error occurred. 26 1.1 christos 27 1.1.1.2 christos SMIME_read_PKCS7_ex() is similar to SMIME_read_PKCS7() but can optionally supply 28 1.1.1.2 christos a previously created I<p7> PKCS#7 object. If I<p7> is NULL then it is identical 29 1.1.1.2 christos to SMIME_read_PKCS7(). 30 1.1.1.2 christos To create a I<p7> object use L<PKCS7_new_ex(3)>. 31 1.1.1.2 christos 32 1.1 christos =head1 NOTES 33 1.1 christos 34 1.1 christos If B<*bcont> is not B<NULL> then the message is clear text 35 1.1 christos signed. B<*bcont> can then be passed to PKCS7_verify() with 36 1.1 christos the B<PKCS7_DETACHED> flag set. 37 1.1 christos 38 1.1 christos Otherwise the type of the returned structure can be determined 39 1.1 christos using PKCS7_type_is_enveloped(), etc. 40 1.1 christos 41 1.1 christos To support future functionality if B<bcont> is not B<NULL> 42 1.1 christos B<*bcont> should be initialized to B<NULL>. For example: 43 1.1 christos 44 1.1 christos BIO *cont = NULL; 45 1.1 christos PKCS7 *p7; 46 1.1 christos 47 1.1 christos p7 = SMIME_read_PKCS7(in, &cont); 48 1.1 christos 49 1.1 christos =head1 BUGS 50 1.1 christos 51 1.1 christos The MIME parser used by SMIME_read_PKCS7() is somewhat primitive. 52 1.1 christos While it will handle most S/MIME messages more complex compound 53 1.1 christos formats may not work. 54 1.1 christos 55 1.1 christos The parser assumes that the PKCS7 structure is always base64 56 1.1 christos encoded and will not handle the case where it is in binary format 57 1.1 christos or uses quoted printable format. 58 1.1 christos 59 1.1 christos The use of a memory BIO to hold the signed content limits the size 60 1.1 christos of message which can be processed due to memory restraints: a 61 1.1 christos streaming single pass option should be available. 62 1.1 christos 63 1.1 christos =head1 RETURN VALUES 64 1.1 christos 65 1.1.1.2 christos SMIME_read_PKCS7_ex() and SMIME_read_PKCS7() return a valid B<PKCS7> structure 66 1.1.1.2 christos or B<NULL> if an error occurred. The error can be obtained from ERR_get_error(3). 67 1.1 christos 68 1.1 christos =head1 SEE ALSO 69 1.1 christos 70 1.1 christos L<ERR_get_error(3)>, 71 1.1 christos L<SMIME_read_PKCS7(3)>, L<PKCS7_sign(3)>, 72 1.1 christos L<PKCS7_verify(3)>, L<PKCS7_encrypt(3)> 73 1.1 christos L<PKCS7_decrypt(3)> 74 1.1 christos 75 1.1.1.2 christos =head1 HISTORY 76 1.1.1.2 christos 77 1.1.1.2 christos The function SMIME_read_PKCS7_ex() was added in OpenSSL 3.0. 78 1.1.1.2 christos 79 1.1 christos =head1 COPYRIGHT 80 1.1 christos 81 1.1.1.2 christos Copyright 2002-2020 The OpenSSL Project Authors. All Rights Reserved. 82 1.1 christos 83 1.1.1.2 christos Licensed under the Apache License 2.0 (the "License"). You may not use 84 1.1 christos this file except in compliance with the License. You can obtain a copy 85 1.1 christos in the file LICENSE in the source distribution or at 86 1.1 christos L<https://www.openssl.org/source/license.html>. 87 1.1 christos 88 1.1 christos =cut 89