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