1SMIME_READ_PKCS7(3ossl)             OpenSSL            SMIME_READ_PKCS7(3ossl)
2
3
4

NAME

6       SMIME_read_PKCS7_ex, SMIME_read_PKCS7 - parse S/MIME message
7

SYNOPSIS

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

DESCRIPTION

15       SMIME_read_PKCS7() parses a message in S/MIME format.
16
17       in is a BIO to read the message from.
18
19       If cleartext signing is used then the content is saved in a memory bio
20       which is written to *bcont, otherwise *bcont is set to NULL.
21
22       The parsed PKCS#7 structure is returned or NULL if an error occurred.
23
24       SMIME_read_PKCS7_ex() is similar to SMIME_read_PKCS7() but can
25       optionally supply a previously created p7 PKCS#7 object. If p7 is NULL
26       then it is identical to SMIME_read_PKCS7().  To create a p7 object use
27       PKCS7_new_ex(3).
28

NOTES

30       If *bcont is not NULL then the message is clear text signed. *bcont can
31       then be passed to PKCS7_verify() with the PKCS7_DETACHED flag set.
32
33       Otherwise the type of the returned structure can be determined using
34       PKCS7_type_is_enveloped(), etc.
35
36       To support future functionality if bcont is not NULL *bcont should be
37       initialized to NULL. For example:
38
39        BIO *cont = NULL;
40        PKCS7 *p7;
41
42        p7 = SMIME_read_PKCS7(in, &cont);
43

BUGS

45       The MIME parser used by SMIME_read_PKCS7() is somewhat primitive.
46       While it will handle most S/MIME messages more complex compound formats
47       may not work.
48
49       The parser assumes that the PKCS7 structure is always base64 encoded
50       and will not handle the case where it is in binary format or uses
51       quoted printable format.
52
53       The use of a memory BIO to hold the signed content limits the size of
54       message which can be processed due to memory restraints: a streaming
55       single pass option should be available.
56

RETURN VALUES

58       SMIME_read_PKCS7_ex() and SMIME_read_PKCS7() return a valid PKCS7
59       structure or NULL if an error occurred. The error can be obtained from
60       ERR_get_error(3).
61

SEE ALSO

63       ERR_get_error(3), SMIME_read_PKCS7(3), PKCS7_sign(3), PKCS7_verify(3),
64       PKCS7_encrypt(3) PKCS7_decrypt(3)
65

HISTORY

67       The function SMIME_read_PKCS7_ex() was added in OpenSSL 3.0.
68
70       Copyright 2002-2020 The OpenSSL Project Authors. All Rights Reserved.
71
72       Licensed under the Apache License 2.0 (the "License").  You may not use
73       this file except in compliance with the License.  You can obtain a copy
74       in the file LICENSE in the source distribution or at
75       <https://www.openssl.org/source/license.html>.
76
77
78
793.0.5                             2022-11-01           SMIME_READ_PKCS7(3ossl)
Impressum