]> git.ipfire.org Git - thirdparty/openssl.git/blame - tools/c_rehash
Import of old SSLeay release: SSLeay 0.9.0b
[thirdparty/openssl.git] / tools / c_rehash
CommitLineData
d02b48c6
RE
1#!/bin/sh
2#
3# redo the hashes for the certificates in your cert path or the ones passed
4# on the command line.
5#
6
58964a49 7if [ "$SSLEAY"x = "x" -o ! -x $SSLEAY ]; then
d02b48c6
RE
8 SSLEAY='ssleay'
9 export SSLEAY
10fi
11DIR=/usr/local/ssl
58964a49 12PATH=$DIR/bin:$PATH
d02b48c6
RE
13
14SSL_DIR=$DIR/certs
15
16if [ "$*" = "" ]; then
17 CERTS=${*:-${SSL_CERT_DIR:-$SSL_DIR}}
18else
19 CERTS=$*
20fi
21
22IFS=': '
23for i in $CERTS
24do
25 (
26 IFS=' '
27 if [ -d $i -a -w $i ]; then
28 cd $i
29 echo "Doing $i"
30 for i in *.pem
31 do
32 if [ $i != '*.pem' ]; then
33 h=`$SSLEAY x509 -hash -noout -in $i`
34 if [ "x$h" = "x" ]; then
35 echo $i does not contain a certificate
36 else
37 if [ -f $h.0 ]; then
38 /bin/rm -f $h.0
39 fi
40 echo "$i => $h.0"
41 ln -s $i $h.0
42 fi
43 fi
44 done
45 fi
46 )
47done