Blame doc/man3/CMS_get0_type.pod

Packit c4476c
=pod
Packit c4476c
Packit c4476c
=head1 NAME
Packit c4476c
Packit c4476c
CMS_get0_type, CMS_set1_eContentType, CMS_get0_eContentType, CMS_get0_content - get and set CMS content types and content
Packit c4476c
Packit c4476c
=head1 SYNOPSIS
Packit c4476c
Packit c4476c
 #include <openssl/cms.h>
Packit c4476c
Packit c4476c
 const ASN1_OBJECT *CMS_get0_type(const CMS_ContentInfo *cms);
Packit c4476c
 int CMS_set1_eContentType(CMS_ContentInfo *cms, const ASN1_OBJECT *oid);
Packit c4476c
 const ASN1_OBJECT *CMS_get0_eContentType(CMS_ContentInfo *cms);
Packit c4476c
 ASN1_OCTET_STRING **CMS_get0_content(CMS_ContentInfo *cms);
Packit c4476c
Packit c4476c
=head1 DESCRIPTION
Packit c4476c
Packit c4476c
CMS_get0_type() returns the content type of a CMS_ContentInfo structure as
Packit c4476c
an ASN1_OBJECT pointer. An application can then decide how to process the
Packit c4476c
CMS_ContentInfo structure based on this value.
Packit c4476c
Packit c4476c
CMS_set1_eContentType() sets the embedded content type of a CMS_ContentInfo
Packit c4476c
structure. It should be called with CMS functions (such as L<CMS_sign>, L<CMS_encrypt>)
Packit c4476c
with the B<CMS_PARTIAL>
Packit c4476c
flag and B<before> the structure is finalised, otherwise the results are
Packit c4476c
undefined.
Packit c4476c
Packit c4476c
ASN1_OBJECT *CMS_get0_eContentType() returns a pointer to the embedded
Packit c4476c
content type.
Packit c4476c
Packit c4476c
CMS_get0_content() returns a pointer to the B<ASN1_OCTET_STRING> pointer
Packit c4476c
containing the embedded content.
Packit c4476c
Packit c4476c
=head1 NOTES
Packit c4476c
Packit c4476c
As the B<0> implies CMS_get0_type(), CMS_get0_eContentType() and
Packit c4476c
CMS_get0_content() return internal pointers which should B<not> be freed up.
Packit c4476c
CMS_set1_eContentType() copies the supplied OID and it B<should> be freed up
Packit c4476c
after use.
Packit c4476c
Packit c4476c
The B<ASN1_OBJECT> values returned can be converted to an integer B<NID> value
Packit c4476c
using OBJ_obj2nid(). For the currently supported content types the following
Packit c4476c
values are returned:
Packit c4476c
Packit c4476c
 NID_pkcs7_data
Packit c4476c
 NID_pkcs7_signed
Packit c4476c
 NID_pkcs7_digest
Packit c4476c
 NID_id_smime_ct_compressedData:
Packit c4476c
 NID_pkcs7_encrypted
Packit c4476c
 NID_pkcs7_enveloped
Packit c4476c
Packit c4476c
The return value of CMS_get0_content() is a pointer to the B<ASN1_OCTET_STRING>
Packit c4476c
content pointer. That means that for example:
Packit c4476c
Packit c4476c
 ASN1_OCTET_STRING **pconf = CMS_get0_content(cms);
Packit c4476c
Packit c4476c
B<*pconf> could be NULL if there is no embedded content. Applications can
Packit c4476c
access, modify or create the embedded content in a B<CMS_ContentInfo> structure
Packit c4476c
using this function. Applications usually will not need to modify the
Packit c4476c
embedded content as it is normally set by higher level functions.
Packit c4476c
Packit c4476c
=head1 RETURN VALUES
Packit c4476c
Packit c4476c
CMS_get0_type() and CMS_get0_eContentType() return an ASN1_OBJECT structure.
Packit c4476c
Packit c4476c
CMS_set1_eContentType() returns 1 for success or 0 if an error occurred.  The
Packit c4476c
error can be obtained from ERR_get_error(3).
Packit c4476c
Packit c4476c
=head1 SEE ALSO
Packit c4476c
Packit c4476c
L<ERR_get_error(3)>
Packit c4476c
Packit c4476c
=head1 COPYRIGHT
Packit c4476c
Packit c4476c
Copyright 2008-2019 The OpenSSL Project Authors. All Rights Reserved.
Packit c4476c
Packit c4476c
Licensed under the OpenSSL license (the "License").  You may not use
Packit c4476c
this file except in compliance with the License.  You can obtain a copy
Packit c4476c
in the file LICENSE in the source distribution or at
Packit c4476c
L<https://www.openssl.org/source/license.html>.
Packit c4476c
Packit c4476c
=cut