xref: /freebsd/crypto/openssl/doc/man3/BIO_new_CMS.pod (revision e71b70530d95c4f34d8bdbd78d1242df1ba4a945)
1*e71b7053SJung-uk Kim=pod
2*e71b7053SJung-uk Kim
3*e71b7053SJung-uk Kim=head1 NAME
4*e71b7053SJung-uk Kim
5*e71b7053SJung-uk KimBIO_new_CMS - CMS streaming filter BIO
6*e71b7053SJung-uk Kim
7*e71b7053SJung-uk Kim=head1 SYNOPSIS
8*e71b7053SJung-uk Kim
9*e71b7053SJung-uk Kim #include <openssl/cms.h>
10*e71b7053SJung-uk Kim
11*e71b7053SJung-uk Kim BIO *BIO_new_CMS(BIO *out, CMS_ContentInfo *cms);
12*e71b7053SJung-uk Kim
13*e71b7053SJung-uk Kim=head1 DESCRIPTION
14*e71b7053SJung-uk Kim
15*e71b7053SJung-uk KimBIO_new_CMS() returns a streaming filter BIO chain based on B<cms>. The output
16*e71b7053SJung-uk Kimof the filter is written to B<out>. Any data written to the chain is
17*e71b7053SJung-uk Kimautomatically translated to a BER format CMS structure of the appropriate type.
18*e71b7053SJung-uk Kim
19*e71b7053SJung-uk Kim=head1 NOTES
20*e71b7053SJung-uk Kim
21*e71b7053SJung-uk KimThe chain returned by this function behaves like a standard filter BIO. It
22*e71b7053SJung-uk Kimsupports non blocking I/O. Content is processed and streamed on the fly and not
23*e71b7053SJung-uk Kimall held in memory at once: so it is possible to encode very large structures.
24*e71b7053SJung-uk KimAfter all content has been written through the chain BIO_flush() must be called
25*e71b7053SJung-uk Kimto finalise the structure.
26*e71b7053SJung-uk Kim
27*e71b7053SJung-uk KimThe B<CMS_STREAM> flag must be included in the corresponding B<flags>
28*e71b7053SJung-uk Kimparameter of the B<cms> creation function.
29*e71b7053SJung-uk Kim
30*e71b7053SJung-uk KimIf an application wishes to write additional data to B<out> BIOs should be
31*e71b7053SJung-uk Kimremoved from the chain using BIO_pop() and freed with BIO_free() until B<out>
32*e71b7053SJung-uk Kimis reached. If no additional data needs to be written BIO_free_all() can be
33*e71b7053SJung-uk Kimcalled to free up the whole chain.
34*e71b7053SJung-uk Kim
35*e71b7053SJung-uk KimAny content written through the filter is used verbatim: no canonical
36*e71b7053SJung-uk Kimtranslation is performed.
37*e71b7053SJung-uk Kim
38*e71b7053SJung-uk KimIt is possible to chain multiple BIOs to, for example, create a triple wrapped
39*e71b7053SJung-uk Kimsigned, enveloped, signed structure. In this case it is the applications
40*e71b7053SJung-uk Kimresponsibility to set the inner content type of any outer CMS_ContentInfo
41*e71b7053SJung-uk Kimstructures.
42*e71b7053SJung-uk Kim
43*e71b7053SJung-uk KimLarge numbers of small writes through the chain should be avoided as this will
44*e71b7053SJung-uk Kimproduce an output consisting of lots of OCTET STRING structures. Prepending
45*e71b7053SJung-uk Kima BIO_f_buffer() buffering BIO will prevent this.
46*e71b7053SJung-uk Kim
47*e71b7053SJung-uk Kim=head1 BUGS
48*e71b7053SJung-uk Kim
49*e71b7053SJung-uk KimThere is currently no corresponding inverse BIO: i.e. one which can decode
50*e71b7053SJung-uk Kima CMS structure on the fly.
51*e71b7053SJung-uk Kim
52*e71b7053SJung-uk Kim=head1 RETURN VALUES
53*e71b7053SJung-uk Kim
54*e71b7053SJung-uk KimBIO_new_CMS() returns a BIO chain when successful or NULL if an error
55*e71b7053SJung-uk Kimoccurred. The error can be obtained from ERR_get_error(3).
56*e71b7053SJung-uk Kim
57*e71b7053SJung-uk Kim=head1 SEE ALSO
58*e71b7053SJung-uk Kim
59*e71b7053SJung-uk KimL<ERR_get_error(3)>, L<CMS_sign(3)>,
60*e71b7053SJung-uk KimL<CMS_encrypt(3)>
61*e71b7053SJung-uk Kim
62*e71b7053SJung-uk Kim=head1 HISTORY
63*e71b7053SJung-uk Kim
64*e71b7053SJung-uk KimBIO_new_CMS() was added to OpenSSL 1.0.0
65*e71b7053SJung-uk Kim
66*e71b7053SJung-uk Kim=head1 COPYRIGHT
67*e71b7053SJung-uk Kim
68*e71b7053SJung-uk KimCopyright 2008-2016 The OpenSSL Project Authors. All Rights Reserved.
69*e71b7053SJung-uk Kim
70*e71b7053SJung-uk KimLicensed under the OpenSSL license (the "License").  You may not use
71*e71b7053SJung-uk Kimthis file except in compliance with the License.  You can obtain a copy
72*e71b7053SJung-uk Kimin the file LICENSE in the source distribution or at
73*e71b7053SJung-uk KimL<https://www.openssl.org/source/license.html>.
74*e71b7053SJung-uk Kim
75*e71b7053SJung-uk Kim=cut
76