1CMS_COMPRESS(3ossl)                 OpenSSL                CMS_COMPRESS(3ossl)
2
3
4

NAME

6       CMS_compress - create a CMS CompressedData structure
7

SYNOPSIS

9        #include <openssl/cms.h>
10
11        CMS_ContentInfo *CMS_compress(BIO *in, int comp_nid, unsigned int flags);
12

DESCRIPTION

14       CMS_compress() creates and returns a CMS CompressedData structure.
15       comp_nid is the compression algorithm to use or NID_undef to use the
16       default algorithm (zlib compression). in is the content to be
17       compressed.  flags is an optional set of flags.
18
19       The only currently supported compression algorithm is zlib using the
20       NID NID_zlib_compression.
21
22       If zlib support is not compiled into OpenSSL then CMS_compress() will
23       return an error.
24
25       If the CMS_TEXT flag is set MIME headers for type text/plain are
26       prepended to the data.
27
28       Normally the supplied content is translated into MIME canonical format
29       (as required by the S/MIME specifications) if CMS_BINARY is set no
30       translation occurs. This option should be used if the supplied data is
31       in binary format otherwise the translation will corrupt it. If
32       CMS_BINARY is set then CMS_TEXT is ignored.
33
34       If the CMS_STREAM flag is set a partial CMS_ContentInfo structure is
35       returned suitable for streaming I/O: no data is read from the BIO in.
36
37       The compressed data is included in the CMS_ContentInfo structure,
38       unless CMS_DETACHED is set in which case it is omitted. This is rarely
39       used in practice and is not supported by SMIME_write_CMS().
40
41       If the flag CMS_STREAM is set the returned CMS_ContentInfo structure is
42       not complete and outputting its contents via a function that does not
43       properly finalize the CMS_ContentInfo structure will give unpredictable
44       results.
45
46       Several functions including SMIME_write_CMS(), i2d_CMS_bio_stream(),
47       PEM_write_bio_CMS_stream() finalize the structure. Alternatively
48       finalization can be performed by obtaining the streaming ASN1 BIO
49       directly using BIO_new_CMS().
50
51       Additional compression parameters such as the zlib compression level
52       cannot currently be set.
53

RETURN VALUES

55       CMS_compress() returns either a CMS_ContentInfo structure or NULL if an
56       error occurred. The error can be obtained from ERR_get_error(3).
57

SEE ALSO

59       ERR_get_error(3), CMS_uncompress(3)
60

HISTORY

62       The CMS_STREAM flag was added in OpenSSL 1.0.0.
63
65       Copyright 2008-2016 The OpenSSL Project Authors. All Rights Reserved.
66
67       Licensed under the Apache License 2.0 (the "License").  You may not use
68       this file except in compliance with the License.  You can obtain a copy
69       in the file LICENSE in the source distribution or at
70       <https://www.openssl.org/source/license.html>.
71
72
73
743.0.5                             2022-07-05               CMS_COMPRESS(3ossl)
Impressum