4 $ if f$getsyi("cpu") .ge. 128 then __arch := AXP
5 $ exe_dir := sys$disk:[-.'__arch'.exe.apps]
8 $ reqcmd := mcr 'exe_dir'openssl req
9 $ x509cmd := mcr 'exe_dir'openssl x509 'digest'
10 $ verifycmd := mcr 'exe_dir'openssl verify
11 $ dummycnf := sys$disk:[-.apps]openssl-vms.cnf
13 $ CAkey="""keyCA.ss"""
14 $ CAcert="""certCA.ss"""
15 $ CAreq="""reqCA.ss"""
16 $ CAconf="""CAss.cnf"""
17 $ CAreq2="""req2CA.ss""" ! temp
22 $ Ucert="""certU.ss"""
25 $ write sys$output "make a certificate request using 'req'"
28 $ define/user sys$output nla0:
29 $ mcr 'exe_dir'openssl no-rsa
30 $ save_severity=$SEVERITY
34 $ req_new="-newkey dsa:[-.apps]dsa512.pem"
39 $ 'reqcmd' -config 'CAconf' -out 'CAreq' -keyout 'CAkey' 'req_new' ! -out err.ss
42 $ write sys$output "error using 'req' to generate a certificate request"
46 $ write sys$output "convert the certificate request into a self signed certificate using 'x509'"
47 $ define /user sys$output err.ss
48 $ 'x509cmd' "-CAcreateserial" -in 'CAreq' -days 30 -req -out 'CAcert' -signkey 'CAkey'
51 $ write sys$output "error using 'x509' to self sign a certificate request"
56 $ write sys$output "convert a certificate into a certificate request using 'x509'"
57 $ define /user sys$output err.ss
58 $ 'x509cmd' -in 'CAcert' -x509toreq -signkey 'CAkey' -out 'CAreq2'
61 $ write sys$output "error using 'x509' convert a certificate to a certificate request"
65 $ 'reqcmd' -config 'dummycnf' -verify -in 'CAreq' -noout
68 $ write sys$output "first generated request is invalid"
72 $ 'reqcmd' -config 'dummycnf' -verify -in 'CAreq2' -noout
75 $ write sys$output "second generated request is invalid"
79 $ 'verifycmd' "-CAfile" 'CAcert' 'CAcert'
82 $ write sys$output "first generated cert is invalid"
87 $ write sys$output "make another certificate request using 'req'"
88 $ define /user sys$output err.ss
89 $ 'reqcmd' -config 'Uconf' -out 'Ureq' -keyout 'Ukey' 'req_new'
92 $ write sys$output "error using 'req' to generate a certificate request"
97 $ write sys$output "sign certificate request with the just created CA via 'x509'"
98 $ define /user sys$output err.ss
99 $ 'x509cmd' "-CAcreateserial" -in 'Ureq' -days 30 -req -out 'Ucert' "-CA" 'CAcert' "-CAkey" 'CAkey'
100 $ if $severity .ne. 1
102 $ write sys$output "error using 'x509' to sign a certificate request"
106 $ 'verifycmd' "-CAfile" 'CAcert' 'Ucert'
107 $ write sys$output ""
108 $ write sys$output "Certificate details"
109 $ 'x509cmd' -subject -issuer -startdate -enddate -noout -in 'Ucert'
111 $ write sys$output ""
112 $ write sys$output "The generated CA certificate is ",CAcert
113 $ write sys$output "The generated CA private key is ",CAkey
115 $ write sys$output "The generated user certificate is ",Ucert
116 $ write sys$output "The generated user private key is ",Ukey
118 $ if f$search("err.ss;*") .nes. "" then delete err.ss;*