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.
| SMIME_WRITE_CMS(3) | Library Functions Manual | SMIME_WRITE_CMS(3) |
NAME
SMIME_write_CMS —
convert CMS structure to S/MIME format
SYNOPSIS
library “libcrypto”
#include <openssl/cms.h>
int
SMIME_write_CMS(BIO *out,
CMS_ContentInfo *cms, BIO *data,
int flags);
DESCRIPTION
SMIME_write_CMS()
generates an S/MIME message on out by writing MIME 1.0
headers followed by a BER- and base64-encoded serialization of
cms. The BER encoding uses the DER format except as
described for CMS_STREAM below. If streaming is
enabled, the content must be supplied in the data
argument.
The flags can be the logical OR of zero or more of the following bits:
CMS_DETACHED- Use cleartext signing and generate a "multipart/signed" S/MIME
message. The content is read from data. If
data is a
NULLpointer, this flag is ignored.This flag is only supported if cms is of the type SignedData and
CMS_DETACHEDwas also set when it was created with CMS_sign(3).If
CMS_STREAMis not set, the data must be read twice: once to compute the signature in CMS_sign(3) and once to output the S/MIME message.If
CMS_DETACHEDis ignored or not specified, the smime-type is chosen according to CMS_get0_type(3):NID_pkcs7_enveloped- "enveloped-data"
NID_pkcs7_signed-
- "signed-receipt"
- if
CMS_get0_eContentType(3)
is
NID_id_smime_ct_receipt - "signed-data"
- if cms specifies any digest algorithm
- "certs-only"
- otherwise
NID_id_smime_ct_compressedData- "compressed-data"
CMS_REUSE_DIGEST- Skip the calls to
CMS_dataInit(3) and
CMS_dataFinal(3).
This flag has no effect unless
CMS_DETACHEDis also set. CMS_STREAM- Perform streaming by reading the content from data.
This only works if
CMS_DETACHEDis not specified.This flag should only be set if
CMS_STREAMwas also passed to the function that created cms.The content is output in BER format using indefinite length constructed encoding except in the case of SignedData with detached content where the content is absent and DER format is used.
CMS_TEXT- Prepend the line "Content-Type: text/plain" to the content. This
only makes sense if
CMS_DETACHEDis also set. It is ignored if the flagSMIME_BINARYis also set. SMIME_BINARY- If specified, this flag is passed through to SMIME_crlf_copy(3).
SMIME_CRLFEOL- End MIME header lines with pairs of carriage return and newline characters. By default, no carriage return characters are written and header lines are ended with newline characters only.
RETURN VALUES
SMIME_write_CMS() is intended to return 1
on success or 0 on failure.
SEE ALSO
BIO_f_base64(3), BIO_new(3), CMS_ContentInfo_new(3), CMS_encrypt(3), CMS_sign(3), d2i_CMS_ContentInfo(3), ERR_get_error(3), SMIME_crlf_copy(3), SMIME_read_CMS(3), SMIME_write_PKCS7(3)
HISTORY
SMIME_write_CMS() first appeared in
OpenSSL 0.9.8h and has been available since OpenBSD
6.7.
BUGS
SMIME_write_CMS() ignores most errors and
is likely to return 1 even after producing corrupt or incomplete output.
SMIME_write_CMS() always base64 encodes
CMS structures. There should be an option to disable this.
| June 11, 2025 | Sortix 1.1.0-dev |