
#use wml::openssl-macros area=docs page=CMS_get0_type

<title>Documents, CMS_get0_type(3)</title>

<h1>CMS_get0_type(3)</h1>

#use wml::imp::generic

{:
## What's this? [[s|(<STRONG>[^<].+?)</A>(</STRONG><DD>)|$1$2|sg]]
[[s|<P>\s+<P>|<P>|sg]]
[[s|<P>\s+</|</|sg]]
[[s|<DD>\s*<DT>|<DD>&nbsp;<DT>|sg]]
[[s|<DD>\s*</DL>|<DD>&nbsp;</DL>|sg]]
[[s|\[|&#91;|sg]]
[[s|\]|&#93;|sg]]

<!-- INDEX BEGIN -->

<UL>

	<LI><A HREF="#NAME">NAME</A>
	<LI><A HREF="#SYNOPSIS">SYNOPSIS</A>
	<LI><A HREF="#DESCRIPTION">DESCRIPTION</A>
	<LI><A HREF="#NOTES">NOTES</A>
	<LI><A HREF="#RETURN_VALUES">RETURN VALUES</A>
	<LI><A HREF="#SEE_ALSO">SEE ALSO</A>
	<LI><A HREF="#HISTORY">HISTORY</A>
</UL>
<!-- INDEX END -->

<HR>
<P>
<HR>
<H1><A NAME="NAME">NAME</A></H1>
<PRE> CMS_get0_type, CMS_set1_eContentType, CMS_get0_eContentType - get and set CMS content types
</PRE>
<P>
<HR>
<H1><A NAME="SYNOPSIS">SYNOPSIS</A></H1>
<PRE> #include &lt;openssl/cms.h&gt;
</PRE>
<PRE> const ASN1_OBJECT *CMS_get0_type(CMS_ContentInfo *cms);
 int CMS_set1_eContentType(CMS_ContentInfo *cms, const ASN1_OBJECT *oid);
 const ASN1_OBJECT *CMS_get0_eContentType(CMS_ContentInfo *cms);
</PRE>
<P>
<HR>
<H1><A NAME="DESCRIPTION">DESCRIPTION</A></H1>
<P>
<CODE>CMS_get0_type()</CODE> returns the content type of a CMS_ContentInfo
structure as and ASN1_OBJECT pointer. An application can then decide how to
process the CMS_ContentInfo structure based on this value.

</P>
<P>
<CODE>CMS_set1_eContentType()</CODE> sets the embedded content type of a
CMS_ContentInfo structure. It should be called with CMS functions with the <STRONG>CMS_PARTIAL</STRONG>
flag and <STRONG>before</STRONG> the structure is finalised, otherwise the results are undefined.

</P>
<P>
ASN1_OBJECT *CMS_get0_eContentType() returns a pointer to the embedded
content type.

</P>
<P>
<HR>
<H1><A NAME="NOTES">NOTES</A></H1>
<P>
As the <STRONG>0</STRONG> implies <CODE>CMS_get0_type()</CODE> and
<CODE>CMS_get0_eContentType()</CODE> return internal pointers which should <STRONG>not</STRONG> be freed up. <CODE>CMS_set1_eContentType()</CODE> copies the supplied OID
and it <STRONG>should</STRONG> be freed up after use.

</P>
<P>
The <STRONG>ASN1_OBJECT</STRONG> values returned can be converted to an integer <STRONG>NID</STRONG> value using <CODE>OBJ_obj2nid().</CODE> For the currently supported content
types the following values are returned:

</P>
<PRE> NID_pkcs7_data
 NID_pkcs7_signed
 NID_pkcs7_digest
 NID_id_smime_ct_compressedData:
 NID_pkcs7_encrypted
 NID_pkcs7_enveloped
</PRE>
<P>
<HR>
<H1><A NAME="RETURN_VALUES">RETURN VALUES</A></H1>
<P>
<CODE>CMS_get0_type()</CODE> and <CODE>CMS_get0_eContentType()</CODE>
return and ASN1_OBJECT structure.

</P>
<P>
<CODE>CMS_set1_eContentType()</CODE> returns 1 for success or 0 if an error
occurred. The error can be obtained from <CODE>ERR_get_error(3).</CODE>

</P>
<P>
<HR>
<H1><A NAME="SEE_ALSO">SEE ALSO</A></H1>
<P>
<A HREF="../crypto/ERR_get_error.html#">ERR_get_error(3)</A>



</P>
<P>
<HR>
<H1><A NAME="HISTORY">HISTORY</A></H1>
<P>
<CODE>CMS_get0_type(),</CODE> <CODE>CMS_set1_eContentType()</CODE> and
<CODE>CMS_get0_eContentType()</CODE> were all first added to OpenSSL 0.9.8

</P>
:}


