summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/man/X509V3_get_d2i.3
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/man/X509V3_get_d2i.3')
-rw-r--r--src/lib/libcrypto/man/X509V3_get_d2i.3386
1 files changed, 386 insertions, 0 deletions
diff --git a/src/lib/libcrypto/man/X509V3_get_d2i.3 b/src/lib/libcrypto/man/X509V3_get_d2i.3
new file mode 100644
index 0000000000..cd3bb844b5
--- /dev/null
+++ b/src/lib/libcrypto/man/X509V3_get_d2i.3
@@ -0,0 +1,386 @@
1.\" $OpenBSD: X509V3_get_d2i.3,v 1.1 2016/12/04 20:51:47 schwarze Exp $
2.\" OpenSSL 047dd81e Jul 4 23:03:17 2014 +0100
3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
5.\" Copyright (c) 2014, 2016 The OpenSSL Project. All rights reserved.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\"
11.\" 1. Redistributions of source code must retain the above copyright
12.\" notice, this list of conditions and the following disclaimer.
13.\"
14.\" 2. Redistributions in binary form must reproduce the above copyright
15.\" notice, this list of conditions and the following disclaimer in
16.\" the documentation and/or other materials provided with the
17.\" distribution.
18.\"
19.\" 3. All advertising materials mentioning features or use of this
20.\" software must display the following acknowledgment:
21.\" "This product includes software developed by the OpenSSL Project
22.\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
23.\"
24.\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
25.\" endorse or promote products derived from this software without
26.\" prior written permission. For written permission, please contact
27.\" openssl-core@openssl.org.
28.\"
29.\" 5. Products derived from this software may not be called "OpenSSL"
30.\" nor may "OpenSSL" appear in their names without prior written
31.\" permission of the OpenSSL Project.
32.\"
33.\" 6. Redistributions of any form whatsoever must retain the following
34.\" acknowledgment:
35.\" "This product includes software developed by the OpenSSL Project
36.\" for use in the OpenSSL Toolkit (http://www.openssl.org/)"
37.\"
38.\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
39.\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
40.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
41.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
42.\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
43.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
44.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
45.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
46.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
47.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\"
51.Dd $Mdocdate: December 4 2016 $
52.Dt X509V3_GET_D2I 3
53.Os
54.Sh NAME
55.Nm X509V3_get_d2i ,
56.Nm X509V3_add1_i2d ,
57.Nm X509V3_EXT_d2i ,
58.Nm X509V3_EXT_i2d ,
59.Nm X509_get_ext_d2i ,
60.Nm X509_add1_ext_i2d ,
61.Nm X509_CRL_get_ext_d2i ,
62.Nm X509_CRL_add1_ext_i2d ,
63.Nm X509_REVOKED_get_ext_d2i ,
64.Nm X509_REVOKED_add1_ext_i2d
65.Nd X509 extension decode and encode functions
66.Sh SYNOPSIS
67.In openssl/x509v3.h
68.Ft void *
69.Fo X509V3_get_d2i
70.Fa "const STACK_OF(X509_EXTENSION) *x"
71.Fa "int nid"
72.Fa "int *crit"
73.Fa "int *idx"
74.Fc
75.Ft int
76.Fo X509V3_add1_i2d
77.Fa "STACK_OF(X509_EXTENSION) **x"
78.Fa "int nid"
79.Fa "void *value"
80.Fa "int crit"
81.Fa "unsigned long flags"
82.Fc
83.Ft void *
84.Fo X509V3_EXT_d2i
85.Fa "X509_EXTENSION *ext"
86.Fc
87.Ft X509_EXTENSION *
88.Fo X509V3_EXT_i2d
89.Fa "int ext_nid"
90.Fa "int crit"
91.Fa "void *ext"
92.Fc
93.Ft void *
94.Fo X509_get_ext_d2i
95.Fa "const X509 *x"
96.Fa "int nid"
97.Fa "int *crit"
98.Fa "int *idx"
99.Fc
100.Ft int
101.Fo X509_add1_ext_i2d
102.Fa "X509 *x"
103.Fa "int nid"
104.Fa "void *value"
105.Fa "int crit"
106.Fa "unsigned long flags"
107.Fc
108.Ft void *
109.Fo X509_CRL_get_ext_d2i
110.Fa "const X509_CRL *crl"
111.Fa "int nid"
112.Fa "int *crit"
113.Fa "int *idx"
114.Fc
115.Ft int
116.Fo X509_CRL_add1_ext_i2d
117.Fa "X509_CRL *crl"
118.Fa "int nid"
119.Fa "void *value"
120.Fa "int crit"
121.Fa "unsigned long flags"
122.Fc
123.Ft void *
124.Fo X509_REVOKED_get_ext_d2i
125.Fa "const X509_REVOKED *r"
126.Fa "int nid"
127.Fa "int *crit"
128.Fa "int *idx"
129.Fc
130.Ft int
131.Fo X509_REVOKED_add1_ext_i2d
132.Fa "X509_REVOKED *r"
133.Fa "int nid"
134.Fa "void *value"
135.Fa "int crit"
136.Fa "unsigned long flags"
137.Fc
138.Sh DESCRIPTION
139.Fn X509V3_get_d2i
140looks for an extension with OID
141.Fa nid
142in the extensions
143.Fa x
144and, if found, decodes it.
145If
146.Fa idx
147is
148.Dv NULL ,
149then only one occurrence of an extension is permissible.
150Otherwise the first extension after index
151.Pf * Fa idx
152is returned and
153.Pf * Fa idx
154is updated to the location of the extension.
155If
156.Fa crit
157is not
158.Dv NULL ,
159then
160.Pf * Fa crit
161is set to a status value: -2 if the extension occurs multiple times
162(this is only returned if
163.Fa idx
164is
165.Dv NULL ) ,
166-1 if the extension could not be found, 0 if the extension is found
167and is not critical, and 1 if it is critical.
168A pointer to an extension specific structure or
169.Dv NULL
170is returned.
171.Pp
172.Fn X509V3_add1_i2d
173adds extension
174.Fa value
175to STACK
176.Pf * Fa x
177(allocating a new STACK if necessary) using OID
178.Fa nid
179and criticality
180.Fa crit
181according to
182.Fa flags .
183.Pp
184.Fn X509V3_EXT_d2i
185attempts to decode the ASN.1 data contained in extension
186.Fa ext
187and returns a pointer to an extension specific structure or
188.Dv NULL
189if the extension could not be decoded (invalid syntax or not supported).
190.Pp
191.Fn X509V3_EXT_i2d
192encodes the extension specific structure
193.Fa ext
194with OID
195.Fa ext_nid
196and criticality
197.Fa crit .
198.Pp
199.Fn X509_get_ext_d2i
200and
201.Fn X509_add1_ext_i2d
202operate on the extensions of certificate
203.Fa x ,
204they are otherwise identical to
205.Fn X509V3_get_d2i
206and
207.Fn X509V3_add1_i2d 3 .
208.Pp
209.Fn X509_CRL_get_ext_d2i
210and
211.Fn X509_CRL_add1_ext_i2d
212operate on the extensions of CRL
213.Fa crl ,
214they are otherwise identical to
215.Fn X509V3_get_d2i
216and
217.Fn X509V3_add1_i2d 3 .
218.Pp
219.Fn X509_REVOKED_get_ext_d2i
220and
221.Fn X509_REVOKED_add1_ext_i2d
222operate on the extensions of the
223.Vt X509_REVOKED
224structure
225.Fa r
226(i.e. for CRL entry extensions), they are otherwise identical to
227.Fn X509V3_get_d2i
228and
229.Fn X509V3_add1_i2d 3 .
230.Pp
231In almost all cases an extension can occur at most once and multiple
232occurrences is an error.
233Therefore the
234.Fa idx
235parameter is usually
236.Dv NULL .
237.Pp
238The
239.Fa flags
240parameter may be one of the following values.
241.Pp
242.Dv X509V3_ADD_DEFAULT
243appends a new extension only if the extension does not already exist.
244An error is returned if the extension does already exist.
245.Pp
246.Dv X509V3_ADD_APPEND
247appends a new extension, ignoring whether the extension already exists.
248.Pp
249.Dv X509V3_ADD_REPLACE
250replaces an extension if it exists otherwise appends a new extension.
251.Pp
252.Dv X509V3_ADD_REPLACE_EXISTING
253replaces an existing extension if it exists otherwise returns an error.
254.Pp
255.Dv X509V3_ADD_KEEP_EXISTING
256appends a new extension only if the extension does not already exist.
257An error
258.Sy is not
259returned if the extension does already exist.
260.Pp
261.Dv X509V3_ADD_DELETE
262deletes extension
263.Fa nid .
264No new extension is added.
265.Pp
266If
267.Dv X509V3_ADD_SILENT
268is ored with
269.Fa flags ,
270any error returned will not be added to the error queue.
271.Pp
272The function
273.Fn X509V3_get_d2i
274will return
275.Dv NULL
276if the extension is not found, occurs multiple times or cannot be
277decoded.
278It is possible to determine the precise reason by checking the value of
279.Pf * Fa crit .
280.Sh SUPPORTED EXTENSIONS
281The following sections contain a list of all supported extensions
282including their name and NID.
283.Ss PKIX Certificate Extensions
284The following certificate extensions are defined in PKIX standards such
285as RFC5280.
286.Bl -column 30n 30n
287.It Basic Constraints Ta Dv NID_basic_constraints
288.It Key Usage Ta Dv NID_key_usage
289.It Extended Key Usage Ta Dv NID_ext_key_usage
290.It Subject Key Identifier Ta Dv NID_subject_key_identifier
291.It Authority Key Identifier Ta Dv NID_authority_key_identifier
292.It Private Key Usage Period Ta Dv NID_private_key_usage_period
293.It Subject Alternative Name Ta Dv NID_subject_alt_name
294.It Issuer Alternative Name Ta Dv NID_issuer_alt_name
295.It Authority Information Access Ta Dv NID_info_access
296.It Subject Information Access Ta Dv NID_sinfo_access
297.It Name Constraints Ta Dv NID_name_constraints
298.It Certificate Policies Ta Dv NID_certificate_policies
299.It Policy Mappings Ta Dv NID_policy_mappings
300.It Policy Constraints Ta Dv NID_policy_constraints
301.It Inhibit Any Policy Ta Dv NID_inhibit_any_policy
302.El
303.Ss Netscape Certificate Extensions
304The following are (largely obsolete) Netscape certificate extensions.
305.Bl -column 30n 30n
306.It Netscape Cert Type Ta Dv NID_netscape_cert_type
307.It Netscape Base Url Ta Dv NID_netscape_base_url
308.It Netscape Revocation Url Ta Dv NID_netscape_revocation_url
309.It Netscape CA Revocation Url Ta Dv NID_netscape_ca_revocation_url
310.It Netscape Renewal Url Ta Dv NID_netscape_renewal_url
311.It Netscape CA Policy Url Ta Dv NID_netscape_ca_policy_url
312.It Netscape SSL Server Name Ta Dv NID_netscape_ssl_server_name
313.It Netscape Comment Ta Dv NID_netscape_comment
314.El
315.Ss Miscellaneous Certificate Extensions
316.Bl -column 30n 30n
317.It Strong Extranet ID Ta Dv NID_sxnet
318.It Proxy Certificate Information Ta Dv NID_proxyCertInfo
319.El
320.Ss PKIX CRL Extensions
321The following are CRL extensions from PKIX standards such as RFC5280.
322.Bl -column 30n 30n
323.It CRL Number Ta Dv NID_crl_number
324.It CRL Distribution Points Ta Dv NID_crl_distribution_points
325.It Delta CRL Indicator Ta Dv NID_delta_crl
326.It Freshest CRL Ta Dv NID_freshest_crl
327.It Invalidity Date Ta Dv NID_invalidity_date
328.It Issuing Distribution Point Ta Dv NID_issuing_distribution_point
329.El
330.Pp
331The following are CRL entry extensions from PKIX standards such as
332RFC5280.
333.Bl -column 30n 30n
334.It CRL Reason Code Ta Dv NID_crl_reason
335.It Certificate Issuer Ta Dv NID_certificate_issuer
336.El
337.Ss OCSP Extensions
338.Bl -column 30n 30n
339.It OCSP Nonce Ta Dv NID_id_pkix_OCSP_Nonce
340.It OCSP CRL ID Ta Dv NID_id_pkix_OCSP_CrlID
341.It Acceptable OCSP Responses Ta Dv NID_id_pkix_OCSP_acceptableResponses
342.It OCSP No Check Ta Dv NID_id_pkix_OCSP_noCheck
343.It OCSP Archive Cutoff Ta Dv NID_id_pkix_OCSP_archiveCutoff
344.It OCSP Service Locator Ta Dv NID_id_pkix_OCSP_serviceLocator
345.It Hold Instruction Code Ta Dv NID_hold_instruction_code
346.El
347.Ss Certificate Transparency Extensions
348The following extensions are used by certificate transparency, RFC6962
349.Bl -column 30n 30n
350.It CT Precertificate SCTs Ta Dv NID_ct_precert_scts
351.It CT Certificate SCTs Ta Dv NID_ct_cert_scts
352.El
353.Sh RETURN VALUES
354.Fn X509V3_get_d2i
355and
356.Fn X509V3_EXT_d2i
357return a pointer to an extension specific structure or
358.Dv NULL
359if an error occurs.
360.Pp
361.Fn X509V3_EXT_i2d
362returns a pointer to an
363.Vt X509_EXTENSION
364structure or
365.Dv NULL
366if an error occurs.
367.Pp
368.Fn X509V3_add1_i2d
369returns 1 if the operation is successful, 0 if it fails due to a
370non-fatal error (extension not found, already exists, cannot be encoded),
371or -1 due to a fatal error such as a memory allocation failure.
372.Sh SEE ALSO
373.Xr d2i_X509 3 ,
374.Xr ERR_get_error 3 ,
375.Xr X509_CRL_get0_by_serial 3 ,
376.Xr X509_get_ext_d2i 3 ,
377.Xr X509_get_pubkey 3 ,
378.Xr X509_get_subject_name 3 ,
379.Xr X509_get_version 3 ,
380.Xr X509_NAME_add_entry_by_txt 3 ,
381.Xr X509_NAME_ENTRY_get_object 3 ,
382.Xr X509_NAME_get_index_by_NID 3 ,
383.Xr X509_NAME_print_ex 3 ,
384.Xr X509_new 3 ,
385.Xr X509_sign 3 ,
386.Xr X509_verify_cert 3