1$! TESTGEN.COM
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$	if (p1 .eqs. 64) then __arch = __arch+ "_64"
8$	exe_dir = "sys$disk:[-.''__arch'.exe.apps]"
9$
10$	T = "testcert"
11$	KEY = 512
12$	CA = "[-.certs]testca.pem"
13$
14$	set noon
15$	if f$search(T+".1;*") .nes. "" then delete 'T'.1;*
16$	if f$search(T+".2;*") .nes. "" then delete 'T'.2;*
17$	if f$search(T+".key;*") .nes. "" then delete 'T'.key;*
18$	set on
19$
20$	write sys$output "generating certificate request"
21$
22$	append/new nl: .rnd
23$	open/append random_file .rnd
24$	write random_file -
25	 "string to make the random number generator think it has entropy"
26$	close random_file
27$
28$	set noon
29$	define/user sys$output nla0:
30$	mcr 'exe_dir'openssl no-rsa
31$	save_severity=$SEVERITY
32$	set on
33$	if save_severity
34$	then
35$	    req_new="-newkey dsa:[-.apps]dsa512.pem"
36$	else
37$	    req_new="-new"
38$	    write sys$output -
39	     "There should be a 2 sequences of .'s and some +'s."
40$	    write sys$output -
41	     "There should not be more that at most 80 per line"
42$	endif
43$
44$	write sys$output "This could take some time."
45$
46$	mcr 'exe_dir'openssl req -config test.cnf 'req_new' -out testreq.pem
47$	if $severity .ne. 1
48$	then
49$	    write sys$output "problems creating request"
50$	    exit 3
51$	endif
52$
53$	mcr 'exe_dir'openssl req -config test.cnf -verify -in testreq.pem -noout
54$	if $severity .ne. 1
55$	then
56$	    write sys$output "signature on req is wrong"
57$	    exit 3
58$	endif
59