tocsp 5.5 KB
Newer Older
B
Ben Laurie 已提交
1 2 3 4
#!/bin/sh

cmd='../util/shlib_wrap.sh ../apps/openssl'
ocspdir="ocsp-tests"
5 6 7 8 9 10
# 17 December 2012 so we don't get certificate expiry errors.
check_time="-attime 1355875200"

test_ocsp () {

	$cmd base64 -d -in $ocspdir/$1 | \
11
		$cmd ocsp -respin - -partial_chain $check_time \
12 13 14
		-CAfile $ocspdir/$2 -verify_other $ocspdir/$2 -CApath /dev/null
	[ $? != $3 ] && exit 1
}
B
Ben Laurie 已提交
15 16 17 18


echo "=== VALID OCSP RESPONSES ==="
echo "NON-DELEGATED; Intermediate CA -> EE"
19
test_ocsp ND1.ors ND1_Issuer_ICA.pem 0
B
Ben Laurie 已提交
20
echo "NON-DELEGATED; Root CA -> Intermediate CA"
21
test_ocsp ND2.ors ND2_Issuer_Root.pem 0
B
Ben Laurie 已提交
22
echo "NON-DELEGATED; Root CA -> EE"
23
test_ocsp ND3.ors ND3_Issuer_Root.pem 0
B
Ben Laurie 已提交
24
echo "DELEGATED; Intermediate CA -> EE"
25
test_ocsp D1.ors D1_Issuer_ICA.pem 0
B
Ben Laurie 已提交
26
echo "DELEGATED; Root CA -> Intermediate CA"
27
test_ocsp D2.ors D2_Issuer_Root.pem 0
B
Ben Laurie 已提交
28
echo "DELEGATED; Root CA -> EE"
29
test_ocsp D3.ors D3_Issuer_Root.pem 0
B
Ben Laurie 已提交
30 31 32

echo "=== INVALID SIGNATURE on the OCSP RESPONSE ==="
echo "NON-DELEGATED; Intermediate CA -> EE"
33
test_ocsp ISOP_ND1.ors ND1_Issuer_ICA.pem 1
B
Ben Laurie 已提交
34
echo "NON-DELEGATED; Root CA -> Intermediate CA"
35
test_ocsp ISOP_ND2.ors ND2_Issuer_Root.pem 1
B
Ben Laurie 已提交
36
echo "NON-DELEGATED; Root CA -> EE"
37
test_ocsp ISOP_ND3.ors ND3_Issuer_Root.pem 1
B
Ben Laurie 已提交
38
echo "DELEGATED; Intermediate CA -> EE"
39
test_ocsp ISOP_D1.ors D1_Issuer_ICA.pem 1
B
Ben Laurie 已提交
40
echo "DELEGATED; Root CA -> Intermediate CA"
41
test_ocsp ISOP_D2.ors D2_Issuer_Root.pem 1
B
Ben Laurie 已提交
42
echo "DELEGATED; Root CA -> EE"
43
test_ocsp ISOP_D3.ors D3_Issuer_Root.pem 1
B
Ben Laurie 已提交
44 45 46

echo "=== WRONG RESPONDERID in the OCSP RESPONSE ==="
echo "NON-DELEGATED; Intermediate CA -> EE"
47
test_ocsp WRID_ND1.ors ND1_Issuer_ICA.pem 1
B
Ben Laurie 已提交
48
echo "NON-DELEGATED; Root CA -> Intermediate CA"
49
test_ocsp WRID_ND2.ors ND2_Issuer_Root.pem 1
B
Ben Laurie 已提交
50
echo "NON-DELEGATED; Root CA -> EE"
51
test_ocsp WRID_ND3.ors ND3_Issuer_Root.pem 1
B
Ben Laurie 已提交
52
echo "DELEGATED; Intermediate CA -> EE"
53
test_ocsp WRID_D1.ors D1_Issuer_ICA.pem 1
B
Ben Laurie 已提交
54
echo "DELEGATED; Root CA -> Intermediate CA"
55
test_ocsp WRID_D2.ors D2_Issuer_Root.pem 1
B
Ben Laurie 已提交
56
echo "DELEGATED; Root CA -> EE"
57
test_ocsp WRID_D3.ors D3_Issuer_Root.pem 1
B
Ben Laurie 已提交
58 59 60

echo "=== WRONG ISSUERNAMEHASH in the OCSP RESPONSE ==="
echo "NON-DELEGATED; Intermediate CA -> EE"
61
test_ocsp WINH_ND1.ors ND1_Issuer_ICA.pem 1
B
Ben Laurie 已提交
62
echo "NON-DELEGATED; Root CA -> Intermediate CA"
63
test_ocsp WINH_ND2.ors ND2_Issuer_Root.pem 1
B
Ben Laurie 已提交
64
echo "NON-DELEGATED; Root CA -> EE"
65
test_ocsp WINH_ND3.ors ND3_Issuer_Root.pem 1
B
Ben Laurie 已提交
66
echo "DELEGATED; Intermediate CA -> EE"
67
test_ocsp WINH_D1.ors D1_Issuer_ICA.pem 1
B
Ben Laurie 已提交
68
echo "DELEGATED; Root CA -> Intermediate CA"
69
test_ocsp WINH_D2.ors D2_Issuer_Root.pem 1
B
Ben Laurie 已提交
70
echo "DELEGATED; Root CA -> EE"
71
test_ocsp WINH_D3.ors D3_Issuer_Root.pem 1
B
Ben Laurie 已提交
72 73 74

echo "=== WRONG ISSUERKEYHASH in the OCSP RESPONSE ==="
echo "NON-DELEGATED; Intermediate CA -> EE"
75
test_ocsp WIKH_ND1.ors ND1_Issuer_ICA.pem 1
B
Ben Laurie 已提交
76
echo "NON-DELEGATED; Root CA -> Intermediate CA"
77
test_ocsp WIKH_ND2.ors ND2_Issuer_Root.pem 1
B
Ben Laurie 已提交
78
echo "NON-DELEGATED; Root CA -> EE"
79
test_ocsp WIKH_ND3.ors ND3_Issuer_Root.pem 1
B
Ben Laurie 已提交
80
echo "DELEGATED; Intermediate CA -> EE"
81
test_ocsp WIKH_D1.ors D1_Issuer_ICA.pem 1
B
Ben Laurie 已提交
82
echo "DELEGATED; Root CA -> Intermediate CA"
83
test_ocsp WIKH_D2.ors D2_Issuer_Root.pem 1
B
Ben Laurie 已提交
84
echo "DELEGATED; Root CA -> EE"
85
test_ocsp WIKH_D3.ors D3_Issuer_Root.pem 1
B
Ben Laurie 已提交
86 87 88

echo "=== WRONG KEY in the DELEGATED OCSP SIGNING CERTIFICATE ==="
echo "DELEGATED; Intermediate CA -> EE"
89
test_ocsp WKDOSC_D1.ors D1_Issuer_ICA.pem 1
B
Ben Laurie 已提交
90
echo "DELEGATED; Root CA -> Intermediate CA"
91
test_ocsp WKDOSC_D2.ors D2_Issuer_Root.pem 1
B
Ben Laurie 已提交
92
echo "DELEGATED; Root CA -> EE"
93
test_ocsp WKDOSC_D3.ors D3_Issuer_Root.pem 1
B
Ben Laurie 已提交
94 95 96

echo "=== INVALID SIGNATURE on the DELEGATED OCSP SIGNING CERTIFICATE ==="
echo "DELEGATED; Intermediate CA -> EE"
97
test_ocsp ISDOSC_D1.ors D1_Issuer_ICA.pem 1
B
Ben Laurie 已提交
98
echo "DELEGATED; Root CA -> Intermediate CA"
99
test_ocsp ISDOSC_D2.ors D2_Issuer_Root.pem 1
B
Ben Laurie 已提交
100
echo "DELEGATED; Root CA -> EE"
101
test_ocsp ISDOSC_D3.ors D3_Issuer_Root.pem 1
B
Ben Laurie 已提交
102 103 104

echo "=== WRONG SUBJECT NAME in the ISSUER CERTIFICATE ==="
echo "NON-DELEGATED; Intermediate CA -> EE"
105
test_ocsp ND1.ors WSNIC_ND1_Issuer_ICA.pem 1
B
Ben Laurie 已提交
106
echo "NON-DELEGATED; Root CA -> Intermediate CA"
107
test_ocsp ND2.ors WSNIC_ND2_Issuer_Root.pem 1
B
Ben Laurie 已提交
108
echo "NON-DELEGATED; Root CA -> EE"
109
test_ocsp ND3.ors WSNIC_ND3_Issuer_Root.pem 1
B
Ben Laurie 已提交
110
echo "DELEGATED; Intermediate CA -> EE"
111
test_ocsp D1.ors WSNIC_D1_Issuer_ICA.pem 1
B
Ben Laurie 已提交
112
echo "DELEGATED; Root CA -> Intermediate CA"
113
test_ocsp D2.ors WSNIC_D2_Issuer_Root.pem 1
B
Ben Laurie 已提交
114
echo "DELEGATED; Root CA -> EE"
115
test_ocsp D3.ors WSNIC_D3_Issuer_Root.pem 1
B
Ben Laurie 已提交
116 117 118

echo "=== WRONG KEY in the ISSUER CERTIFICATE ==="
echo "NON-DELEGATED; Intermediate CA -> EE"
119
test_ocsp ND1.ors WKIC_ND1_Issuer_ICA.pem 1
B
Ben Laurie 已提交
120
echo "NON-DELEGATED; Root CA -> Intermediate CA"
121
test_ocsp ND2.ors WKIC_ND2_Issuer_Root.pem 1
B
Ben Laurie 已提交
122
echo "NON-DELEGATED; Root CA -> EE"
123
test_ocsp ND3.ors WKIC_ND3_Issuer_Root.pem 1
B
Ben Laurie 已提交
124
echo "DELEGATED; Intermediate CA -> EE"
125
test_ocsp D1.ors WKIC_D1_Issuer_ICA.pem 1
B
Ben Laurie 已提交
126
echo "DELEGATED; Root CA -> Intermediate CA"
127
test_ocsp D2.ors WKIC_D2_Issuer_Root.pem 1
B
Ben Laurie 已提交
128
echo "DELEGATED; Root CA -> EE"
129
test_ocsp D3.ors WKIC_D3_Issuer_Root.pem 1
B
Ben Laurie 已提交
130 131 132 133

echo "=== INVALID SIGNATURE on the ISSUER CERTIFICATE ==="
# Expect success, because we're explicitly trusting the issuer certificate.
echo "NON-DELEGATED; Intermediate CA -> EE"
134
test_ocsp ND1.ors ISIC_ND1_Issuer_ICA.pem 0
B
Ben Laurie 已提交
135
echo "NON-DELEGATED; Root CA -> Intermediate CA"
136
test_ocsp ND2.ors ISIC_ND2_Issuer_Root.pem 0
B
Ben Laurie 已提交
137
echo "NON-DELEGATED; Root CA -> EE"
138
test_ocsp ND3.ors ISIC_ND3_Issuer_Root.pem 0
B
Ben Laurie 已提交
139
echo "DELEGATED; Intermediate CA -> EE"
140
test_ocsp D1.ors ISIC_D1_Issuer_ICA.pem 0
B
Ben Laurie 已提交
141
echo "DELEGATED; Root CA -> Intermediate CA"
142
test_ocsp D2.ors ISIC_D2_Issuer_Root.pem 0
B
Ben Laurie 已提交
143
echo "DELEGATED; Root CA -> EE"
144
test_ocsp D3.ors ISIC_D3_Issuer_Root.pem 0
B
Ben Laurie 已提交
145 146 147

echo "ALL OCSP TESTS SUCCESSFUL"
exit 0