xref: /freebsd/crypto/openssl/doc/man3/SMIME_write_ASN1.pod (revision b077aed33b7b6aefca7b17ddb250cf521f938613)
1*b077aed3SPierre Pronchery=pod
2*b077aed3SPierre Pronchery
3*b077aed3SPierre Pronchery=head1 NAME
4*b077aed3SPierre Pronchery
5*b077aed3SPierre ProncherySMIME_write_ASN1_ex, SMIME_write_ASN1
6*b077aed3SPierre Pronchery- convert structure to S/MIME format
7*b077aed3SPierre Pronchery
8*b077aed3SPierre Pronchery=head1 SYNOPSIS
9*b077aed3SPierre Pronchery
10*b077aed3SPierre Pronchery #include <openssl/asn1.h>
11*b077aed3SPierre Pronchery
12*b077aed3SPierre Pronchery int SMIME_write_ASN1_ex(BIO *out, ASN1_VALUE *val, BIO *data, int flags,
13*b077aed3SPierre Pronchery                         int ctype_nid, int econt_nid,
14*b077aed3SPierre Pronchery                         STACK_OF(X509_ALGOR) *mdalgs, const ASN1_ITEM *it,
15*b077aed3SPierre Pronchery                         OSSL_LIB_CTX *libctx, const char *propq);
16*b077aed3SPierre Pronchery
17*b077aed3SPierre Pronchery int SMIME_write_ASN1(BIO *out,
18*b077aed3SPierre Pronchery     ASN1_VALUE *val, BIO *data, int flags, int ctype_nid, int econt_nid,
19*b077aed3SPierre Pronchery     STACK_OF(X509_ALGOR) *mdalgs, const ASN1_ITEM *it);
20*b077aed3SPierre Pronchery
21*b077aed3SPierre Pronchery=head1 DESCRIPTION
22*b077aed3SPierre Pronchery
23*b077aed3SPierre ProncherySMIME_write_ASN1_ex() adds the appropriate MIME headers to an object
24*b077aed3SPierre Proncherystructure to produce an S/MIME message.
25*b077aed3SPierre Pronchery
26*b077aed3SPierre ProncheryI<out> is the BIO to write the data to. I<value> is the appropriate ASN1_VALUE
27*b077aed3SPierre Proncherystructure (either CMS_ContentInfo or PKCS7). If streaming is enabled then the
28*b077aed3SPierre Proncherycontent must be supplied via I<data>.
29*b077aed3SPierre ProncheryI<flags> is an optional set of flags. I<ctype_nid> is the NID of the content
30*b077aed3SPierre Proncherytype, I<econt_nid> is the NID of the embedded content type and I<mdalgs> is a
31*b077aed3SPierre Proncherylist of signed data digestAlgorithms. Valid values that can be used by the
32*b077aed3SPierre ProncheryASN.1 structure I<it> are ASN1_ITEM_rptr(PKCS7) or ASN1_ITEM_rptr(CMS_ContentInfo).
33*b077aed3SPierre ProncheryThe library context I<libctx> and the property query I<propq> are used when
34*b077aed3SPierre Proncheryretrieving algorithms from providers.
35*b077aed3SPierre Pronchery
36*b077aed3SPierre Pronchery=head1 NOTES
37*b077aed3SPierre Pronchery
38*b077aed3SPierre ProncheryThe higher level functions L<SMIME_write_CMS(3)> and
39*b077aed3SPierre ProncheryL<SMIME_write_PKCS7(3)> should be used instead of SMIME_write_ASN1().
40*b077aed3SPierre Pronchery
41*b077aed3SPierre ProncheryThe following flags can be passed in the B<flags> parameter.
42*b077aed3SPierre Pronchery
43*b077aed3SPierre ProncheryIf B<CMS_DETACHED> is set then cleartext signing will be used, this option only
44*b077aed3SPierre Proncherymakes sense for SignedData where B<CMS_DETACHED> is also set when the sign()
45*b077aed3SPierre Proncherymethod is called.
46*b077aed3SPierre Pronchery
47*b077aed3SPierre ProncheryIf the B<CMS_TEXT> flag is set MIME headers for type B<text/plain> are added to
48*b077aed3SPierre Proncherythe content, this only makes sense if B<CMS_DETACHED> is also set.
49*b077aed3SPierre Pronchery
50*b077aed3SPierre ProncheryIf the B<CMS_STREAM> flag is set streaming is performed. This flag should only
51*b077aed3SPierre Proncherybe set if B<CMS_STREAM> was also set in the previous call to a CMS_ContentInfo
52*b077aed3SPierre Proncheryor PKCS7 creation function.
53*b077aed3SPierre Pronchery
54*b077aed3SPierre ProncheryIf cleartext signing is being used and B<CMS_STREAM> not set then the data must
55*b077aed3SPierre Proncherybe read twice: once to compute the signature in sign method and once to output
56*b077aed3SPierre Proncherythe S/MIME message.
57*b077aed3SPierre Pronchery
58*b077aed3SPierre ProncheryIf streaming is performed the content is output in BER format using indefinite
59*b077aed3SPierre Proncherylength constructed encoding except in the case of signed data with detached
60*b077aed3SPierre Proncherycontent where the content is absent and DER format is used.
61*b077aed3SPierre Pronchery
62*b077aed3SPierre Pronchery=head1 RETURN VALUES
63*b077aed3SPierre Pronchery
64*b077aed3SPierre ProncherySMIME_write_ASN1_ex() and SMIME_write_ASN1() return 1 for success or
65*b077aed3SPierre Pronchery0 for failure.
66*b077aed3SPierre Pronchery
67*b077aed3SPierre Pronchery=head1 SEE ALSO
68*b077aed3SPierre Pronchery
69*b077aed3SPierre ProncheryL<ERR_get_error(3)>,
70*b077aed3SPierre ProncheryL<SMIME_write_CMS(3)>,
71*b077aed3SPierre ProncheryL<SMIME_write_PKCS7(3)>
72*b077aed3SPierre Pronchery
73*b077aed3SPierre Pronchery=head1 COPYRIGHT
74*b077aed3SPierre Pronchery
75*b077aed3SPierre ProncheryCopyright 2020 The OpenSSL Project Authors. All Rights Reserved.
76*b077aed3SPierre Pronchery
77*b077aed3SPierre ProncheryLicensed under the Apache License 2.0 (the "License").  You may not use
78*b077aed3SPierre Proncherythis file except in compliance with the License.  You can obtain a copy
79*b077aed3SPierre Proncheryin the file LICENSE in the source distribution or at
80*b077aed3SPierre ProncheryL<https://www.openssl.org/source/license.html>.
81*b077aed3SPierre Pronchery
82*b077aed3SPierre Pronchery=cut
83