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