gencerts.bat 1.67 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
@echo off

REM Output path
REM Path where certificates must be stored
SET OUTPATH=certificates

REM IUT public key file
REM Set it for IUTs which store private keys internally
REM SET IUT_PUBLIC_KEY=<path>

REM Certificate generator path
REM Visual studio
SET CERTGEN=..\tools\itscertgen\build\msvc\Debug\itscertgen.exe 
REM MINGW32
REM SET CERTGEN=..\tools\itscertgen\build\mingw32-d\itscertgen.exe
REM ---------------------------------------------------------------

if DEFINED IUT_PUBLIC_KEY (
	IF NOT EXIST %IUT_PUBLIC_KEY% (^
		echo %IUT_PUBLIC_KEY%: IUT public key file not found 
		exit 1
	)
)

if not exist %OUTPATH% md %OUTPATH%

REM Generate Generic TS certificates
for  %%f in ( profiles\CERT_*_ROOT.xml ^
	profiles\CERT_TS_?_EA.xml profiles\CERT_TS_??_EA.xml ^
	profiles\CERT_TS_?_AA.xml profiles\CERT_TS_??_AA.xml ^
	profiles\CERT_TS_?_EC.xml profiles\CERT_TS_??_EC.xml ^
	profiles\CERT_TS_?_AT.xml profiles\CERT_TS_??_AT.xml  ) DO (
	echo %%f:
	%CERTGEN% -C gencerts.cfg -o %OUTPATH% %%f
)

REM Generate various valid or invalid TS certificates
for  %%f in ( profiles\CERT_*_BO_CA.xml profiles\CERT_*_BV_CA.xml ^
	profiles\CERT_*_BO_AA.xml profiles\CERT_*_BV_AA.xml ^
	profiles\CERT_*_BO_EA.xml profiles\CERT_*_BV_EA.xml ^
	profiles\CERT_*_BO_EC.xml profiles\CERT_*_BV_EC.xml ^
	profiles\CERT_*_BO_AT.xml profiles\CERT_*_BV_AT.xml ) DO (
	echo %%f:
	%CERTGEN% -C gencerts.cfg -o %OUTPATH% %%f
)

REM Generate IUT certificates
for  %%f in (profiles\CERT_IUT_*.xml) DO (
	echo %%f:
        if DEFINED IUT_PUBLIC_KEY (
		%CERTGEN% -C gencerts.cfg -o %OUTPATH% -v %IUT_PUBLIC_KEY% %%f
	) ELSE (
		%CERTGEN% -C gencerts.cfg -o %OUTPATH% %%f
	)
)