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