summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortb <>2021-10-23 15:30:07 +0000
committertb <>2021-10-23 15:30:07 +0000
commit8a4205600da6d322fe39cf30885466efc776f5b8 (patch)
tree3fa57fde438c2586afd5c6e79c98c4877f55b178 /src
parent93f797fe658e7c61255e54ae917d50fd1b6092f3 (diff)
downloadopenbsd-8a4205600da6d322fe39cf30885466efc776f5b8.tar.gz
openbsd-8a4205600da6d322fe39cf30885466efc776f5b8.tar.bz2
openbsd-8a4205600da6d322fe39cf30885466efc776f5b8.zip
Import documentation for X509_get_extension_flags, X509_get_key_usage,
X509_get_extended_key_usage from OpenSSL. Will be linked to the build after the bump. input/lgtm schwarze
Diffstat (limited to 'src')
-rw-r--r--src/lib/libssl/man/X509_get_extension_flags.3211
1 files changed, 211 insertions, 0 deletions
diff --git a/src/lib/libssl/man/X509_get_extension_flags.3 b/src/lib/libssl/man/X509_get_extension_flags.3
new file mode 100644
index 0000000000..665f59a809
--- /dev/null
+++ b/src/lib/libssl/man/X509_get_extension_flags.3
@@ -0,0 +1,211 @@
1.\" $OpenBSD: X509_get_extension_flags.3,v 1.1 2021/10/23 15:30:07 tb Exp $
2.\" full merge up to: OpenSSL 361136f4 Sep 1 18:56:58 2015 +0100
3.\" selective merge up to: OpenSSL 2b2e3106f Feb 16 15:04:45 2021 +0000
4.\"
5.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
6.\" Copyright (c) 2015 The OpenSSL Project. All rights reserved.
7.\"
8.\" Redistribution and use in source and binary forms, with or without
9.\" modification, are permitted provided that the following conditions
10.\" are met:
11.\"
12.\" 1. Redistributions of source code must retain the above copyright
13.\" notice, this list of conditions and the following disclaimer.
14.\"
15.\" 2. Redistributions in binary form must reproduce the above copyright
16.\" notice, this list of conditions and the following disclaimer in
17.\" the documentation and/or other materials provided with the
18.\" distribution.
19.\"
20.\" 3. All advertising materials mentioning features or use of this
21.\" software must display the following acknowledgment:
22.\" "This product includes software developed by the OpenSSL Project
23.\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
24.\"
25.\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26.\" endorse or promote products derived from this software without
27.\" prior written permission. For written permission, please contact
28.\" openssl-core@openssl.org.
29.\"
30.\" 5. Products derived from this software may not be called "OpenSSL"
31.\" nor may "OpenSSL" appear in their names without prior written
32.\" permission of the OpenSSL Project.
33.\"
34.\" 6. Redistributions of any form whatsoever must retain the following
35.\" acknowledgment:
36.\" "This product includes software developed by the OpenSSL Project
37.\" for use in the OpenSSL Toolkit (http://www.openssl.org/)"
38.\"
39.\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40.\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
43.\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\"
52.Dd $Mdocdate: October 23 2021 $
53.Dt X509_GET_EXTENSION_FLAGS 3
54.Os
55.Sh NAME
56.Nm X509_get_extension_flags ,
57.Nm X509_get_key_usage ,
58.Nm X509_get_extended_key_usage
59.Nd retrieve certificate extension data
60.Sh SYNOPSIS
61.In openssl/x509v3.h
62.Ft uint32_t
63.Fo X509_get_extension_flags
64.Fa "X509 *x"
65.Fc
66.Ft uint32_t
67.Fo X509_get_key_usage
68.Fa "X509 *x"
69.Fc
70.Ft uint32_t
71.Fo X509_get_extended_key_usage
72.Fa "X509 *x"
73.Fc
74.Sh DESCRIPTION
75These functions retrieve information related to commonly used
76certificate extensions.
77.Pp
78.Fn X509_get_extension_flags
79retrieves general information about a certificate, it will return one or
80more of the following flags ored together.
81.Bl -tag -width Ds
82.It Dv EXFLAG_V1
83The certificate is an obsolete version 1 certificate.
84.It Dv EXFLAG_BCONS
85The certificate contains a basic constraints extension.
86.It Dv EXFLAG_CA
87The certificate contains basic constraints and asserts the CA flag.
88.It Dv EXFLAG_PROXY
89The certificate is a valid proxy certificate.
90.It Dv EXFLAG_SI
91The certificate is self issued (that is subject and issuer names match).
92.It Dv EXFLAG_SS
93The subject and issuer names match and extension values imply it is self
94signed.
95.It Dv EXFLAG_FRESHEST
96The freshest CRL extension is present in the certificate.
97.It Dv EXFLAG_CRITICAL
98The certificate contains an unhandled critical extension.
99.It Dv EXFLAG_INVALID
100Some certificate extension values are invalid or inconsistent.
101The certificate should be rejected.
102This bit may also be raised after an out-of-memory error while
103processing the X509 object, so it may not be related to the processed
104ASN1 object itself.
105.\" EXFLAG_NO_FINGERPRINT is not available in LibreSSL. Do we need
106.\" https://github.com/openssl/openssl/issues/13698 and the fix it fixes?
107.\".It Dv EXFLAG_NO_FINGERPRINT
108.\" Failed to compute the internal SHA1 hash value of the certificate.
109.\" This may be due to malloc failure or because no SHA1 implementation was
110.\" found.
111.It Dv EXFLAG_INVALID_POLICY
112The
113.Dv NID_certificate_policies
114certificate extension is invalid or inconsistent.
115The certificate should be rejected.
116This bit may also be raised after an out-of-memory error while
117processing the X509 object, so it may not be related to the processed
118ASN1 object itself.
119.It Dv EXFLAG_KUSAGE
120The certificate contains a key usage extension.
121The value can be retrieved using
122.Fn X509_get_key_usage .
123.It Dv EXFLAG_XKUSAGE
124The certificate contains an extended key usage extension.
125The value can be retrieved using
126.Fn X509_get_extended_key_usage .
127.El
128.Pp
129.Fn X509_get_key_usage
130returns the value of the key usage extension.
131If key usage is present will return zero or more of the flags:
132.Dv KU_DIGITAL_SIGNATURE ,
133.Dv KU_NON_REPUDIATION ,
134.Dv KU_KEY_ENCIPHERMENT ,
135.Dv KU_DATA_ENCIPHERMENT ,
136.Dv KU_KEY_AGREEMENT ,
137.Dv KU_KEY_CERT_SIGN ,
138.Dv KU_CRL_SIGN ,
139.Dv KU_ENCIPHER_ONLY
140or
141.Dv KU_DECIPHER_ONLY
142corresponding to individual key usage bits.
143If key usage is absent then
144.Dv UINT32_MAX
145is returned.
146.Pp
147.Fn X509_get_extended_key_usage
148returns the value of the extended key usage extension.
149If extended key usage is present it will return zero or more of the
150flags:
151.Dv XKU_SSL_SERVER ,
152.Dv XKU_SSL_CLIENT ,
153.Dv XKU_SMIME ,
154.Dv XKU_CODE_SIGN
155.Dv XKU_OCSP_SIGN ,
156.Dv XKU_TIMESTAMP ,
157.Dv XKU_DVCS ,
158or
159.Dv XKU_ANYEKU .
160These correspond to the OIDs
161.Qq id-kp-serverAuth ,
162.Qq id-kp-clientAuth ,
163.Qq id-kp-emailProtection ,
164.Qq id-kp-codeSigning ,
165.Qq id-kp-OCSPSigning ,
166.Qq id-kp-timeStamping ,
167.Qq id-kp-dvcs ,
168and
169.Qq anyExtendedKeyUsage ,
170respectively.
171Additionally,
172.Dv XKU_SGC
173is set if either Netscape or Microsoft SGC OIDs are present.
174.Pp
175The value of the flags correspond to extension values which are cached
176in the
177.Vt X509
178structure.
179If the flags returned do not provide sufficient information,
180an application should examine extension values directly,
181for example using
182.Xr X509_get_ext_d2i 3 .
183.Pp
184If the key usage or extended key usage extension is absent then
185typically usage is unrestricted.
186For this reason
187.Fn X509_get_key_usage
188and
189.Fn X509_get_extended_key_usage
190return
191.Dv UINT32_MAX
192when the corresponding extension is absent.
193Applications can additionally check the return value of
194.Fn X509_get_extension_flags
195and take appropriate action if an extension is absent.
196.Sh RETURN VALUES
197.Fn X509_get_extension_flags ,
198.Fn X509_get_key_usage
199and
200.Fn X509_get_extended_key_usage
201return sets of flags corresponding to the certificate extension values.
202.Sh SEE ALSO
203.Xr X509_check_purpose 3 ,
204.Xr X509_get_ext_d2i 3
205.Sh HISTORY
206.Nm X509_get_extension_flags ,
207.Nm X509_get_key_usage ,
208and
209.Nm X509_get_extended_key_usage
210first appeared in OpenSSL 1.1.0 and have been available since
211.Ox 7.1 .