1CMS_get0_type(3) OpenSSL CMS_get0_type(3)
2
3
4
6 CMS_get0_type, CMS_set1_eContentType, CMS_get0_eContentType, CMS_get0_content - get and set CMS content types and content
7
9 #include <openssl/cms.h>
10
11 const ASN1_OBJECT *CMS_get0_type(CMS_ContentInfo *cms);
12 int CMS_set1_eContentType(CMS_ContentInfo *cms, const ASN1_OBJECT *oid);
13 const ASN1_OBJECT *CMS_get0_eContentType(CMS_ContentInfo *cms);
14 ASN1_OCTET_STRING **CMS_get0_content(CMS_ContentInfo *cms);
15
17 CMS_get0_type() returns the content type of a CMS_ContentInfo structure
18 as and ASN1_OBJECT pointer. An application can then decide how to
19 process the CMS_ContentInfo structure based on this value.
20
21 CMS_set1_eContentType() sets the embedded content type of a
22 CMS_ContentInfo structure. It should be called with CMS functions with
23 the CMS_PARTIAL flag and before the structure is finalised, otherwise
24 the results are undefined.
25
26 ASN1_OBJECT *CMS_get0_eContentType() returns a pointer to the embedded
27 content type.
28
29 CMS_get0_content() returns a pointer to the ASN1_OCTET_STRING pointer
30 containing the embedded content.
31
33 As the 0 implies CMS_get0_type(), CMS_get0_eContentType() and
34 CMS_get0_content() return internal pointers which should not be freed
35 up. CMS_set1_eContentType() copies the supplied OID and it should be
36 freed up after use.
37
38 The ASN1_OBJECT values returned can be converted to an integer NID
39 value using OBJ_obj2nid(). For the currently supported content types
40 the following values are returned:
41
42 NID_pkcs7_data
43 NID_pkcs7_signed
44 NID_pkcs7_digest
45 NID_id_smime_ct_compressedData:
46 NID_pkcs7_encrypted
47 NID_pkcs7_enveloped
48
49 The return value of CMS_get0_content() is a pointer to the
50 ASN1_OCTET_STRING content pointer. That means that for example:
51
52 ASN1_OCTET_STRING **pconf = CMS_get0_content(cms);
53
54 *pconf could be NULL if there is no embedded content. Applications can
55 access, modify or create the embedded content in a CMS_ContentInfo
56 structure using this function. Applications usually will not need to
57 modify the embedded content as it is normally set by higher level
58 functions.
59
61 CMS_get0_type() and CMS_get0_eContentType() return and ASN1_OBJECT
62 structure.
63
64 CMS_set1_eContentType() returns 1 for success or 0 if an error
65 occurred. The error can be obtained from ERR_get_error(3).
66
68 ERR_get_error(3)
69
71 CMS_get0_type(), CMS_set1_eContentType() and CMS_get0_eContentType()
72 were all first added to OpenSSL 0.9.8
73
74
75
761.0.2o 2020-08-01 CMS_get0_type(3)