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