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