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