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