Sortix
Sortix Download Manual Development Source Code News Blog More
current nightly

Sortix volatile manual

This manual documents Sortix volatile, a development build that has not been officially released. You can instead view this document in the latest official manual.

NAME

SMIME_read_ASN1 — generic S/MIME message parser

SYNOPSIS

#include <openssl/asn1.h>
ASN1_VALUE *
SMIME_read_ASN1(BIO *in_bio, BIO **out_bio, const ASN1_ITEM *it);

DESCRIPTION

SMIME_read_ASN1() reads a message in S/MIME format from in_bio.
If the message uses cleartext signing, the content is saved in a memory BIO which is written to *out_bio. Otherwise, *out_bio is set to NULL.
To support future functionality, if out_bio is not NULL, *out_bio should be initialized to NULL before calling SMIME_read_ASN1().

RETURN VALUES

SMIME_read_ASN1() returns a newly allocated object of type it or NULL if an error occurred. The error can be obtained from ERR_get_error(3).

SEE ALSO

ASN1_item_d2i_bio(3), BIO_f_base64(3), BIO_new(3), SMIME_read_CMS(3), SMIME_read_PKCS7(3), SMIME_text(3)

HISTORY

SMIME_read_ASN1() first appeared in OpenSSL 0.9.8h and has been available since OpenBSD 4.5.

BUGS

The MIME parser used by SMIME_read_ASN1() is somewhat primitive. While it will handle most S/MIME messages, more complex compound formats may not work.
The parser assumes that the structure is always base64 encoded, and it will not handle the case where it is in binary format or uses quoted printable format.
The use of a memory to hold the signed content limits the size of the message which can be processed due to memory restraints: a streaming single pass option should be available.
Copyright 2011-2025 Jonas 'Sortie' Termansen and contributors.
Sortix's source code is free software under the ISC license.
#sortix on irc.sortix.org
@sortix_org