| 1 |
.\" -*- mode: troff; coding: utf-8 -*- |
| 2 |
.\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45) |
| 3 |
.\" |
| 4 |
.\" Standard preamble: |
| 5 |
.\" ======================================================================== |
| 6 |
.de Sp \" Vertical space (when we can't use .PP) |
| 7 |
.if t .sp .5v |
| 8 |
.if n .sp |
| 9 |
.. |
| 10 |
.de Vb \" Begin verbatim text |
| 11 |
.ft CW |
| 12 |
.nf |
| 13 |
.ne \\$1 |
| 14 |
.. |
| 15 |
.de Ve \" End verbatim text |
| 16 |
.ft R |
| 17 |
.fi |
| 18 |
.. |
| 19 |
.\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. |
| 20 |
.ie n \{\ |
| 21 |
. ds C` "" |
| 22 |
. ds C' "" |
| 23 |
'br\} |
| 24 |
.el\{\ |
| 25 |
. ds C` |
| 26 |
. ds C' |
| 27 |
'br\} |
| 28 |
.\" |
| 29 |
.\" Escape single quotes in literal strings from groff's Unicode transform. |
| 30 |
.ie \n(.g .ds Aq \(aq |
| 31 |
.el .ds Aq ' |
| 32 |
.\" |
| 33 |
.\" If the F register is >0, we'll generate index entries on stderr for |
| 34 |
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index |
| 35 |
.\" entries marked with X<> in POD. Of course, you'll have to process the |
| 36 |
.\" output yourself in some meaningful fashion. |
| 37 |
.\" |
| 38 |
.\" Avoid warning from groff about undefined register 'F'. |
| 39 |
.de IX |
| 40 |
.. |
| 41 |
.nr rF 0 |
| 42 |
.if \n(.g .if rF .nr rF 1 |
| 43 |
.if (\n(rF:(\n(.g==0)) \{\ |
| 44 |
. if \nF \{\ |
| 45 |
. de IX |
| 46 |
. tm Index:\\$1\t\\n%\t"\\$2" |
| 47 |
.. |
| 48 |
. if !\nF==2 \{\ |
| 49 |
. nr % 0 |
| 50 |
. nr F 2 |
| 51 |
. \} |
| 52 |
. \} |
| 53 |
.\} |
| 54 |
.rr rF |
| 55 |
.\" ======================================================================== |
| 56 |
.\" |
| 57 |
.IX Title "SMIME_READ_ASN1 3SSL" |
| 58 |
.TH SMIME_READ_ASN1 3SSL 2026-04-07 3.6.2 OpenSSL |
| 59 |
.\" For nroff, turn off justification. Always turn off hyphenation; it makes |
| 60 |
.\" way too many mistakes in technical documents. |
| 61 |
.if n .ad l |
| 62 |
.nh |
| 63 |
.SH NAME |
| 64 |
SMIME_read_ASN1_ex, SMIME_read_ASN1 |
| 65 |
\&\- parse S/MIME message |
| 66 |
.SH SYNOPSIS |
| 67 |
.IX Header "SYNOPSIS" |
| 68 |
.Vb 1 |
| 69 |
\& #include <openssl/asn1.h> |
| 70 |
\& |
| 71 |
\& ASN1_VALUE *SMIME_read_ASN1_ex(BIO *in, int flags, BIO **bcont, |
| 72 |
\& const ASN1_ITEM *it, ASN1_VALUE **x, |
| 73 |
\& OSSL_LIB_CTX *libctx, const char *propq); |
| 74 |
\& ASN1_VALUE *SMIME_read_ASN1(BIO *in, BIO **bcont, const ASN1_ITEM *it); |
| 75 |
.Ve |
| 76 |
.SH DESCRIPTION |
| 77 |
.IX Header "DESCRIPTION" |
| 78 |
\&\fBSMIME_read_ASN1_ex()\fR parses a message in S/MIME format. |
| 79 |
.PP |
| 80 |
\&\fIin\fR is a BIO to read the message from. |
| 81 |
If the \fIflags\fR argument contains \fBCMS_BINARY\fR then the input is assumed to be |
| 82 |
in binary format and is not translated to canonical form. |
| 83 |
If in addition \fBSMIME_ASCIICRLF\fR is set then the binary input is assumed |
| 84 |
to be followed by \fBCR\fR and \fBLF\fR characters, else only by an \fBLF\fR character. |
| 85 |
\&\fIx\fR can be used to optionally supply |
| 86 |
a previously created \fIit\fR ASN1_VALUE object (such as CMS_ContentInfo or PKCS7), |
| 87 |
it can be set to NULL. Valid values that can be used by ASN.1 structure \fIit\fR |
| 88 |
are ASN1_ITEM_rptr(PKCS7) or ASN1_ITEM_rptr(CMS_ContentInfo). Any algorithm |
| 89 |
fetches that occur during the operation will use the \fBOSSL_LIB_CTX\fR supplied in |
| 90 |
the \fIlibctx\fR parameter, and use the property query string \fIpropq\fR See |
| 91 |
"ALGORITHM FETCHING" in \fBcrypto\fR\|(7) for further details about algorithm fetching. |
| 92 |
.PP |
| 93 |
If cleartext signing is used then the content is saved in a memory bio which is |
| 94 |
written to \fI*bcont\fR, otherwise \fI*bcont\fR is set to NULL. |
| 95 |
.PP |
| 96 |
The parsed ASN1_VALUE structure is returned or NULL if an error occurred. |
| 97 |
.PP |
| 98 |
\&\fBSMIME_read_ASN1()\fR is similar to \fBSMIME_read_ASN1_ex()\fR but sets the value of \fIx\fR |
| 99 |
to NULL and the value of \fIflags\fR to 0. |
| 100 |
.SH NOTES |
| 101 |
.IX Header "NOTES" |
| 102 |
The higher level functions \fBSMIME_read_CMS_ex\fR\|(3) and |
| 103 |
\&\fBSMIME_read_PKCS7_ex\fR\|(3) should be used instead of \fBSMIME_read_ASN1_ex()\fR. |
| 104 |
.PP |
| 105 |
To support future functionality if \fIbcont\fR is not NULL \fI*bcont\fR should be |
| 106 |
initialized to NULL. |
| 107 |
.SH BUGS |
| 108 |
.IX Header "BUGS" |
| 109 |
The MIME parser used by \fBSMIME_read_ASN1_ex()\fR is somewhat primitive. While it will |
| 110 |
handle most S/MIME messages more complex compound formats may not work. |
| 111 |
.PP |
| 112 |
The use of a memory BIO to hold the signed content limits the size of message |
| 113 |
which can be processed due to memory restraints: a streaming single pass option |
| 114 |
should be available. |
| 115 |
.SH "RETURN VALUES" |
| 116 |
.IX Header "RETURN VALUES" |
| 117 |
\&\fBSMIME_read_ASN1_ex()\fR and \fBSMIME_read_ASN1()\fR return a valid \fBASN1_VALUE\fR |
| 118 |
structure or \fBNULL\fR if an error occurred. The error can be obtained from |
| 119 |
\&\fBERR_get_error\fR\|(3). |
| 120 |
.SH "SEE ALSO" |
| 121 |
.IX Header "SEE ALSO" |
| 122 |
\&\fBERR_get_error\fR\|(3), |
| 123 |
\&\fBSMIME_read_CMS_ex\fR\|(3), |
| 124 |
\&\fBSMIME_read_PKCS7_ex\fR\|(3), |
| 125 |
\&\fBSMIME_write_ASN1\fR\|(3), |
| 126 |
\&\fBSMIME_write_ASN1_ex\fR\|(3) |
| 127 |
.SH HISTORY |
| 128 |
.IX Header "HISTORY" |
| 129 |
The function \fBSMIME_read_ASN1_ex()\fR was added in OpenSSL 3.0. |
| 130 |
.SH COPYRIGHT |
| 131 |
.IX Header "COPYRIGHT" |
| 132 |
Copyright 2020\-2021 The OpenSSL Project Authors. All Rights Reserved. |
| 133 |
.PP |
| 134 |
Licensed under the Apache License 2.0 (the "License"). You may not use |
| 135 |
this file except in compliance with the License. You can obtain a copy |
| 136 |
in the file LICENSE in the source distribution or at |
| 137 |
<https://www.openssl.org/source/license.html>. |