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