diff options
author | schwarze <> | 2019-08-18 10:19:17 +0000 |
---|---|---|
committer | schwarze <> | 2019-08-18 10:19:17 +0000 |
commit | e360bef01a516dca14b713c3ac2b4319392d9151 (patch) | |
tree | 4815b9ba29c43dfde05f13c826a4d81105f56f2b /src | |
parent | 34632f990b58b7428f0342e7233269b003e3008c (diff) | |
download | openbsd-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.3 | 142 |
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 |
81 | returns the content type of a | 98 | returns the content type of the |
82 | .Vt CMS_ContentInfo | 99 | .Vt ContentInfo |
83 | structure as an | 100 | structure |
101 | .Fa cms . | ||
102 | The | ||
84 | .Vt ASN1_OBJECT | 103 | .Vt ASN1_OBJECT |
85 | pointer. | 104 | value returned can be converted to an integer NID value using |
86 | An application can then decide how to process the | 105 | .Xr OBJ_obj2nid 3 . |
87 | .Vt CMS_ContentInfo | 106 | The following content types are identified by the following NIDs: |
88 | structure based on this value. | ||
89 | .Pp | 107 | .Pp |
90 | .Fn CMS_set1_eContentType | 108 | .Bl -column AuthenticatedData NID_id_smime_ct_compressedData -compact |
91 | sets 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 |
93 | structure. | 111 | .It Vt DigestedData Ta Dv NID_pkcs7_digest |
94 | It 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 | ||
118 | The | ||
119 | .Vt SignedData , | ||
120 | .Vt DigestedData , | ||
121 | .Vt AuthenticatedData , | ||
122 | and | ||
123 | .Vt CompressedData | ||
124 | types contain a field | ||
125 | .Fa encapContentInfo | ||
126 | to allow embedding content, and | ||
127 | .Vt EnvelopedData | ||
128 | and | ||
129 | .Vt EncryptedData | ||
130 | contain a field | ||
131 | .Fa encryptedContentInfo | ||
132 | for that purpose. | ||
133 | The type of the embedded content to be stored in that field can be | ||
134 | set with the function | ||
135 | .Fn CMS_set1_eContentType , | ||
136 | to be called on | ||
137 | .Fa cms | ||
138 | structures returned from functions such as | ||
139 | .Xr CMS_sign 3 | ||
140 | or | ||
141 | .Xr CMS_encrypt 3 | ||
97 | with the | 142 | with the |
98 | .Dv CMS_PARTIAL | 143 | .Dv CMS_PARTIAL |
99 | flag and | 144 | flag set and |
100 | .Em before | 145 | .Em before |
101 | the structure is finalised, otherwise the results are undefined. | 146 | the structure is finalised; otherwise the results are undefined. |
102 | .Pp | ||
103 | .Fn CMS_get0_eContentType | ||
104 | returns a pointer to the embedded content type. | ||
105 | .Pp | ||
106 | .Fn CMS_get0_content | ||
107 | returns a pointer to the | ||
108 | .Vt ASN1_OCTET_STRING | ||
109 | pointer containing the embedded content. | ||
110 | .Pp | ||
111 | As the | ||
112 | .Sq 0 | ||
113 | in the function names imply, | ||
114 | .Fn CMS_get0_type , | ||
115 | .Fn CMS_get0_eContentType , | ||
116 | and | ||
117 | .Fn CMS_get0_content | ||
118 | return internal pointers which should | ||
119 | .Em not | ||
120 | be freed up. | ||
121 | .Fn CMS_set1_eContentType | 147 | .Fn CMS_set1_eContentType |
122 | copies the supplied OID and it | 148 | copies the supplied |
123 | .Em should | 149 | .Fa oid , |
124 | be freed up after use. | 150 | so it should be freed up after use. |
125 | .Pp | 151 | .Pp |
126 | The | 152 | .Fn CMS_get0_eContentType |
127 | .Vt ASN1_OBJECT | 153 | returns the type of the embedded content. |
128 | values returned can be converted to an integer NID value using | ||
129 | .Xr OBJ_obj2nid 3 . | ||
130 | For the currently supported content types the following values are | ||
131 | returned: | ||
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 |
139 | The return value of | ||
140 | .Fn CMS_get0_content | 155 | .Fn CMS_get0_content |
141 | is a pointer to the | 156 | returns a pointer to the storage location where the pointer to the |
142 | .Vt ASN1_OCTET_STRING | 157 | embedded content is stored. |
143 | content pointer. | ||
144 | That means that for example after | 158 | That 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 |
159 | and | 173 | and |
160 | .Fn CMS_get0_eContentType | 174 | .Fn CMS_get0_eContentType |
161 | return an | 175 | return internal pointers to |
162 | .Vt ASN1_OBJECT | 176 | .Vt OBJECT IDENTIFIER |
163 | structure. | 177 | structures. |
178 | .Pp | ||
179 | .Fn CMS_get0_content | ||
180 | returns an internal pointer to the storage location where the pointer | ||
181 | to the embedded content is stored. | ||
164 | .Pp | 182 | .Pp |
165 | .Fn CMS_set1_eContentType | 183 | .Fn CMS_set1_eContentType |
166 | returns 1 for success or 0 if an error occurred. | 184 | returns 1 for success or 0 if an error occurred. |
167 | The error can be obtained from | 185 | The error can be obtained from |
168 | .Xr ERR_get_error 3 . | 186 | .Xr ERR_get_error 3 . |
187 | .Sh STANDARDS | ||
188 | RFC 5652: Cryptographic Message Syntax | ||
189 | .Pp | ||
190 | RFC 3274: Compressed Data Content Type for Cryptographic Message Syntax (CMS) | ||
169 | .Sh HISTORY | 191 | .Sh HISTORY |
170 | These functions first appeared in OpenSSL 0.9.8h | 192 | These functions first appeared in OpenSSL 0.9.8h |
171 | and have been available since | 193 | and have been available since |