1$! TESTENC.COM  --  Test encoding and decoding
2$
3$	__arch := VAX
4$	if f$getsyi("cpu") .ge. 128 then __arch := AXP
5$	exe_dir := sys$disk:[-.'__arch'.exe.apps]
6$
7$	testsrc := makefile.
8$	test := p.txt
9$	cmd := mcr 'exe_dir'openssl
10$
11$	if f$search(test) .nes. "" then delete 'test';*
12$	convert/fdl=sys$input: 'testsrc' 'test'
13RECORD
14	FORMAT STREAM_LF
15$
16$	if f$search(test+"-cipher") .nes. "" then delete 'test'-cipher;*
17$	if f$search(test+"-clear") .nes. "" then delete 'test'-clear;*
18$
19$	write sys$output "cat"
20$	'cmd' enc -in 'test' -out 'test'-cipher
21$	'cmd' enc -in 'test'-cipher -out 'test'-clear
22$	backup/compare 'test' 'test'-clear
23$	if $severity .ne. 1 then exit 3
24$	delete 'test'-cipher;*,'test'-clear;*
25$
26$	write sys$output "base64"
27$	'cmd' enc -a -e -in 'test' -out 'test'-cipher
28$	'cmd' enc -a -d -in 'test'-cipher -out 'test'-clear
29$	backup/compare 'test' 'test'-clear
30$	if $severity .ne. 1 then exit 3
31$	delete 'test'-cipher;*,'test'-clear;*
32$
33$	define/user sys$output 'test'-cipher-commands
34$	'cmd' list-cipher-commands
35$	open/read f 'test'-cipher-commands
36$ loop_cipher_commands:
37$	read/end=loop_cipher_commands_end f i
38$	write sys$output i
39$
40$	if f$search(test+"-"+i+"-cipher") .nes. "" then -
41		delete 'test'-'i'-cipher;*
42$	if f$search(test+"-"+i+"-clear") .nes. "" then -
43		delete 'test'-'i'-clear;*
44$
45$	'cmd' 'i' -bufsize 113 -e -k test -in 'test' -out 'test'-'i'-cipher
46$	'cmd' 'i' -bufsize 157 -d -k test -in 'test'-'i'-cipher -out 'test'-'i'-clear
47$	backup/compare 'test' 'test'-'i'-clear
48$	if $severity .ne. 1 then exit 3
49$	delete 'test'-'i'-cipher;*,'test'-'i'-clear;*
50$
51$	write sys$output i," base64"
52$	'cmd' 'i' -bufsize 113 -a -e -k test -in 'test' -out 'test'-'i'-cipher
53$	'cmd' 'i' -bufsize 157 -a -d -k test -in 'test'-'i'-cipher -out 'test'-'i'-clear
54$	backup/compare 'test' 'test'-'i'-clear
55$	if $severity .ne. 1 then exit 3
56$	delete 'test'-'i'-cipher;*,'test'-'i'-clear;*
57$
58$	goto loop_cipher_commands
59$ loop_cipher_commands_end:
60$	close f
61$	delete 'test'-cipher-commands;*
62$	delete 'test';*
63