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