2 {- OpenSSL::safe::output_do_not_edit_headers(); -}
5 Original text by James Westby, contributed under the OpenSSL license.
9 openssl-rehash, c_rehash - Create symbolic links to files named by the hash
34 This command is generally equivalent to the external
36 except for minor differences noted below.
38 B<openssl rehash> scans directories and calculates a hash value of
39 each F<.pem>, F<.crt>, F<.cer>, or F<.crl>
40 file in the specified directory list and creates symbolic links
41 for each file, where the name of the link is the hash value.
42 (If the platform does not support symbolic links, a copy is made.)
43 This command is useful as many programs that use OpenSSL require
44 directories to be set up like this in order to find certificates.
46 If any directories are named on the command line, then those are
47 processed in turn. If not, then the B<SSL_CERT_DIR> environment variable
48 is consulted; this should be a colon-separated list of directories,
49 like the Unix B<PATH> variable.
50 If that is not set then the default directory (installation-specific
51 but often F</usr/local/ssl/certs>) is processed.
53 In order for a directory to be processed, the user must have write
54 permissions on that directory, otherwise an error will be generated.
56 The links created are of the form I<HHHHHHHH.D>, where each I<H>
57 is a hexadecimal character and I<D> is a single decimal digit.
58 When a directory is processed, all links in it that have a name
59 in that syntax are first removed, even if they are being used for
61 To skip the removal step, use the B<-n> flag.
62 Hashes for CRL's look similar except the letter B<r> appears after
63 the period, like this: I<HHHHHHHH.>B<r>I<D>.
65 Multiple objects may have the same hash; they will be indicated by
66 incrementing the I<D> value. Duplicates are found by comparing the
67 full SHA-1 fingerprint. A warning will be displayed if a duplicate
70 A warning will also be displayed if there are files that
71 cannot be parsed as either a certificate or a CRL or if
72 more than one such object appears in the file.
74 =head2 Script Configuration
76 The B<c_rehash> script
77 uses the B<openssl> program to compute the hashes and
78 fingerprints. If not found in the user's B<PATH>, then set the
79 B<OPENSSL> environment variable to the full pathname.
80 Any program can be used, it will be invoked as follows for either
83 $OPENSSL x509 -hash -fingerprint -noout -in FILENAME
84 $OPENSSL crl -hash -fingerprint -noout -in FILENAME
86 where I<FILENAME> is the filename. It must output the hash of the
87 file on the first line, and the fingerprint on the second,
88 optionally prefixed with some text and an equals sign.
96 Display a brief usage message.
100 Use old-style hashing (MD5, as opposed to SHA-1) for generating
101 links to be used for releases before 1.0.0.
102 Note that current versions will not use the old style.
106 Do not remove existing links.
107 This is needed when keeping new and old-style links in the same directory.
111 Generate links for both old-style (MD5) and new-style (SHA1) hashing.
112 This allows releases before 1.0.0 to use these links along-side newer
117 Print messages about old links removed and new links created.
118 By default, this command only lists each directory as it is processed.
128 The path to an executable to use to generate hashes and
129 fingerprints (see above).
131 =item B<SSL_CERT_DIR>
133 Colon separated list of directories to operate on.
134 Ignored if directories are listed on the command line.
146 Copyright 2015-2019 The OpenSSL Project Authors. All Rights Reserved.
148 Licensed under the Apache License 2.0 (the "License"). You may not use
149 this file except in compliance with the License. You can obtain a copy
150 in the file LICENSE in the source distribution or at
151 L<https://www.openssl.org/source/license.html>.