GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
SMIME_WRITE_ASN1(3) FreeBSD Library Functions Manual SMIME_WRITE_ASN1(3)

SMIME_write_ASN1
generate an S/MIME message

#include <openssl/asn1.h>

int
SMIME_write_ASN1(BIO *out_bio, ASN1_VALUE *val_in, BIO *in_bio, int flags, int ctype_nid, int econt_nid, STACK_OF(X509_ALGOR) *micalg, const ASN1_ITEM *it);

SMIME_write_ASN1() generates an S/MIME message on out_bio by writing MIME 1.0 headers followed by a BER- and base64-encoded serialization of val_in, which can be of the type CMS_ContentInfo or PKCS7 and has to match the it argument.

The flags can be the logical OR of zero or more of the following bits:

Skip the calls to PKCS7_dataInit(3) and PKCS7_dataFinal(3). This flag has no effect unless SMIME_DETACHED is also set. It is normally used if out_bio is already set up to calculate and finalize the digest when written through.
If specified, this flag is passed through to SMIME_crlf_copy(3).
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.
Use cleartext signing. Generate a “multipart/signed” S/MIME message using the micalg argument and ignoring the ctype_nid and econt_nid arguments. The content is read from in_bio. If in_bio is a NULL pointer, this flag is ignored.

If this flag is ignored or not specified, the smime-type is chosen according to ctype_nid instead:

“enveloped-data”
“signed-receipt” if econt_nid is NID_id_smime_ct_receipt
“signed-data” if micalg is not empty
“certs-only” if micalg is empty
“compressed-data”
In Content-Type headers, use “application/x-pkcs7-mime” or “application/x-pkcs7-signature”. By default, “application/pkcs7-mime” or “application/pkcs7-signature” are used instead.
Perform streaming by passing this flag through to i2d_ASN1_bio_stream(3) and reading the content from in_bio. This only works if SMIME_DETACHED is not specified.
SMIME_TEXT
Prepend the line “Content-Type: text/plain” to the content. This only makes sense if SMIME_DETACHED is also set. It is ignored if the flag SMIME_BINARY is also set.

SMIME_write_ASN1() is intended to return 1 on success or 0 on failure.

ASN1_item_i2d_bio(3), BIO_f_base64(3), BIO_new(3), i2d_ASN1_bio_stream(3), SMIME_crlf_copy(3), SMIME_write_CMS(3), SMIME_write_PKCS7(3), X509_ALGOR_new(3)

SMIME_write_ASN1() first appeared in OpenSSL 1.0.0 and has been available since OpenBSD 4.9.

SMIME_write_ASN1() ignores most errors and is likely to return 1 even after producing corrupt or incomplete output.
December 13, 2021 FreeBSD 13.1-RELEASE

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.