Commit 38d3a738 authored by Dr. Stephen Henson's avatar Dr. Stephen Henson
Browse files

Reformat, fix typos and clarify CMS API docs.

parent 73b3c2d8
Loading
Loading
Loading
Loading
+13 −11
Original line number Original line Diff line number Diff line
@@ -13,28 +13,30 @@ BIO_new_CMS - CMS streaming filter BIO
=head1 DESCRIPTION
=head1 DESCRIPTION


BIO_new_CMS() returns a streaming filter BIO chain based on B<cms>. The output
BIO_new_CMS() returns a streaming filter BIO chain based on B<cms>. The output
of the filter is written to B<out>. Any data written to the returned BIO
of the filter is written to B<out>. Any data written to the chain is
is automatically translated to a BER format CMS structure.
automatically translated to a BER format CMS structure of the appropriate type.


=head1 NOTES
=head1 NOTES


The BIO returned by this functions behaves like a standard filter BIO. It
The chain returned by this function behaves like a standard filter BIO. It
supports non blocking I/O. Content is processes and streamed on the fly and not
supports non blocking I/O. Content is processed and streamed on the fly and not
all held in memory at once: so it is possible to encode very large structures.
all held in memory at once: so it is possible to encode very large structures.
After all content has been written through the BIO BIO_flush() must be called
After all content has been written through the chain BIO_flush() must be called
to finalise the structure.
to finalise the structure.


The B<CMS_STREAM> flag must be included in the corresponding B<flags>
The B<CMS_STREAM> flag must be included in the corresponding B<flags>
parameter of the B<cms> creation function.
parameter of the B<cms> creation function.


After use BIOs should be removed from the filter using BIO_pop() until
If an application wishes to write additional data to B<out> BIOs should be
the output BIO B<out> is reached.
removed from the chain using BIO_pop() and freed with BIO_free() until B<out>
is reached. If no additional data needs to be written BIO_free_all() can be
called to free up the whole chain.


Any content written through the filter is uses "as-is" and no canonical
Any content written through the filter is used verbatim: no canonical
translation is performed.
translation is performed.


It is possible to chain multiple BIOs to for example create a triple wrapped
It is possible to chain multiple BIOs to, for example, create a triple wrapped
signed, enveloped signed structure. In this case it is the applications
signed, enveloped, signed structure. In this case it is the applications
responsibility to set the inner content type of any outer CMS_ContentInfo
responsibility to set the inner content type of any outer CMS_ContentInfo
structures.
structures.


+13 −8
Original line number Original line Diff line number Diff line
@@ -18,16 +18,23 @@


=head1 DESCRIPTION
=head1 DESCRIPTION


CMS_add0_cert() and CMS_add1_cert() add certificate B<cert> to B<cms> which
CMS_add0_cert() and CMS_add1_cert() add certificate B<cert> to B<cms>.
must be of type signed data or enveloped data. 
must be of type signed data or enveloped data. 


CMS_get1_certs() returns all certificates in B<cms>.
CMS_get1_certs() returns all certificates in B<cms>.


CMS_add0_crl() adds CRL B<crl> to B<cms> which must be of type signed data or
CMS_add0_crl() adds CRL B<crl> to B<cms>. CMS_get1_crls() returns any CRLs in
enveloped data. CMS_get1_crls() returns any CRLs in B<cms>.
B<cms>.


=head1 NOTES
=head1 NOTES


The CMS_ContentInfo structure B<cms> must be of type signed data or enveloped
data or an error will be returned.

For signed data certificates and CRLs are added to the B<certificates> and
B<crls> fields of SignedData structure. For enveloped data they are added to
B<OriginatorInfo>.

As the B<0> implies CMS_add0_cert() adds B<cert> internally to B<cms> and it
As the B<0> implies CMS_add0_cert() adds B<cert> internally to B<cms> and it
must not be freed up after the call as opposed to CMS_add1_cert() where B<cert>
must not be freed up after the call as opposed to CMS_add1_cert() where B<cert>
must be freed up.
must be freed up.
@@ -35,10 +42,6 @@ must be freed up.
The same certificate or CRL must not be added to the same cms structure more
The same certificate or CRL must not be added to the same cms structure more
than once.
than once.


For signed data CMS types certificates and CRLs are added to the
B<certificates> and B<crls> fields of the SignedData structure. For enveloped
data they are added to B<OriginatorInfo>.

=head1 RETURN VALUES
=head1 RETURN VALUES


CMS_add0_cert(), CMS_add1_cert() and CMS_add0_crl() return 1 for success and
CMS_add0_cert(), CMS_add1_cert() and CMS_add0_crl() return 1 for success and
@@ -50,7 +53,9 @@ in practice is if the B<cms> type is invalid.


=head1 SEE ALSO
=head1 SEE ALSO


L<ERR_get_error(3)|ERR_get_error(3)>
L<ERR_get_error(3)|ERR_get_error(3)>,
L<CMS_sign(3)|CMS_sign(3)>,
L<CMS_encrypt(3)|CMS_encrypt(3)>


=head1 HISTORY
=head1 HISTORY


+3 −4
Original line number Original line Diff line number Diff line
@@ -14,12 +14,11 @@


=head1 DESCRIPTION
=head1 DESCRIPTION


CMS_add1_recipient_cert() adds a recipient certificate B<recip> 
CMS_add1_recipient_cert() adds recipient B<recip> to CMS_ContentInfo enveloped
CMS_ContentInfo enveloped data structure B<cms> as a KeyTransRecipientInfo
data structure B<cms> as a KeyTransRecipientInfo structure.
structure.


CMS_add0_recipient_key() adds symmetric key B<key> of length B<keylen> using
CMS_add0_recipient_key() adds symmetric key B<key> of length B<keylen> using
wrapping algorithm B<nid>, identifier B<id> or length B<idlen> and optional
wrapping algorithm B<nid>, identifier B<id> of length B<idlen> and optional
values B<date>, B<otherTypeId> and B<otherType> to CMS_ContentInfo enveloped
values B<date>, B<otherTypeId> and B<otherType> to CMS_ContentInfo enveloped
data structure B<cms> as a KEKRecipientInfo structure.
data structure B<cms> as a KEKRecipientInfo structure.


+2 −2
Original line number Original line Diff line number Diff line
@@ -14,7 +14,7 @@ CMS_compress - create a CMS CompressedData structure


CMS_compress() creates and returns a CMS CompressedData structure. B<comp_nid>
CMS_compress() creates and returns a CMS CompressedData structure. B<comp_nid>
is the compression algorithm to use or B<NID_undef> to use the default
is the compression algorithm to use or B<NID_undef> to use the default
algorithms (zlib compression). B<in> is the content to be compressed.
algorithm (zlib compression). B<in> is the content to be compressed.
B<flags> is an optional set of flags.
B<flags> is an optional set of flags.


=head1 NOTES
=head1 NOTES
@@ -22,7 +22,7 @@ B<flags> is an optional set of flags.
The only currently supported compression algorithm is zlib using the NID
The only currently supported compression algorithm is zlib using the NID
NID_zlib_compression.
NID_zlib_compression.


If zlib support is not compiled into OpenSSL this CMS_compress() will return
If zlib support is not compiled into OpenSSL then CMS_compress() will return
an error.
an error.


If the B<CMS_TEXT> flag is set MIME headers for type B<text/plain> are
If the B<CMS_TEXT> flag is set MIME headers for type B<text/plain> are
+6 −5
Original line number Original line Diff line number Diff line
@@ -12,9 +12,9 @@ CMS_decrypt - decrypt content from a CMS envelopedData structure


=head1 DESCRIPTION
=head1 DESCRIPTION


CMS_decrypt() extracts and decrypts the content from a CMS envelopedData
CMS_decrypt() extracts and decrypts the content from a CMS EnvelopedData
structure. B<pkey> is the private key of the recipient, B<cert> is the
structure. B<pkey> is the private key of the recipient, B<cert> is the
recipients certificate, B<data> is a BIO to write the content to and
recipient's certificate, B<data> is a BIO to write the content to and
B<flags> is an optional set of flags.
B<flags> is an optional set of flags.


The B<dcont> parameter is used in the rare case where the encrypted content
The B<dcont> parameter is used in the rare case where the encrypted content
@@ -34,8 +34,9 @@ example looking them up in a database) and setting them in the CMS structure
in advance using the CMS utility functions such as CMS_set1_pkey(). In this
in advance using the CMS utility functions such as CMS_set1_pkey(). In this
case both B<cert> and B<pkey> should be set to NULL.
case both B<cert> and B<pkey> should be set to NULL.


To process KEKRecipientInfo types CMS_set1_key() should be used and B<cert>
To process KEKRecipientInfo types CMS_set1_key() or CMS_RecipientInfo_set0_key()
and B<pkey> set to NULL.
and CMS_ReceipientInfo_decrypt() should be called before CMS_decrypt() and
B<cert> and B<pkey> set to NULL.


The following flags can be passed in the B<flags> parameter.
The following flags can be passed in the B<flags> parameter.


Loading