-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest.sh
More file actions
executable file
·27 lines (26 loc) · 1.35 KB
/
test.sh
File metadata and controls
executable file
·27 lines (26 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env bash
TEST=0
for CERT in testCerts/*.pem
do
OPENSSLHASH=`openssl x509 -in $CERT -noout -subject_hash # 2>/dev/null`
HASHBASHSSL=`./hash-bash-ssl.sh $CERT # 2>/dev/null`
MSG="[ FAIL ]"
[ "$HASHBASHSSL" -a "$OPENSSLHASH" = "$HASHBASHSSL" ] && MSG="[ OK ]" || TEST=1
printf "SUBJECT NEW %-40s %8s == %8s %s\n" "$CERT" "$OPENSSLHASH" "$HASHBASHSSL" "$MSG"
OPENSSLHASH=`openssl x509 -in $CERT -noout -subject_hash_old 2>/dev/null`
HASHBASHSSL=`./hash-bash-ssl.sh -old $CERT 2>/dev/null`
MSG="[ FAIL ]"
[ "$HASHBASHSSL" -a "$OPENSSLHASH" = "$HASHBASHSSL" ] && MSG="[ OK ]" || TEST=1
printf "SUBJECT OLD %-40s %8s == %8s %s\n" "$CERT" "$OPENSSLHASH" "$HASHBASHSSL" "$MSG"
OPENSSLHASH=`openssl x509 -in $CERT -noout -issuer_hash # 2>/dev/null`
HASHBASHSSL=`./hash-bash-ssl.sh -issuer $CERT # 2>/dev/null`
MSG="[ FAIL ]"
[ "$HASHBASHSSL" -a "$OPENSSLHASH" = "$HASHBASHSSL" ] && MSG="[ OK ]" || TEST=1
printf "ISSUER NEW %-40s %8s == %8s %s\n" "$CERT" "$OPENSSLHASH" "$HASHBASHSSL" "$MSG"
OPENSSLHASH=`openssl x509 -in $CERT -noout -issuer_hash_old 2>/dev/null`
HASHBASHSSL=`./hash-bash-ssl.sh -issuer -old $CERT 2>/dev/null`
MSG="[ FAIL ]"
[ "$HASHBASHSSL" -a "$OPENSSLHASH" = "$HASHBASHSSL" ] && MSG="[ OK ]" || TEST=1
printf "ISSUER OLD %-40s %8s == %8s %s\n" "$CERT" "$OPENSSLHASH" "$HASHBASHSSL" "$MSG"
done
exit $TEST