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