summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/man/X509_check_trust.3
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/man/X509_check_trust.3')
-rw-r--r--src/lib/libcrypto/man/X509_check_trust.3208
1 files changed, 208 insertions, 0 deletions
diff --git a/src/lib/libcrypto/man/X509_check_trust.3 b/src/lib/libcrypto/man/X509_check_trust.3
new file mode 100644
index 0000000000..4b625fdfd4
--- /dev/null
+++ b/src/lib/libcrypto/man/X509_check_trust.3
@@ -0,0 +1,208 @@
1.\" $OpenBSD: X509_check_trust.3,v 1.1 2021/07/24 14:33:14 schwarze Exp $
2.\"
3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
4.\"
5.\" Permission to use, copy, modify, and distribute this software for any
6.\" purpose with or without fee is hereby granted, provided that the above
7.\" copyright notice and this permission notice appear in all copies.
8.\"
9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\"
17.Dd $Mdocdate: July 24 2021 $
18.Dt X509_CHECK_TRUST 3
19.Os
20.Sh NAME
21.Nm X509_check_trust
22.Nd check whether a certificate is trusted
23.Sh SYNOPSIS
24.In openssl/x509.h
25.Ft int
26.Fo X509_check_trust
27.Fa "X509 *certificate"
28.Fa "int trust"
29.Fa "int flags"
30.Fc
31.Sh DESCRIPTION
32.Fn X509_check_trust
33checks whether the
34.Fa certificate
35is marked as trusted for the purpose corresponding to the requested
36.Fa trust
37identifier.
38.Pp
39The standard algorithm used by all built-in trust checking functions
40performs the following tests in the following order.
41The first matching test terminates the algorithm
42and decides the return value.
43.Bl -enum
44.It
45If
46.Xr X509_add1_reject_object 3
47was previously called on the
48.Fa certificate
49with the ASN.1 object identifier corresponding to the requested
50.Fa trust
51identifier,
52.Dv X509_TRUST_REJECTED
53is returned.
54.It
55If
56.Xr X509_add1_trust_object 3
57was previously called on the
58.Fa certificate
59with the ASN.1 object identifier corresponding to the requested
60.Fa trust
61identifier,
62.Dv X509_TRUST_TRUSTED
63is returned.
64.It
65If
66.Xr X509_add1_reject_object 3
67or
68.Xr X509_add1_trust_object 3
69were previously called on the
70.Fa certificate ,
71but neither of them
72with the ASN.1 object identifier corresponding to the requested
73.Fa trust
74identifier,
75.Dv X509_TRUST_UNTRUSTED
76is returned.
77.It
78This so-called
79.Dq compatibility
80step is skipped by some of the trust checking functions.
81If neither
82.Xr X509_add1_reject_object 3
83nor
84.Xr X509_add1_trust_object 3
85was previously called on the
86.Fa certificate
87and if the
88.Fa certificate
89is a self-signed,
90.Dv X509_TRUST_TRUSTED
91is returned.
92.It
93Otherwise,
94.Dv X509_TRUST_UNTRUSTED
95is returned.
96.El
97.Pp
98By default, the following
99.Fa trust
100identifiers are supported.
101The
102.Dq ASN.1 NID
103column indicates the correspondig ASN.1 object identifier;
104for the relationship between ASN.1 NIDs and OIDs, see the
105.Xr OBJ_nid2obj 3
106manual page.
107The
108.Qq compat
109column indicates whether the compatibility step in the standard algorithm
110detailed above is used or skipped.
111.Pp
112.Bl -column X509_TRUST_OCSP_REQUEST NID_anyExtendedKeyUsage compat -compact
113.It Fa trust No identifier Ta Em ASN.1 NID Ta Em compat
114.It Dv X509_TRUST_SSL_CLIENT Ta Dv NID_client_auth Ta use
115.It Dv X509_TRUST_SSL_SERVER Ta Dv NID_server_auth Ta use
116.It Dv X509_TRUST_EMAIL Ta Dv NID_email_protect Ta use
117.It Dv X509_TRUST_OBJECT_SIGN Ta Dv NID_code_sign Ta use
118.It Dv X509_TRUST_OCSP_SIGN Ta Dv NID_OCSP_sign Ta skip
119.It Dv X509_TRUST_OCSP_REQUEST Ta Dv NID_ad_OCSP Ta skip
120.It Dv X509_TRUST_TSA Ta Dv NID_time_stamp Ta use
121.It Dv X509_TRUST_COMPAT Ta none Ta only
122.It 0 Ta Dv NID_anyExtendedKeyUsage Ta special
123.It \-1 Ta none Ta trusted
124.It invalid Ta Fa trust No argument Ta skip
125.El
126.Pp
127For the following
128.Fa trust
129identifiers, the standard algorithm is modified:
130.Bl -tag -width Ds
131.It Dv X509_TRUST_COMPAT
132.Xr X509_add1_reject_object 3
133and
134.Xr X509_add1_trust_object 3
135settings are completely ignored
136and all steps before the compatibility step are skippped.
137The
138.Fa certificate
139is trusted if and only if it is self-signed.
140.It 0
141The third step in the standard algorithm is skipped, and the
142compatibility step is used even if
143.Xr X509_add1_reject_object 3
144or
145.Xr X509_add1_trust_object 3
146were called with ASN.1 object identifiers not corresponding to
147.Dv NID_anyExtendedKeyUsage .
148.It \-1
149The
150.Fa certificate
151is not inspected and
152.Dv X509_TRUST_TRUSTED
153is always returned.
154.It invalid
155If the
156.Fa trust
157argument is neither 0 nor \-1 nor valid as a trust identifier,
158it is re-interpreted as an ASN.1 NID
159and used itself for the standard algorithm.
160The compatibility step is skipped in this case.
161.El
162.Pp
163The
164.Fa flags
165argument is ignored by all built-in trust checking functions,
166but user-specified trust checking functions might use it.
167.Pp
168If the function
169.Xr X509_TRUST_add 3
170was called before
171.Fn X509_check_trust ,
172it may have installed different, user-supplied checking functions
173for some of the standard
174.Fa trust
175identifiers listed above, or it may have installed additional,
176user-supplied checking functions for user-defined
177.Fa trust
178identifiers not listed above.
179.Sh RETURN VALUES
180.Fn X509_check_trust
181returns the following values:
182.Bl -tag -width Ds
183.It Dv X509_TRUST_TRUSTED
184The
185.Fa certificate
186is explicitly or implicitly trusted for the requested purpose.
187.It Dv X509_TRUST_REJECTED
188The
189.Fa certificate
190is explicitely rejected for the requested purpose.
191.It Dv X509_TRUST_UNTRUSTED
192The
193.Fa certificate
194is neither trusted nor explicitely rejected,
195which implies that it is not trusted.
196.El
197.Sh SEE ALSO
198.Xr PEM_read_X509_AUX 3 ,
199.Xr X509_add1_trust_object 3 ,
200.Xr X509_CERT_AUX_new 3 ,
201.Xr X509_check_purpose 3 ,
202.Xr X509_new 3 ,
203.Xr X509_TRUST_set 3 ,
204.Xr X509_VERIFY_PARAM_set_trust 3
205.Sh HISTORY
206.Fn X509_check_trust
207first appeared in OpenSSL 0.9.5 and has been available since
208.Ox 2.7 .