1136849Sscottl=pod 2136849Sscottl 3149871Sscottl=head1 NAME 4136849Sscottl 5136849Sscottl CMS_get0_type, CMS_set1_eContentType, CMS_get0_eContentType, CMS_get0_content - get and set CMS content types and content 6136849Sscottl 7142988Sscottl=head1 SYNOPSIS 8142988Sscottl 9136849Sscottl #include <openssl/cms.h> 10136849Sscottl 11136849Sscottl const ASN1_OBJECT *CMS_get0_type(CMS_ContentInfo *cms); 12136849Sscottl int CMS_set1_eContentType(CMS_ContentInfo *cms, const ASN1_OBJECT *oid); 13149871Sscottl const ASN1_OBJECT *CMS_get0_eContentType(CMS_ContentInfo *cms); 14136856Sscottl ASN1_OCTET_STRING **CMS_get0_content(CMS_ContentInfo *cms); 15136849Sscottl 16211690Simp=head1 DESCRIPTION 17149871Sscottl 18149871SscottlCMS_get0_type() returns the content type of a CMS_ContentInfo structure as 19149871Sscottland ASN1_OBJECT pointer. An application can then decide how to process the 20149871SscottlCMS_ContentInfo structure based on this value. 21136849Sscottl 22149871SscottlCMS_set1_eContentType() sets the embedded content type of a CMS_ContentInfo 23149871Sscottlstructure. It should be called with CMS functions with the B<CMS_PARTIAL> 24149871Sscottlflag and B<before> the structure is finalised, otherwise the results are 25136849Sscottlundefined. 26136849Sscottl 27136849SscottlASN1_OBJECT *CMS_get0_eContentType() returns a pointer to the embedded 28136849Sscottlcontent type. 29136849Sscottl 30136849SscottlCMS_get0_content() returns a pointer to the B<ASN1_OCTET_STRING> pointer 31136849Sscottlcontaining the embedded content. 32136849Sscottl 33136849Sscottl=head1 NOTES 34136849Sscottl 35136849SscottlAs the B<0> implies CMS_get0_type(), CMS_get0_eContentType() and 36136849SscottlCMS_get0_content() return internal pointers which should B<not> be freed up. 37136849SscottlCMS_set1_eContentType() copies the supplied OID and it B<should> be freed up 38136849Sscottlafter use. 39136849Sscottl 40136849SscottlThe B<ASN1_OBJECT> values returned can be converted to an integer B<NID> value 41136849Sscottlusing OBJ_obj2nid(). For the currently supported content types the following 42136849Sscottlvalues are returned: 43136849Sscottl 44136849Sscottl NID_pkcs7_data 45136849Sscottl NID_pkcs7_signed 46136849Sscottl NID_pkcs7_digest 47136849Sscottl NID_id_smime_ct_compressedData: 48136849Sscottl NID_pkcs7_encrypted 49136849Sscottl NID_pkcs7_enveloped 50149871Sscottl 51211690SimpThe return value of CMS_get0_content() is a pointer to the B<ASN1_OCTET_STRING> 52136849Sscottlcontent pointer. That means that for example: 53 54 ASN1_OCTET_STRING **pconf = CMS_get0_content(cms); 55 56B<*pconf> could be NULL if there is no embedded content. Applications can 57access, modify or create the embedded content in a B<CMS_ContentInfo> structure 58using this function. Applications usually will not need to modify the 59embedded content as it is normally set by higher level functions. 60 61=head1 RETURN VALUES 62 63CMS_get0_type() and CMS_get0_eContentType() return and ASN1_OBJECT structure. 64 65CMS_set1_eContentType() returns 1 for success or 0 if an error occurred. The 66error can be obtained from ERR_get_error(3). 67 68=head1 SEE ALSO 69 70L<ERR_get_error(3)|ERR_get_error(3)> 71 72=head1 HISTORY 73 74CMS_get0_type(), CMS_set1_eContentType() and CMS_get0_eContentType() were all 75first added to OpenSSL 0.9.8 76 77=cut 78