1 1.1 christos =pod 2 1.1 christos 3 1.1 christos =head1 NAME 4 1.1 christos 5 1.1 christos SMIME_read_ASN1_ex, SMIME_read_ASN1 6 1.1 christos - parse S/MIME message 7 1.1 christos 8 1.1 christos =head1 SYNOPSIS 9 1.1 christos 10 1.1 christos #include <openssl/asn1.h> 11 1.1 christos 12 1.1 christos ASN1_VALUE *SMIME_read_ASN1_ex(BIO *in, int flags, BIO **bcont, 13 1.1 christos const ASN1_ITEM *it, ASN1_VALUE **x, 14 1.1 christos OSSL_LIB_CTX *libctx, const char *propq); 15 1.1 christos ASN1_VALUE *SMIME_read_ASN1(BIO *in, BIO **bcont, const ASN1_ITEM *it); 16 1.1 christos 17 1.1 christos =head1 DESCRIPTION 18 1.1 christos 19 1.1 christos SMIME_read_ASN1_ex() parses a message in S/MIME format. 20 1.1 christos 21 1.1 christos I<in> is a BIO to read the message from. 22 1.1 christos If the I<flags> argument contains B<CMS_BINARY> then the input is assumed to be 23 1.1 christos in binary format and is not translated to canonical form. 24 1.1 christos If in addition B<SMIME_ASCIICRLF> is set then the binary input is assumed 25 1.1 christos to be followed by B<CR> and B<LF> characters, else only by an B<LF> character. 26 1.1 christos I<x> can be used to optionally supply 27 1.1 christos a previously created I<it> ASN1_VALUE object (such as CMS_ContentInfo or PKCS7), 28 1.1 christos it can be set to NULL. Valid values that can be used by ASN.1 structure I<it> 29 1.1 christos are ASN1_ITEM_rptr(PKCS7) or ASN1_ITEM_rptr(CMS_ContentInfo). Any algorithm 30 1.1 christos fetches that occur during the operation will use the B<OSSL_LIB_CTX> supplied in 31 1.1 christos the I<libctx> parameter, and use the property query string I<propq> See 32 1.1 christos L<crypto(7)/ALGORITHM FETCHING> for further details about algorithm fetching. 33 1.1 christos 34 1.1 christos If cleartext signing is used then the content is saved in a memory bio which is 35 1.1 christos written to I<*bcont>, otherwise I<*bcont> is set to NULL. 36 1.1 christos 37 1.1 christos The parsed ASN1_VALUE structure is returned or NULL if an error occurred. 38 1.1 christos 39 1.1 christos SMIME_read_ASN1() is similar to SMIME_read_ASN1_ex() but sets the value of I<x> 40 1.1 christos to NULL and the value of I<flags> to 0. 41 1.1 christos 42 1.1 christos =head1 NOTES 43 1.1 christos 44 1.1 christos The higher level functions L<SMIME_read_CMS_ex(3)> and 45 1.1 christos L<SMIME_read_PKCS7_ex(3)> should be used instead of SMIME_read_ASN1_ex(). 46 1.1 christos 47 1.1 christos To support future functionality if I<bcont> is not NULL I<*bcont> should be 48 1.1 christos initialized to NULL. 49 1.1 christos 50 1.1 christos =head1 BUGS 51 1.1 christos 52 1.1 christos The MIME parser used by SMIME_read_ASN1_ex() is somewhat primitive. While it will 53 1.1 christos handle most S/MIME messages more complex compound formats may not work. 54 1.1 christos 55 1.1 christos The use of a memory BIO to hold the signed content limits the size of message 56 1.1 christos which can be processed due to memory restraints: a streaming single pass option 57 1.1 christos should be available. 58 1.1 christos 59 1.1 christos =head1 RETURN VALUES 60 1.1 christos 61 1.1 christos SMIME_read_ASN1_ex() and SMIME_read_ASN1() return a valid B<ASN1_VALUE> 62 1.1 christos structure or B<NULL> if an error occurred. The error can be obtained from 63 1.1 christos ERR_get_error(3). 64 1.1 christos 65 1.1 christos =head1 SEE ALSO 66 1.1 christos 67 1.1 christos L<ERR_get_error(3)>, 68 1.1 christos L<SMIME_read_CMS_ex(3)>, 69 1.1 christos L<SMIME_read_PKCS7_ex(3)>, 70 1.1 christos L<SMIME_write_ASN1(3)>, 71 1.1 christos L<SMIME_write_ASN1_ex(3)> 72 1.1 christos 73 1.1 christos =head1 HISTORY 74 1.1 christos 75 1.1 christos The function SMIME_read_ASN1_ex() was added in OpenSSL 3.0. 76 1.1 christos 77 1.1 christos =head1 COPYRIGHT 78 1.1 christos 79 1.1 christos Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved. 80 1.1 christos 81 1.1 christos Licensed under the Apache License 2.0 (the "License"). You may not use 82 1.1 christos this file except in compliance with the License. You can obtain a copy 83 1.1 christos in the file LICENSE in the source distribution or at 84 1.1 christos L<https://www.openssl.org/source/license.html>. 85 1.1 christos 86 1.1 christos =cut 87