1238384Sjkim=pod 2238384Sjkim 3238384Sjkim=head1 NAME 4238384Sjkim 5238384Sjkim BIO_new_CMS - CMS streaming filter BIO 6238384Sjkim 7238384Sjkim=head1 SYNOPSIS 8238384Sjkim 9238384Sjkim #include <openssl/cms.h> 10238384Sjkim 11238384Sjkim BIO *BIO_new_CMS(BIO *out, CMS_ContentInfo *cms); 12238384Sjkim 13238384Sjkim=head1 DESCRIPTION 14238384Sjkim 15238384SjkimBIO_new_CMS() returns a streaming filter BIO chain based on B<cms>. The output 16238384Sjkimof the filter is written to B<out>. Any data written to the chain is 17238384Sjkimautomatically translated to a BER format CMS structure of the appropriate type. 18238384Sjkim 19238384Sjkim=head1 NOTES 20238384Sjkim 21238384SjkimThe chain returned by this function behaves like a standard filter BIO. It 22238384Sjkimsupports non blocking I/O. Content is processed and streamed on the fly and not 23238384Sjkimall held in memory at once: so it is possible to encode very large structures. 24238384SjkimAfter all content has been written through the chain BIO_flush() must be called 25238384Sjkimto finalise the structure. 26238384Sjkim 27238384SjkimThe B<CMS_STREAM> flag must be included in the corresponding B<flags> 28238384Sjkimparameter of the B<cms> creation function. 29238384Sjkim 30238384SjkimIf an application wishes to write additional data to B<out> BIOs should be 31238384Sjkimremoved from the chain using BIO_pop() and freed with BIO_free() until B<out> 32238384Sjkimis reached. If no additional data needs to be written BIO_free_all() can be 33238384Sjkimcalled to free up the whole chain. 34238384Sjkim 35238384SjkimAny content written through the filter is used verbatim: no canonical 36238384Sjkimtranslation is performed. 37238384Sjkim 38238384SjkimIt is possible to chain multiple BIOs to, for example, create a triple wrapped 39238384Sjkimsigned, enveloped, signed structure. In this case it is the applications 40238384Sjkimresponsibility to set the inner content type of any outer CMS_ContentInfo 41238384Sjkimstructures. 42238384Sjkim 43238384SjkimLarge numbers of small writes through the chain should be avoided as this will 44238384Sjkimproduce an output consisting of lots of OCTET STRING structures. Prepending 45238384Sjkima BIO_f_buffer() buffering BIO will prevent this. 46238384Sjkim 47238384Sjkim=head1 BUGS 48238384Sjkim 49238384SjkimThere is currently no corresponding inverse BIO: i.e. one which can decode 50238384Sjkima CMS structure on the fly. 51238384Sjkim 52238384Sjkim=head1 RETURN VALUES 53238384Sjkim 54238384SjkimBIO_new_CMS() returns a BIO chain when successful or NULL if an error 55238384Sjkimoccurred. The error can be obtained from ERR_get_error(3). 56238384Sjkim 57238384Sjkim=head1 SEE ALSO 58238384Sjkim 59238384SjkimL<ERR_get_error(3)|ERR_get_error(3)>, L<CMS_sign(3)|CMS_sign(3)>, 60238384SjkimL<CMS_encrypt(3)|CMS_encrypt(3)> 61238384Sjkim 62238384Sjkim=head1 HISTORY 63238384Sjkim 64238384SjkimBIO_new_CMS() was added to OpenSSL 1.0.0 65238384Sjkim 66238384Sjkim=cut 67