summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorschwarze <>2019-08-18 10:19:17 +0000
committerschwarze <>2019-08-18 10:19:17 +0000
commite360bef01a516dca14b713c3ac2b4319392d9151 (patch)
tree4815b9ba29c43dfde05f13c826a4d81105f56f2b /src
parent34632f990b58b7428f0342e7233269b003e3008c (diff)
downloadopenbsd-e360bef01a516dca14b713c3ac2b4319392d9151.tar.gz
openbsd-e360bef01a516dca14b713c3ac2b4319392d9151.tar.bz2
openbsd-e360bef01a516dca14b713c3ac2b4319392d9151.zip
some cleanup:
* do not jump back and forth among functions * show data type - NID correspondance in a table * make the difference between content type and embedded content clearer * add the missing STANDARDS section * mark up ASN.1 type names * remove some text that says nothing * and minor wording improvements
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/man/CMS_get0_type.3142
1 files changed, 82 insertions, 60 deletions
diff --git a/src/lib/libcrypto/man/CMS_get0_type.3 b/src/lib/libcrypto/man/CMS_get0_type.3
index 82dd660e3a..fe1e999efe 100644
--- a/src/lib/libcrypto/man/CMS_get0_type.3
+++ b/src/lib/libcrypto/man/CMS_get0_type.3
@@ -1,7 +1,24 @@
1.\" $OpenBSD: CMS_get0_type.3,v 1.4 2019/08/11 12:46:38 schwarze Exp $ 1.\" $OpenBSD: CMS_get0_type.3,v 1.5 2019/08/18 10:19:17 schwarze Exp $
2.\" full merge up to: OpenSSL 72a7a702 Feb 26 14:05:09 2019 +0000 2.\" full merge up to: OpenSSL 72a7a702 Feb 26 14:05:09 2019 +0000
3.\" 3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 4.\" This file is a derived work.
5.\" The changes are covered by the following Copyright and license:
6.\"
7.\" Copyright (c) 2019 Ingo Schwarze <schwarze@openbsd.org>
8.\"
9.\" Permission to use, copy, modify, and distribute this software for any
10.\" purpose with or without fee is hereby granted, provided that the above
11.\" copyright notice and this permission notice appear in all copies.
12.\"
13.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
14.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
15.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
16.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
17.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
18.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
19.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20.\"
21.\" The original file was written by Dr. Stephen Henson <steve@openssl.org>.
5.\" Copyright (c) 2008, 2015 The OpenSSL Project. All rights reserved. 22.\" Copyright (c) 2008, 2015 The OpenSSL Project. All rights reserved.
6.\" 23.\"
7.\" Redistribution and use in source and binary forms, with or without 24.\" Redistribution and use in source and binary forms, with or without
@@ -48,7 +65,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 66.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 67.\"
51.Dd $Mdocdate: August 11 2019 $ 68.Dd $Mdocdate: August 18 2019 $
52.Dt CMS_GET0_TYPE 3 69.Dt CMS_GET0_TYPE 3
53.Os 70.Os
54.Sh NAME 71.Sh NAME
@@ -78,69 +95,66 @@
78.Fc 95.Fc
79.Sh DESCRIPTION 96.Sh DESCRIPTION
80.Fn CMS_get0_type 97.Fn CMS_get0_type
81returns the content type of a 98returns the content type of the
82.Vt CMS_ContentInfo 99.Vt ContentInfo
83structure as an 100structure
101.Fa cms .
102The
84.Vt ASN1_OBJECT 103.Vt ASN1_OBJECT
85pointer. 104value returned can be converted to an integer NID value using
86An application can then decide how to process the 105.Xr OBJ_obj2nid 3 .
87.Vt CMS_ContentInfo 106The following content types are identified by the following NIDs:
88structure based on this value.
89.Pp 107.Pp
90.Fn CMS_set1_eContentType 108.Bl -column AuthenticatedData NID_id_smime_ct_compressedData -compact
91sets the embedded content type of a 109.It Vt SignedData Ta Dv NID_pkcs7_signed
92.Vt CMS_ContentInfo 110.It Vt EnvelopedData Ta Dv NID_pkcs7_enveloped
93structure. 111.It Vt DigestedData Ta Dv NID_pkcs7_digest
94It should be called with CMS functions (such as 112.It Vt EncryptedData Ta Dv NID_pkcs7_encrypted
95.Xr CMS_sign 3 , 113.It Vt AuthenticatedData Ta Dv NID_id_smime_ct_authData
96.Xr CMS_encrypt 3 ) 114.It Vt CompressedData Ta Dv NID_id_smime_ct_compressedData
115.It arbitrary data Ta Dv NID_pkcs7_data
116.El
117.Pp
118The
119.Vt SignedData ,
120.Vt DigestedData ,
121.Vt AuthenticatedData ,
122and
123.Vt CompressedData
124types contain a field
125.Fa encapContentInfo
126to allow embedding content, and
127.Vt EnvelopedData
128and
129.Vt EncryptedData
130contain a field
131.Fa encryptedContentInfo
132for that purpose.
133The type of the embedded content to be stored in that field can be
134set with the function
135.Fn CMS_set1_eContentType ,
136to be called on
137.Fa cms
138structures returned from functions such as
139.Xr CMS_sign 3
140or
141.Xr CMS_encrypt 3
97with the 142with the
98.Dv CMS_PARTIAL 143.Dv CMS_PARTIAL
99flag and 144flag set and
100.Em before 145.Em before
101the structure is finalised, otherwise the results are undefined. 146the structure is finalised; otherwise the results are undefined.
102.Pp
103.Fn CMS_get0_eContentType
104returns a pointer to the embedded content type.
105.Pp
106.Fn CMS_get0_content
107returns a pointer to the
108.Vt ASN1_OCTET_STRING
109pointer containing the embedded content.
110.Pp
111As the
112.Sq 0
113in the function names imply,
114.Fn CMS_get0_type ,
115.Fn CMS_get0_eContentType ,
116and
117.Fn CMS_get0_content
118return internal pointers which should
119.Em not
120be freed up.
121.Fn CMS_set1_eContentType 147.Fn CMS_set1_eContentType
122copies the supplied OID and it 148copies the supplied
123.Em should 149.Fa oid ,
124be freed up after use. 150so it should be freed up after use.
125.Pp 151.Pp
126The 152.Fn CMS_get0_eContentType
127.Vt ASN1_OBJECT 153returns the type of the embedded content.
128values returned can be converted to an integer NID value using
129.Xr OBJ_obj2nid 3 .
130For the currently supported content types the following values are
131returned:
132.Dv NID_pkcs7_data ,
133.Dv NID_pkcs7_signed ,
134.Dv NID_pkcs7_digest ,
135.Dv NID_id_smime_ct_compressedData ,
136.Dv NID_pkcs7_encrypted ,
137.Dv NID_pkcs7_enveloped .
138.Pp 154.Pp
139The return value of
140.Fn CMS_get0_content 155.Fn CMS_get0_content
141is a pointer to the 156returns a pointer to the storage location where the pointer to the
142.Vt ASN1_OCTET_STRING 157embedded content is stored.
143content pointer.
144That means that for example after 158That means that for example after
145.Pp 159.Pp
146.Dl ASN1_OCTET_STRING **pconf = CMS_get0_content(cms); 160.Dl ASN1_OCTET_STRING **pconf = CMS_get0_content(cms);
@@ -158,14 +172,22 @@ is normally set by higher level functions.
158.Fn CMS_get0_type 172.Fn CMS_get0_type
159and 173and
160.Fn CMS_get0_eContentType 174.Fn CMS_get0_eContentType
161return an 175return internal pointers to
162.Vt ASN1_OBJECT 176.Vt OBJECT IDENTIFIER
163structure. 177structures.
178.Pp
179.Fn CMS_get0_content
180returns an internal pointer to the storage location where the pointer
181to the embedded content is stored.
164.Pp 182.Pp
165.Fn CMS_set1_eContentType 183.Fn CMS_set1_eContentType
166returns 1 for success or 0 if an error occurred. 184returns 1 for success or 0 if an error occurred.
167The error can be obtained from 185The error can be obtained from
168.Xr ERR_get_error 3 . 186.Xr ERR_get_error 3 .
187.Sh STANDARDS
188RFC 5652: Cryptographic Message Syntax
189.Pp
190RFC 3274: Compressed Data Content Type for Cryptographic Message Syntax (CMS)
169.Sh HISTORY 191.Sh HISTORY
170These functions first appeared in OpenSSL 0.9.8h 192These functions first appeared in OpenSSL 0.9.8h
171and have been available since 193and have been available since