Document default client -psk_identity
[openssl.git] / doc / man1 / rehash.pod
1 =pod
2
3 =for comment
4 Original text by James Westby, contributed under the OpenSSL license.
5
6 =head1 NAME
7
8 c_rehash, rehash - Create symbolic links to files named by the hash values
9
10 =head1 SYNOPSIS
11
12 B<openssl>
13 B<rehash>
14 B<[-h]>
15 B<[-help]>
16 B<[-old]>
17 B<[-n]>
18 B<[-v]>
19 [ I<directory>...]
20
21 B<c_rehash>
22 I<flags...>
23
24 =head1 DESCRIPTION
25
26 On some platforms, the OpenSSL B<rehash> command is available as
27 an external script called B<c_rehash>.  They are functionally equivalent,
28 except for minor differences noted below.
29
30 B<rehash> scans directories and calculates a hash value of each
31 C<.pem>, C<.crt>, C<.cer>, or C<.crl>
32 file in the specified directory list and creates symbolic links
33 for each file, where the name of the link is the hash value.
34 (If the platform does not support symbolic links, a copy is made.)
35 This utility is useful as many programs that use OpenSSL require
36 directories to be set up like this in order to find certificates.
37
38 If any directories are named on the command line, then those are
39 processed in turn. If not, then the B<SSL_CERT_DIR> environment variable
40 is consulted; this should be a colon-separated list of directories,
41 like the Unix B<PATH> variable.
42 If that is not set then the default directory (installation-specific
43 but often B</usr/local/ssl/certs>) is processed.
44
45 In order for a directory to be processed, the user must have write
46 permissions on that directory, otherwise an error will be generated.
47
48 The links created are of the form C<HHHHHHHH.D>, where each B<H>
49 is a hexadecimal character and B<D> is a single decimal digit.
50 When processing a directory, B<rehash> will first remove all links
51 that have a name in that syntax, even if they are being used for some
52 other purpose.
53 To skip the removal step, use the B<-n> flag.
54 Hashes for CRL's look similar except the letter B<r> appears after
55 the period, like this: C<HHHHHHHH.rD>.
56
57 Multiple objects may have the same hash; they will be indicated by
58 incrementing the B<D> value. Duplicates are found by comparing the
59 full SHA-1 fingerprint. A warning will be displayed if a duplicate
60 is found.
61
62 A warning will also be displayed if there are files that
63 cannot be parsed as either a certificate or a CRL or if
64 more than one such object appears in the file.
65
66 =head2 Script Configuration
67
68 The B<c_rehash> script
69 uses the B<openssl> program to compute the hashes and
70 fingerprints. If not found in the user's B<PATH>, then set the
71 B<OPENSSL> environment variable to the full pathname.
72 Any program can be used, it will be invoked as follows for either
73 a certificate or CRL:
74
75   $OPENSSL x509 -hash -fingerprint -noout -in FILENAME
76   $OPENSSL crl -hash -fingerprint -noout -in FILENAME
77
78 where B<FILENAME> is the filename. It must output the hash of the
79 file on the first line, and the fingerprint on the second,
80 optionally prefixed with some text and an equals sign.
81
82 =head1 OPTIONS
83
84 =over 4
85
86 =item B<-help> B<-h>
87
88 Display a brief usage message.
89
90 =item B<-old>
91
92 Use old-style hashing (MD5, as opposed to SHA-1) for generating
93 links to be used for releases before 1.0.0.
94 Note that current versions will not use the old style.
95
96 =item B<-n>
97
98 Do not remove existing links.
99 This is needed when keeping new and old-style links in the same directory.
100
101 =item B<-v>
102
103 Print messages about old links removed and new links created.
104 By default, B<rehash> only lists each directory as it is processed.
105
106 =back
107
108 =head1 ENVIRONMENT
109
110 =over 4
111
112 =item B<OPENSSL>
113
114 The path to an executable to use to generate hashes and
115 fingerprints (see above).
116
117 =item B<SSL_CERT_DIR>
118
119 Colon separated list of directories to operate on.
120 Ignored if directories are listed on the command line.
121
122 =back
123
124 =head1 SEE ALSO
125
126 L<openssl(1)>,
127 L<crl(1)>.
128 L<x509(1)>.
129
130 =head1 COPYRIGHT
131
132 Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.
133
134 Licensed under the OpenSSL license (the "License").  You may not use
135 this file except in compliance with the License.  You can obtain a copy
136 in the file LICENSE in the source distribution or at
137 L<https://www.openssl.org/source/license.html>.
138
139 =cut