diff options
Diffstat (limited to 'src/lib/libcrypto/man/X509_LOOKUP_hash_dir.3')
-rw-r--r-- | src/lib/libcrypto/man/X509_LOOKUP_hash_dir.3 | 219 |
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 | ||
88 | and | ||
89 | .Fn X509_LOOKUP_file | ||
90 | are two certificate lookup methods to use with | ||
91 | .Vt X509_STORE , | ||
92 | provided by OpenSSL library. | ||
93 | .Pp | ||
94 | Users of the library typically do not need to create instances of these | ||
95 | methods manually. | ||
96 | They are created automatically by the | ||
97 | .Xr X509_STORE_load_locations 3 | ||
98 | or | ||
99 | .Xr SSL_CTX_load_verify_locations 3 | ||
100 | functions. | ||
101 | .Pp | ||
102 | Internally loading of certificates and CRLs is implemented via functions | ||
103 | .Fn X509_load_cert_crl_file , | ||
104 | .Fn X509_load_cert_file | ||
105 | and | ||
106 | .Fn X509_load_crl_file . | ||
107 | These functions support a parameter | ||
108 | .Fa type , | ||
109 | which can be one of the constants | ||
110 | .Dv FILETYPE_PEM , | ||
111 | .Dv FILETYPE_ASN1 , | ||
112 | and | ||
113 | .Dv FILETYPE_DEFAULT . | ||
114 | They load certificates and/or CRLs from the specified file into a | ||
115 | memory cache of | ||
116 | .Vt X509_STORE | ||
117 | objects which the given | ||
118 | .Fa ctx | ||
119 | parameter is associated with. | ||
120 | .Pp | ||
121 | The functions | ||
122 | .Fn X509_load_cert_file | ||
123 | and | ||
124 | .Fn X509_load_crl_file | ||
125 | can load both PEM and DER formats depending on the | ||
126 | .Fa type | ||
127 | value. | ||
128 | Because DER format cannot contain more than one certificate or CRL | ||
129 | object (while PEM can contain several concatenated PEM objects), | ||
130 | .Fn X509_load_cert_crl_file | ||
131 | with | ||
132 | .Dv FILETYPE_ASN1 | ||
133 | is equivalent to | ||
134 | .Fn X509_load_cert_file . | ||
135 | .Pp | ||
136 | The constant | ||
137 | .Dv FILETYPE_DEFAULT | ||
138 | with | ||
139 | .Dv NULL | ||
140 | filename causes these functions to load default certificate | ||
141 | store file (see | ||
142 | .Xr X509_STORE_set_default_paths 3 ) . | ||
143 | .Pp | ||
144 | These functions return the number of objects loaded from file or 0 | ||
145 | in case of error. | ||
146 | .Pp | ||
147 | Both methods support adding several certificate locations into one | ||
148 | .Sy X509_STORE . | ||
149 | .Pp | ||
150 | This page documents certificate store formats used by these methods and | ||
151 | caching policy. | ||
152 | .Ss File Method | ||
153 | The | ||
154 | .Fn X509_LOOKUP_file | ||
155 | method loads all the certificates or CRLs present in a file into memory | ||
156 | at the time the file is added as a lookup source. | ||
157 | .Pp | ||
158 | The file format is ASCII text which contains concatenated PEM | ||
159 | certificates and CRLs. | ||
160 | .Pp | ||
161 | This method should be used by applications which work with a small set | ||
162 | of CAs. | ||
163 | .Ss Hashed Directory Method | ||
164 | .Fa X509_LOOKUP_hash_dir | ||
165 | is a more advanced method, which loads certificates and CRLs on demand, | ||
166 | and caches them in memory once they are loaded. | ||
167 | As of OpenSSL 1.0.0, it also checks for newer CRLs upon each lookup, so | ||
168 | that newer CRLs are used as soon as they appear in the directory. | ||
169 | .Pp | ||
170 | The directory should contain one certificate or CRL per file in PEM | ||
171 | format, with a file name of the form | ||
172 | .Ar hash . Ns Ar N | ||
173 | for a certificate, or | ||
174 | .Ar hash . Ns Sy r Ns Ar N | ||
175 | for a CRL. | ||
176 | The | ||
177 | .Ar hash | ||
178 | is the value returned by the | ||
179 | .Xr X509_NAME_hash 3 | ||
180 | function applied to the subject name for certificates or issuer | ||
181 | name for CRLs. | ||
182 | The hash can also be obtained via the | ||
183 | .Fl hash | ||
184 | option of the | ||
185 | .Xr openssl | ||
186 | .Cm x509 | ||
187 | or | ||
188 | .Cm crl | ||
189 | commands. | ||
190 | .Pp | ||
191 | The | ||
192 | .Ar N | ||
193 | suffix is a sequence number that starts at zero and is incremented | ||
194 | consecutively for each certificate or CRL with the same | ||
195 | .Ar hash | ||
196 | value. | ||
197 | Gaps in the sequence numbers are not supported. | ||
198 | It is assumed that there are no more objects with the same hash | ||
199 | beyond the first missing number in the sequence. | ||
200 | .Pp | ||
201 | Sequence numbers make it possible for the directory to contain multiple | ||
202 | certificates with the same subject name hash value. | ||
203 | For example, it is possible to have in the store several certificates | ||
204 | with the same subject or several CRLs with the same issuer (and, for | ||
205 | example, a different validity period). | ||
206 | .Pp | ||
207 | When checking for new CRLs, once one CRL for a given hash value is | ||
208 | loaded, hash_dir lookup method checks only for certificates with | ||
209 | sequence number greater than that of the already cached CRL. | ||
210 | .Pp | ||
211 | Note that the hash algorithm used for subject name hashing changed in | ||
212 | OpenSSL 1.0.0, and all certificate stores have to be rehashed when | ||
213 | moving 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 | ||