]> git.ipfire.org Git - thirdparty/openssl.git/blame - doc/man3/BIO_new_CMS.pod
Restore sensible "sess_accept" counter tracking
[thirdparty/openssl.git] / doc / man3 / BIO_new_CMS.pod
CommitLineData
287df2fe
DSH
1=pod
2
3=head1 NAME
4
1bc74519 5BIO_new_CMS - CMS streaming filter BIO
287df2fe
DSH
6
7=head1 SYNOPSIS
8
9 #include <openssl/cms.h>
10
11 BIO *BIO_new_CMS(BIO *out, CMS_ContentInfo *cms);
12
13=head1 DESCRIPTION
14
15BIO_new_CMS() returns a streaming filter BIO chain based on B<cms>. The output
38d3a738
DSH
16of the filter is written to B<out>. Any data written to the chain is
17automatically translated to a BER format CMS structure of the appropriate type.
287df2fe
DSH
18
19=head1 NOTES
20
38d3a738
DSH
21The chain returned by this function behaves like a standard filter BIO. It
22supports non blocking I/O. Content is processed and streamed on the fly and not
287df2fe 23all held in memory at once: so it is possible to encode very large structures.
38d3a738 24After all content has been written through the chain BIO_flush() must be called
287df2fe
DSH
25to finalise the structure.
26
27The B<CMS_STREAM> flag must be included in the corresponding B<flags>
28parameter of the B<cms> creation function.
29
38d3a738
DSH
30If an application wishes to write additional data to B<out> BIOs should be
31removed from the chain using BIO_pop() and freed with BIO_free() until B<out>
32is reached. If no additional data needs to be written BIO_free_all() can be
33called to free up the whole chain.
287df2fe 34
38d3a738 35Any content written through the filter is used verbatim: no canonical
287df2fe
DSH
36translation is performed.
37
38d3a738
DSH
38It is possible to chain multiple BIOs to, for example, create a triple wrapped
39signed, enveloped, signed structure. In this case it is the applications
287df2fe
DSH
40responsibility to set the inner content type of any outer CMS_ContentInfo
41structures.
42
43Large numbers of small writes through the chain should be avoided as this will
44produce an output consisting of lots of OCTET STRING structures. Prepending
45a BIO_f_buffer() buffering BIO will prevent this.
46
47=head1 BUGS
48
49There is currently no corresponding inverse BIO: i.e. one which can decode
50a CMS structure on the fly.
51
52=head1 RETURN VALUES
53
54BIO_new_CMS() returns a BIO chain when successful or NULL if an error
55occurred. The error can be obtained from ERR_get_error(3).
56
57=head1 SEE ALSO
58
9b86974e
RS
59L<ERR_get_error(3)>, L<CMS_sign(3)>,
60L<CMS_encrypt(3)>
287df2fe
DSH
61
62=head1 HISTORY
63
fb552ac6 64BIO_new_CMS() was added to OpenSSL 1.0.0
287df2fe 65
e2f92610
RS
66=head1 COPYRIGHT
67
68Copyright 2008-2016 The OpenSSL Project Authors. All Rights Reserved.
69
70Licensed under the OpenSSL license (the "License"). You may not use
71this file except in compliance with the License. You can obtain a copy
72in the file LICENSE in the source distribution or at
73L<https://www.openssl.org/source/license.html>.
74
75=cut