Add -no_alt_chains option to apps to implement the new
[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 B<[-old]>
14 B<[-h]>
15 B<[-n]>
16 B<[-v]>
17 [ I<directory>...]
18
19 =head1 DESCRIPTION
20
21 B<c_rehash> scans directories and calculates a hash value of each
22 C<.pem>, C<.crt>, C<.cer>, or C<.crl>
23 file in the specified directory list and creates symbolic links
24 for each file, where the name of the link is the hash value.
25 (If the platform does not support symbolic links, a copy is made.)
26 This utility is useful as many programs that use OpenSSL require
27 directories to be set up like this in order to find certificates.
28
29 If any directories are named on the command line, then those are
30 processed in turn. If not, then the B<SSL_CERT_DIR> environment variable
31 is consulted; this shold be a colon-separated list of directories,
32 like the Unix B<PATH> variable.
33 If that is not set then the default directory (installation-specific
34 but often B</usr/local/ssl/certs>) is processed.
35
36 In order for a directory to be processed, the user must have write
37 permissions on that directory, otherwise it will be skipped.
38 The links created are of the form C<HHHHHHHH.D>, where each B<H>
39 is a hexadecimal character and B<D> is a single decimal digit.
40 When processing a directory, B<c_rehash> will first remove all links
41 that have a name in that syntax. If you have links in that format
42 used for other purposes, they will be removed.
43 To skip the removal step, use the B<-n> flag.
44 Hashes for CRL's look similar except the letter B<r> appears after
45 the period, like this: C<HHHHHHHH.rD>.
46
47 Multiple objects may have the same hash; they will be indicated by
48 incrementing the B<D> value. Duplicates are found by comparing the
49 full SHA-1 fingerprint. A warning will be displayed if a duplicate
50 is found.
51
52 A warning will also be displayed if there are files that
53 cannot be parsed as either a certificate or a CRL.
54
55 The program uses the B<openssl> program to compute the hashes and
56 fingerprints. If not found in the user's B<PATH>, then set the
57 B<OPENSSL> environment variable to the full pathname.
58 Any program can be used, it will be invoked as follows for either
59 a certificate or CRL:
60
61   $OPENSSL x509 -hash -fingerprint -noout -in FILENAME
62   $OPENSSL crl -hash -fingerprint -noout -in FILENAME
63
64 where B<FILENAME> is the filename. It must output the hash of the
65 file on the first line, and the fingerprint on the second,
66 optionally prefixed with some text and an equals sign.
67
68 =head1 OPTIONS
69
70 =over 4
71
72 =item B<-old>
73
74 Use old-style hashing (MD5, as opposed to SHA-1) for generating
75 links for releases before 1.0.0.  Note that current versions will
76 not use the old style.
77
78 =item B<-h>
79
80 Display a brief usage message.
81
82 =item B<-n>
83
84 Do not remove existing links.
85 This is needed when keeping new and old-style links in the same directory.
86
87 =item B<-v>
88
89 Print messages about old links removed and new links created.
90 By default, B<c_rehash> only lists each directory as it is processed.
91
92 =back
93
94 =head1 ENVIRONMENT
95
96 =over
97
98 =item B<OPENSSL>
99
100 The path to an executable to use to generate hashes and
101 fingerprints (see above).
102
103 =item B<SSL_CERT_DIR>
104
105 Colon separated list of directories to operate on.
106 Ignored if directories are listed on the command line.
107
108 =back
109
110 =head1 SEE ALSO
111
112 L<openssl(1)|openssl(1)>,
113 L<crl(1)|crl(1)>.
114 L<x509(1)|x509(1)>.