3
rem set ssleay=..\out\ssleay
6
set reqcmd=%ssleay% req
7
set x509cmd=%ssleay% x509 -sha1
8
set verifycmd=%ssleay% verify
12
set CAserial=certCA.srl
14
set CAconf=..\test\CAss.cnf
17
set Uconf=..\test\Uss.cnf
22
echo make a certificate request using 'req'
23
%reqcmd% -config %CAconf% -out %CAreq% -keyout %CAkey% -new
24
if errorlevel 1 goto e_req
26
echo convert the certificate request into a self signed certificate using 'x509'
27
%x509cmd% -CAcreateserial -in %CAreq% -days 30 -req -out %CAcert% -signkey %CAkey% >err.ss
28
if errorlevel 1 goto e_x509
31
echo convert a certificate into a certificate request using 'x509'
32
%x509cmd% -in %CAcert% -x509toreq -signkey %CAkey% -out %CAreq2% >err.ss
33
if errorlevel 1 goto e_x509_2
35
%reqcmd% -verify -in %CAreq% -noout
36
if errorlevel 1 goto e_vrfy_1
38
%reqcmd% -verify -in %CAreq2% -noout
39
if errorlevel 1 goto e_vrfy_2
41
%verifycmd% -CAfile %CAcert% %CAcert%
42
if errorlevel 1 goto e_vrfy_3
45
echo make another certificate request using 'req'
46
%reqcmd% -config %Uconf% -out %Ureq% -keyout %Ukey% -new >err.ss
47
if errorlevel 1 goto e_req_gen
50
echo sign certificate request with the just created CA via 'x509'
51
%x509cmd% -CAcreateserial -in %Ureq% -days 30 -req -out %Ucert% -CA %CAcert% -CAkey %CAkey% -CAserial %CAserial%
52
if errorlevel 1 goto e_x_sign
54
%verifycmd% -CAfile %CAcert% %Ucert%
56
echo Certificate details
57
%x509cmd% -subject -issuer -startdate -enddate -noout -in %Ucert%
59
echo Everything appeared to work
61
echo The generated CA certificate is %CAcert%
62
echo The generated CA private key is %CAkey%
63
echo The current CA signing serial number is in %CAserial%
65
echo The generated user certificate is %Ucert%
66
echo The generated user private key is %Ukey%
74
echo error using 'req' to generate a certificate request
77
echo error using 'x509' to self sign a certificate request
80
echo error using 'x509' convert a certificate to a certificate request
83
echo first generated request is invalid
86
echo second generated request is invalid
89
echo first generated cert is invalid
92
echo error using 'req' to generate a certificate request
95
echo error using 'x509' to sign a certificate request
3
rem set ssleay=..\out\ssleay
6
set reqcmd=%ssleay% req
7
set x509cmd=%ssleay% x509 -sha1
8
set verifycmd=%ssleay% verify
12
set CAserial=certCA.srl
14
set CAconf=..\test\CAss.cnf
17
set Uconf=..\test\Uss.cnf
22
echo make a certificate request using 'req'
23
%reqcmd% -config %CAconf% -out %CAreq% -keyout %CAkey% -new
24
if errorlevel 1 goto e_req
26
echo convert the certificate request into a self signed certificate using 'x509'
27
%x509cmd% -CAcreateserial -in %CAreq% -days 30 -req -out %CAcert% -signkey %CAkey% >err.ss
28
if errorlevel 1 goto e_x509
31
echo convert a certificate into a certificate request using 'x509'
32
%x509cmd% -in %CAcert% -x509toreq -signkey %CAkey% -out %CAreq2% >err.ss
33
if errorlevel 1 goto e_x509_2
35
%reqcmd% -verify -in %CAreq% -noout
36
if errorlevel 1 goto e_vrfy_1
38
%reqcmd% -verify -in %CAreq2% -noout
39
if errorlevel 1 goto e_vrfy_2
41
%verifycmd% -CAfile %CAcert% %CAcert%
42
if errorlevel 1 goto e_vrfy_3
45
echo make another certificate request using 'req'
46
%reqcmd% -config %Uconf% -out %Ureq% -keyout %Ukey% -new >err.ss
47
if errorlevel 1 goto e_req_gen
50
echo sign certificate request with the just created CA via 'x509'
51
%x509cmd% -CAcreateserial -in %Ureq% -days 30 -req -out %Ucert% -CA %CAcert% -CAkey %CAkey% -CAserial %CAserial%
52
if errorlevel 1 goto e_x_sign
54
%verifycmd% -CAfile %CAcert% %Ucert%
56
echo Certificate details
57
%x509cmd% -subject -issuer -startdate -enddate -noout -in %Ucert%
59
echo Everything appeared to work
61
echo The generated CA certificate is %CAcert%
62
echo The generated CA private key is %CAkey%
63
echo The current CA signing serial number is in %CAserial%
65
echo The generated user certificate is %Ucert%
66
echo The generated user private key is %Ukey%
74
echo error using 'req' to generate a certificate request
77
echo error using 'x509' to self sign a certificate request
80
echo error using 'x509' convert a certificate to a certificate request
83
echo first generated request is invalid
86
echo second generated request is invalid
89
echo first generated cert is invalid
92
echo error using 'req' to generate a certificate request
95
echo error using 'x509' to sign a certificate request