c564e86315529adbd37cff9a26db914d89c7f2b1
[openssl.git] / doc / apps / c_rehash.pod
1 =pod
2
3 =for comment
4 Original text by James Westby, contributed under the OpenSSL license.
5
6 =head1 NAME
7
8 c_rehash - Create symbolic links to files named by the hash values
9
10 =head1 SYNOPSIS
11
12 B<c_rehash>
13 [ I<directory>...]
14
15 =head1 DESCRIPTION
16
17 B<c_rehash> scans directories and calculates a hash value of each C<.pem>
18 file in the specified directory list and creates symbolic links
19 for each file, where the name of the link is the hash value.
20 This utility is useful as many programs that use OpenSSL require
21 directories to be set up like this in order to find certificates.
22
23 If any directories are named on the command line, then those are
24 processed in turn. If not, then the B<SSL_CERT_DIR> environment variable
25 is consulted; this shold be a colon-separated list of directories,
26 like the Unix B<PATH> variable.
27 If that is not set then the default directory (installation-specific
28 but often B</usr/local/ssl/certs>) is processed.
29
30 In order for a directory to be processed, the user must have write
31 permissions on that directory, otherwise it will be skipped.
32 The links created are of the form C<HHHHHHHH.D>, where each B<H>
33 is a hexadecimal character and B<D> is a single decimal digit.
34 When processing a directory, B<c_rehash> will first remove all links
35 that have a name in that syntax. If you have links in that format
36 used for other purposes, they will be removed.
37 Hashes for CRL's look similar except the letter B<r> appears after
38 the period, like this: C<HHHHHHHH.rD>.
39
40 Multiple objects may have the same hash; they will be indicated by
41 incrementing the B<D> value. Duplicates are found by comparing the
42 full SHA-1 fingerprint. A warning will be displayed if a duplicate
43 is found.
44
45 A warning will also be displayed if there are B<.pem> files that
46 cannot be parsed as either a certificate or a CRL.
47
48 The program uses the B<openssl> program to compute the hashes and
49 fingerprints. If not found in the user's B<PATH>, then set the
50 B<OPENSSL> environment variable to the full pathname.
51 Any program can be used, it will be invoked as follows for either
52 a certificate or CRL:
53
54   $OPENSSL x509 -hash -fingerprint -noout -in FFFFFF
55   $OPENSSL crl -hash -fingerprint -noout -in FFFFFF
56
57 where B<FFFFFF> is the filename. It must output the hash of the
58 file on the first line, and the fingerprint on the second,
59 optionally prefixed with some text and an equals sign.
60
61 =head1 ENVIRONMENT
62
63 =over
64
65 =item B<OPENSSL>
66
67 The path to an executable to use to generate hashes and
68 fingerprints (see above).
69
70 =item B<SSL_CERT_DIR>
71
72 Colon separated list of directories to operate on.
73 Ignored if directories are listed on the command line.
74
75 =back
76
77 =head1 SEE ALSO
78
79 L<openssl(1)|openssl(1)>,
80 L<crl(1)|crl(1)>.
81 L<x509(1)|x509(1)>.