1 .\" $OpenBSD: X509_EXTENSION_set_object.3,v 1.6 2016/12/28 13:45:30 schwarze Exp $
2 .\" OpenSSL bb9ad09e Jun 6 00:43:05 2016 -0400
4 .\" This file is a derived work.
5 .\" The changes are covered by the following Copyright and license:
7 .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
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.
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.
21 .\" The original file was written by Dr. Stephen Henson <steve@openssl.org>.
22 .\" Copyright (c) 2015 The OpenSSL Project. All rights reserved.
24 .\" Redistribution and use in source and binary forms, with or without
25 .\" modification, are permitted provided that the following conditions
28 .\" 1. Redistributions of source code must retain the above copyright
29 .\" notice, this list of conditions and the following disclaimer.
31 .\" 2. Redistributions in binary form must reproduce the above copyright
32 .\" notice, this list of conditions and the following disclaimer in
33 .\" the documentation and/or other materials provided with the
36 .\" 3. All advertising materials mentioning features or use of this
37 .\" software must display the following acknowledgment:
38 .\" "This product includes software developed by the OpenSSL Project
39 .\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
41 .\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
42 .\" endorse or promote products derived from this software without
43 .\" prior written permission. For written permission, please contact
44 .\" openssl-core@openssl.org.
46 .\" 5. Products derived from this software may not be called "OpenSSL"
47 .\" nor may "OpenSSL" appear in their names without prior written
48 .\" permission of the OpenSSL Project.
50 .\" 6. Redistributions of any form whatsoever must retain the following
52 .\" "This product includes software developed by the OpenSSL Project
53 .\" for use in the OpenSSL Toolkit (http://www.openssl.org/)"
55 .\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
56 .\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
57 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
58 .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
59 .\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
60 .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
61 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
62 .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
63 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
64 .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
65 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
66 .\" OF THE POSSIBILITY OF SUCH DAMAGE.
68 .Dd $Mdocdate: December 28 2016 $
69 .Dt X509_EXTENSION_SET_OBJECT 3
72 .Nm X509_EXTENSION_new ,
73 .Nm X509_EXTENSION_free ,
74 .Nm X509_EXTENSION_create_by_NID ,
75 .Nm X509_EXTENSION_create_by_OBJ ,
76 .Nm X509_EXTENSION_set_object ,
77 .Nm X509_EXTENSION_set_critical ,
78 .Nm X509_EXTENSION_set_data ,
79 .Nm X509_EXTENSION_get_object ,
80 .Nm X509_EXTENSION_get_critical ,
81 .Nm X509_EXTENSION_get_data
82 .\" In the next line, the capital "E" is not a typo.
83 .\" The ASN.1 structure is called "Extension", not "extension".
84 .Nd create, change, and inspect X.509 Extension objects
88 .Fn X509_EXTENSION_new void
90 .Fn X509_EXTENSION_free "X509_EXTENSION *ex"
92 .Fo X509_EXTENSION_create_by_NID
93 .Fa "X509_EXTENSION **ex"
96 .Fa "ASN1_OCTET_STRING *data"
99 .Fo X509_EXTENSION_create_by_OBJ
100 .Fa "X509_EXTENSION **ex"
101 .Fa "ASN1_OBJECT *obj"
103 .Fa "ASN1_OCTET_STRING *data"
106 .Fo X509_EXTENSION_set_object
107 .Fa "X509_EXTENSION *ex"
108 .Fa "ASN1_OBJECT *obj"
111 .Fo X509_EXTENSION_set_critical
112 .Fa "X509_EXTENSION *ex"
116 .Fo X509_EXTENSION_set_data
117 .Fa "X509_EXTENSION *ex"
118 .Fa "ASN1_OCTET_STRING *data"
121 .Fo X509_EXTENSION_get_object
122 .Fa "X509_EXTENSION *ex"
125 .Fo X509_EXTENSION_get_critical
126 .Fa "X509_EXTENSION *ex"
128 .Ft ASN1_OCTET_STRING *
129 .Fo X509_EXTENSION_get_data
130 .Fa "X509_EXTENSION *ne"
133 .Fn X509_EXTENSION_new
134 allocates and initializes an empty
136 object, representing an ASN.1
138 structure defined in RFC 5280 section 4.1.
139 It is a wrapper object around specific extension objects of different
140 types and stores an extension type identifier and a criticality
141 flag in addition to the DER-encoded form of the wrapped object.
143 objects can be used for X.509 v3 certificates inside
145 objects and for X.509 v2 certificate revocation lists inside
151 .Fn X509_EXTENSION_free
154 and all objects it is using.
156 .Fn X509_EXTENSION_create_by_NID
157 creates an extension of type
163 The created extension is returned and written to
165 reusing or allocating a new extension if necessary, so
172 It must not be an uninitialised pointer.
174 .Fn X509_EXTENSION_create_by_OBJ
176 .Fn X509_EXTENSION_create_by_NID
177 except that it creates an extension using
181 .Fn X509_EXTENSION_set_object
182 sets the extension type of
188 pointer is duplicated internally so
190 should be freed up after use.
192 .Fn X509_EXTENSION_set_critical
193 sets the criticality of
199 is zero, the extension in non-critical, otherwise it is critical.
201 .Fn X509_EXTENSION_set_data
202 sets the data in extension
208 pointer is duplicated internally.
210 .Fn X509_EXTENSION_get_object
211 returns the extension type of
216 The returned pointer is an internal value which must not be freed up.
218 .Fn X509_EXTENSION_get_critical
219 returns the criticality of extension
221 it returns 1 for critical and 0 for non-critical.
223 .Fn X509_EXTENSION_get_data
224 returns the data of extension
226 The returned pointer is an internal value which must not be freed up.
228 These functions manipulate the contents of an extension directly.
229 Most applications will want to parse or encode and add an extension:
230 they should use the extension encode and decode functions instead
232 .Xr X509_add1_ext_i2d 3
234 .Xr X509_get_ext_d2i 3 .
238 associated with an extension is the extension encoding in an
239 .Vt ASN1_OCTET_STRING
242 .Fn X509_EXTENSION_new ,
243 .Fn X509_EXTENSION_create_by_NID ,
245 .Fn X509_EXTENSION_create_by_OBJ
252 .Fn X509_EXTENSION_set_object ,
253 .Fn X509_EXTENSION_set_critical ,
255 .Fn X509_EXTENSION_set_data
256 return 1 for success or 0 for failure.
258 .Fn X509_EXTENSION_get_object
263 .Fn X509_EXTENSION_get_critical
264 returns 0 for non-critical or 1 for critical.
266 .Fn X509_EXTENSION_get_data
268 .Vt ASN1_OCTET_STRING
271 .Xr ACCESS_DESCRIPTION_new 3 ,
272 .Xr AUTHORITY_KEYID_new 3 ,
273 .Xr BASIC_CONSTRAINTS_new 3 ,
274 .Xr d2i_X509_EXTENSION 3 ,
275 .Xr DIST_POINT_new 3 ,
276 .Xr EXTENDED_KEY_USAGE_new 3 ,
277 .Xr NAME_CONSTRAINTS_new 3 ,
278 .Xr OCSP_CRLID_new 3 ,
279 .Xr OCSP_SERVICELOC_new 3 ,
280 .Xr PKEY_USAGE_PERIOD_new 3 ,
281 .Xr POLICYINFO_new 3 ,
282 .Xr PROXY_POLICY_new 3 ,
284 .Xr X509V3_get_d2i 3 ,
285 .Xr X509v3_get_ext_by_NID 3
287 RFC 5280: Internet X.509 Public Key Infrastructure Certificate and
288 Certificate Revocation List (CRL) Profile