summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/man/X509_LOOKUP_hash_dir.3
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/man/X509_LOOKUP_hash_dir.3')
-rw-r--r--src/lib/libcrypto/man/X509_LOOKUP_hash_dir.3219
1 files changed, 219 insertions, 0 deletions
diff --git a/src/lib/libcrypto/man/X509_LOOKUP_hash_dir.3 b/src/lib/libcrypto/man/X509_LOOKUP_hash_dir.3
new file mode 100644
index 0000000000..4b06525994
--- /dev/null
+++ b/src/lib/libcrypto/man/X509_LOOKUP_hash_dir.3
@@ -0,0 +1,219 @@
1.\" $OpenBSD: X509_LOOKUP_hash_dir.3,v 1.1 2016/12/04 20:51:47 schwarze Exp $
2.\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
3.\"
4.\" This file was written by Victor B. Wagner <vitus@cryptocom.ru>
5.\" and Claus Assmann.
6.\" Copyright (c) 2015, 2016 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: December 4 2016 $
53.Dt X509_LOOKUP_HASH_DIR 3
54.Os
55.Sh NAME
56.Nm X509_LOOKUP_hash_dir ,
57.Nm X509_LOOKUP_file ,
58.Nm X509_load_cert_file ,
59.Nm X509_load_crl_file ,
60.Nm X509_load_cert_crl_file
61.Nd default OpenSSL certificate lookup methods
62.Sh SYNOPSIS
63.In openssl/x509_vfy.h
64.Ft X509_LOOKUP_METHOD *
65.Fn X509_LOOKUP_hash_dir void
66.Ft X509_LOOKUP_METHOD *
67.Fn X509_LOOKUP_file void
68.Ft int
69.Fo X509_load_cert_file
70.Fa "X509_LOOKUP *ctx"
71.Fa "const char *file"
72.Fa "int type"
73.Fc
74.Ft int
75.Fo X509_load_crl_file
76.Fa "X509_LOOKUP *ctx"
77.Fa "const char *file"
78.Fa "int type"
79.Fc
80.Ft int
81.Fo X509_load_cert_crl_file
82.Fa "X509_LOOKUP *ctx"
83.Fa "const char *file"
84.Fa "int type"
85.Fc
86.Sh DESCRIPTION
87.Fn X509_LOOKUP_hash_dir
88and
89.Fn X509_LOOKUP_file
90are two certificate lookup methods to use with
91.Vt X509_STORE ,
92provided by OpenSSL library.
93.Pp
94Users of the library typically do not need to create instances of these
95methods manually.
96They are created automatically by the
97.Xr X509_STORE_load_locations 3
98or
99.Xr SSL_CTX_load_verify_locations 3
100functions.
101.Pp
102Internally loading of certificates and CRLs is implemented via functions
103.Fn X509_load_cert_crl_file ,
104.Fn X509_load_cert_file
105and
106.Fn X509_load_crl_file .
107These functions support a parameter
108.Fa type ,
109which can be one of the constants
110.Dv FILETYPE_PEM ,
111.Dv FILETYPE_ASN1 ,
112and
113.Dv FILETYPE_DEFAULT .
114They load certificates and/or CRLs from the specified file into a
115memory cache of
116.Vt X509_STORE
117objects which the given
118.Fa ctx
119parameter is associated with.
120.Pp
121The functions
122.Fn X509_load_cert_file
123and
124.Fn X509_load_crl_file
125can load both PEM and DER formats depending on the
126.Fa type
127value.
128Because DER format cannot contain more than one certificate or CRL
129object (while PEM can contain several concatenated PEM objects),
130.Fn X509_load_cert_crl_file
131with
132.Dv FILETYPE_ASN1
133is equivalent to
134.Fn X509_load_cert_file .
135.Pp
136The constant
137.Dv FILETYPE_DEFAULT
138with
139.Dv NULL
140filename causes these functions to load default certificate
141store file (see
142.Xr X509_STORE_set_default_paths 3 ) .
143.Pp
144These functions return the number of objects loaded from file or 0
145in case of error.
146.Pp
147Both methods support adding several certificate locations into one
148.Sy X509_STORE .
149.Pp
150This page documents certificate store formats used by these methods and
151caching policy.
152.Ss File Method
153The
154.Fn X509_LOOKUP_file
155method loads all the certificates or CRLs present in a file into memory
156at the time the file is added as a lookup source.
157.Pp
158The file format is ASCII text which contains concatenated PEM
159certificates and CRLs.
160.Pp
161This method should be used by applications which work with a small set
162of CAs.
163.Ss Hashed Directory Method
164.Fa X509_LOOKUP_hash_dir
165is a more advanced method, which loads certificates and CRLs on demand,
166and caches them in memory once they are loaded.
167As of OpenSSL 1.0.0, it also checks for newer CRLs upon each lookup, so
168that newer CRLs are used as soon as they appear in the directory.
169.Pp
170The directory should contain one certificate or CRL per file in PEM
171format, with a file name of the form
172.Ar hash . Ns Ar N
173for a certificate, or
174.Ar hash . Ns Sy r Ns Ar N
175for a CRL.
176The
177.Ar hash
178is the value returned by the
179.Xr X509_NAME_hash 3
180function applied to the subject name for certificates or issuer
181name for CRLs.
182The hash can also be obtained via the
183.Fl hash
184option of the
185.Xr openssl
186.Cm x509
187or
188.Cm crl
189commands.
190.Pp
191The
192.Ar N
193suffix is a sequence number that starts at zero and is incremented
194consecutively for each certificate or CRL with the same
195.Ar hash
196value.
197Gaps in the sequence numbers are not supported.
198It is assumed that there are no more objects with the same hash
199beyond the first missing number in the sequence.
200.Pp
201Sequence numbers make it possible for the directory to contain multiple
202certificates with the same subject name hash value.
203For example, it is possible to have in the store several certificates
204with the same subject or several CRLs with the same issuer (and, for
205example, a different validity period).
206.Pp
207When checking for new CRLs, once one CRL for a given hash value is
208loaded, hash_dir lookup method checks only for certificates with
209sequence number greater than that of the already cached CRL.
210.Pp
211Note that the hash algorithm used for subject name hashing changed in
212OpenSSL 1.0.0, and all certificate stores have to be rehashed when
213moving from OpenSSL 0.9.8 to 1.0.0.
214.Sh SEE ALSO
215.Xr d2i_X509_bio 3 ,
216.Xr PEM_read_PrivateKey 3 ,
217.Xr SSL_CTX_load_verify_locations 3 ,
218.Xr X509_STORE_add_lookup 3 ,
219.Xr X509_STORE_load_locations 3