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