1SMIME_READ_CMS(3ossl) OpenSSL SMIME_READ_CMS(3ossl)
2
3
4
6 SMIME_read_CMS_ex, SMIME_read_CMS - parse S/MIME message
7
9 #include <openssl/cms.h>
10
11 CMS_ContentInfo *SMIME_read_CMS_ex(BIO *bio, int flags, BIO **bcont,
12 CMS_ContentInfo **cms);
13 CMS_ContentInfo *SMIME_read_CMS(BIO *in, BIO **bcont);
14
16 SMIME_read_CMS() parses a message in S/MIME format.
17
18 in is a BIO to read the message from.
19
20 If cleartext signing is used then the content is saved in a memory bio
21 which is written to *bcont, otherwise *bcont is set to NULL.
22
23 The parsed CMS_ContentInfo structure is returned or NULL if an error
24 occurred.
25
26 SMIME_read_CMS_ex() is similar to SMIME_read_CMS() but optionally a
27 previously created cms CMS_ContentInfo object can be supplied as well
28 as some flags. To create a cms object use CMS_ContentInfo_new_ex(3).
29 If the flags argument contains CMS_BINARY then the input is assumed to
30 be in binary format and is not translated to canonical form. If in
31 addition SMIME_ASCIICRLF is set then the binary input is assumed to be
32 followed by CR and LF characters, else only by an LF character. If
33 flags is 0 and cms is NULL then it is identical to SMIME_read_CMS().
34
36 If *bcont is not NULL then the message is clear text signed. *bcont can
37 then be passed to CMS_verify() with the CMS_DETACHED flag set.
38
39 Otherwise the type of the returned structure can be determined using
40 CMS_get0_type().
41
42 To support future functionality if bcont is not NULL *bcont should be
43 initialized to NULL. For example:
44
45 BIO *cont = NULL;
46 CMS_ContentInfo *cms;
47
48 cms = SMIME_read_CMS(in, &cont);
49
51 The MIME parser used by SMIME_read_CMS() is somewhat primitive. While
52 it will handle most S/MIME messages more complex compound formats may
53 not work.
54
55 The parser assumes that the CMS_ContentInfo structure is always base64
56 encoded and will not handle the case where it is in binary format or
57 uses quoted printable format.
58
59 The use of a memory BIO to hold the signed content limits the size of
60 message which can be processed due to memory restraints: a streaming
61 single pass option should be available.
62
64 SMIME_read_CMS_ex() and SMIME_read_CMS() return a valid CMS_ContentInfo
65 structure or NULL if an error occurred. The error can be obtained from
66 ERR_get_error(3).
67
69 ERR_get_error(3), CMS_sign(3), CMS_verify(3), CMS_encrypt(3),
70 CMS_decrypt(3)
71
73 The function SMIME_read_CMS_ex() was added in OpenSSL 3.0.
74
76 Copyright 2008-2021 The OpenSSL Project Authors. All Rights Reserved.
77
78 Licensed under the Apache License 2.0 (the "License"). You may not use
79 this file except in compliance with the License. You can obtain a copy
80 in the file LICENSE in the source distribution or at
81 <https://www.openssl.org/source/license.html>.
82
83
84
853.0.5 2022-11-01 SMIME_READ_CMS(3ossl)