2
2
$! A few very basic tests for the 'ts' time stamping authority command.
6
6
$ if f$getsyi("cpu") .ge. 128 then -
7
7
__arch = f$edit( f$getsyi( "ARCH_NAME"), "UPCASE")
8
$ if __arch .eqs. "" then __arch := UNK
9
$ exe_dir := sys$disk:[-.'__arch'.exe.apps]
8
$ if __arch .eqs. "" then __arch = "UNK"
10
$ if (p4 .eqs. "64") then __arch = __arch+ "_64"
12
$ exe_dir = "sys$disk:[-.''__arch'.exe.apps]"
11
$ openssl := mcr 'f$parse(exe_dir+"openssl.exe")'
12
$ OPENSSL_CONF := [-]CAtsa.cnf
14
$ openssl = "mcr ''f$parse(exe_dir+"openssl.exe")'"
15
$ OPENSSL_CONF = "[-]CAtsa.cnf"
13
16
$ ! Because that's what ../apps/CA.sh really looks at
14
17
$ SSLEAY_CONFIG = "-config " + OPENSSL_CONF
147
150
$ ! create the token from the response first
148
$ openssl ts -reply -in 'p2' -out 'p2'.token -token_out
149
$ if $severity .ne. 1 then call error
150
$ openssl ts -verify -queryfile 'p1' -in 'p2'.token -token_in -
151
"-CAfile" tsaca.pem -untrusted tsa_cert1.pem
152
$ if $severity .ne. 1 then call error
153
$ openssl ts -verify -data 'p3' -in 'p2'.token -token_in -
154
"-CAfile" tsaca.pem -untrusted tsa_cert1.pem
151
$ openssl ts -reply -in "''p2'" -out "''p2'-token" -token_out
152
$ if $severity .ne. 1 then call error
153
$ openssl ts -verify -queryfile "''p1'" -in "''p2'-token" -
154
-token_in "-CAfile" tsaca.pem -untrusted tsa_cert1.pem
155
$ if $severity .ne. 1 then call error
156
$ openssl ts -verify -data "''p3'" -in "''p2'-token" -
157
-token_in "-CAfile" tsaca.pem -untrusted tsa_cert1.pem
155
158
$ if $severity .ne. 1 then call error
185
188
$ call create_time_stamp_request1
187
190
$ write sys$output "Printing req1.req..."
188
$ call print_request req1.tsq
191
$ call print_request "req1.tsq"
190
193
$ write sys$output "Generating valid response for req1.req..."
191
$ call create_time_stamp_response req1.tsq resp1.tsr tsa_config1
194
$ call create_time_stamp_response "req1.tsq" "resp1.tsr" "tsa_config1"
193
196
$ write sys$output "Printing response..."
194
$ call print_response resp1.tsr
197
$ call print_response "resp1.tsr"
196
199
$ write sys$output "Verifying valid response..."
197
$ call verify_time_stamp_response req1.tsq resp1.tsr [-]testtsa.com
200
$ call verify_time_stamp_response "req1.tsq" "resp1.tsr" "[-]testtsa.com"
199
202
$ write sys$output "Verifying valid token..."
200
$ call verify_time_stamp_token req1.tsq resp1.tsr [-]testtsa.com
203
$ call verify_time_stamp_token "req1.tsq" "resp1.tsr" "[-]testtsa.com"
202
205
$ ! The tests below are commented out, because invalid signer certificates
203
206
$ ! can no longer be specified in the config file.
205
208
$ ! write sys$output "Generating _invalid_ response for req1.req..."
206
$ ! call create_time_stamp_response req1.tsq resp1_bad.tsr tsa_config2
209
$ ! call create_time_stamp_response "req1.tsq" "resp1_bad.tsr" "tsa_config2"
208
211
$ ! write sys$output "Printing response..."
209
$ ! call print_response resp1_bad.tsr
212
$ ! call print_response "resp1_bad.tsr"
211
214
$ ! write sys$output "Verifying invalid response, it should fail..."
212
$ ! call verify_time_stamp_response_fail req1.tsq resp1_bad.tsr
215
$ ! call verify_time_stamp_response_fail "req1.tsq" "resp1_bad.tsr"
214
217
$ write sys$output "Creating req2.req time stamp request for file testtsa..."
215
218
$ call create_time_stamp_request2
217
220
$ write sys$output "Printing req2.req..."
218
$ call print_request req2.tsq
221
$ call print_request "req2.tsq"
220
223
$ write sys$output "Generating valid response for req2.req..."
221
$ call create_time_stamp_response req2.tsq resp2.tsr tsa_config1
224
$ call create_time_stamp_response "req2.tsq" "resp2.tsr" "tsa_config1"
223
226
$ write sys$output "Checking '-token_in' and '-token_out' options with '-reply'..."
224
$ call time_stamp_response_token_test req2.tsq resp2.tsr
227
$ call time_stamp_response_token_test "req2.tsq" "resp2.tsr"
226
229
$ write sys$output "Printing response..."
227
$ call print_response resp2.tsr
230
$ call print_response "resp2.tsr"
229
232
$ write sys$output "Verifying valid response..."
230
$ call verify_time_stamp_response req2.tsq resp2.tsr [-]testtsa.com
232
$ write sys$output "Verifying response against wrong request, it should fail..."
233
$ call verify_time_stamp_response_fail req1.tsq resp2.tsr
235
$ write sys$output "Verifying response against wrong request, it should fail..."
236
$ call verify_time_stamp_response_fail req2.tsq resp1.tsr
233
$ call verify_time_stamp_response "req2.tsq" "resp2.tsr" "[-]testtsa.com"
235
$ write sys$output "Verifying response against wrong request, it should fail..."
236
$ call verify_time_stamp_response_fail "req1.tsq" "resp2.tsr"
238
$ write sys$output "Verifying response against wrong request, it should fail..."
239
$ call verify_time_stamp_response_fail "req2.tsq" "resp1.tsr"
238
241
$ write sys$output "Creating req3.req time stamp request for file CAtsa.cnf..."
239
242
$ call create_time_stamp_request3
241
244
$ write sys$output "Printing req3.req..."
242
$ call print_request req3.tsq
245
$ call print_request "req3.tsq"
244
247
$ write sys$output "Verifying response against wrong request, it should fail..."
245
$ call verify_time_stamp_response_fail req3.tsq resp1.tsr
248
$ call verify_time_stamp_response_fail "req3.tsq" "resp1.tsr"
247
250
$ write sys$output "Cleaning up..."
248
251
$ call clean_up_dir