1CMS_GET0_TYPE(3) OpenSSL CMS_GET0_TYPE(3)
2
3
4
6 CMS_get0_type, CMS_set1_eContentType, CMS_get0_eContentType,
7 CMS_get0_content - get and set CMS content types and content
8
10 #include <openssl/cms.h>
11
12 const ASN1_OBJECT *CMS_get0_type(const CMS_ContentInfo *cms);
13 int CMS_set1_eContentType(CMS_ContentInfo *cms, const ASN1_OBJECT *oid);
14 const ASN1_OBJECT *CMS_get0_eContentType(CMS_ContentInfo *cms);
15 ASN1_OCTET_STRING **CMS_get0_content(CMS_ContentInfo *cms);
16
18 CMS_get0_type() returns the content type of a CMS_ContentInfo structure
19 as an ASN1_OBJECT pointer. An application can then decide how to
20 process the CMS_ContentInfo structure based on this value.
21
22 CMS_set1_eContentType() sets the embedded content type of a
23 CMS_ContentInfo structure. It should be called with CMS functions (such
24 as CMS_sign, CMS_encrypt) with the CMS_PARTIAL flag and before the
25 structure is finalised, otherwise the results are undefined.
26
27 ASN1_OBJECT *CMS_get0_eContentType() returns a pointer to the embedded
28 content type.
29
30 CMS_get0_content() returns a pointer to the ASN1_OCTET_STRING pointer
31 containing the embedded content.
32
34 As the 0 implies CMS_get0_type(), CMS_get0_eContentType() and
35 CMS_get0_content() return internal pointers which should not be freed
36 up. CMS_set1_eContentType() copies the supplied OID and it should be
37 freed up after use.
38
39 The ASN1_OBJECT values returned can be converted to an integer NID
40 value using OBJ_obj2nid(). For the currently supported content types
41 the following values are returned:
42
43 NID_pkcs7_data
44 NID_pkcs7_signed
45 NID_pkcs7_digest
46 NID_id_smime_ct_compressedData:
47 NID_pkcs7_encrypted
48 NID_pkcs7_enveloped
49
50 The return value of CMS_get0_content() is a pointer to the
51 ASN1_OCTET_STRING content pointer. That means that for example:
52
53 ASN1_OCTET_STRING **pconf = CMS_get0_content(cms);
54
55 *pconf could be NULL if there is no embedded content. Applications can
56 access, modify or create the embedded content in a CMS_ContentInfo
57 structure using this function. Applications usually will not need to
58 modify the embedded content as it is normally set by higher level
59 functions.
60
62 CMS_get0_type() and CMS_get0_eContentType() return an ASN1_OBJECT
63 structure.
64
65 CMS_set1_eContentType() returns 1 for success or 0 if an error
66 occurred. The error can be obtained from ERR_get_error(3).
67
69 ERR_get_error(3)
70
72 Copyright 2008-2019 The OpenSSL Project Authors. All Rights Reserved.
73
74 Licensed under the OpenSSL license (the "License"). You may not use
75 this file except in compliance with the License. You can obtain a copy
76 in the file LICENSE in the source distribution or at
77 <https://www.openssl.org/source/license.html>.
78
79
80
811.1.1q 2022-07-21 CMS_GET0_TYPE(3)