-
Notifications
You must be signed in to change notification settings - Fork 5
/
create_codesign_ca.bat
47 lines (39 loc) · 1.24 KB
/
create_codesign_ca.bat
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
@echo off
set MYDIR=%~dp0
set FILENAME_PREFIX=mingw-w64-dpp
net session >nul 2>&1
if NOT %ERRORLEVEL% EQU 0 (
echo ERROR: This script requires Administrator privileges!
pause
exit /b 1
)
where makecert.exe >nul 2>&1
IF %ERRORLEVEL% NEQ 0 (
echo ERROR: makecert.exe not found, pleae add it to your PATH
pause
exit /b 1
)
where certmgr.exe >nul 2>&1
IF %ERRORLEVEL% NEQ 0 (
echo ERROR: certmgr.exe not found, pleae add it to your PATH
pause
exit /b 1
)
where cert2spc.exe >nul 2>&1
IF %ERRORLEVEL% NEQ 0 (
echo ERROR: cert2spc.exe not found, pleae add it to your PATH
pause
exit /b 1
)
where pvk2pfx.exe >nul 2>&1
IF %ERRORLEVEL% NEQ 0 (
echo ERROR: pvk2pfx.exe not found, pleae add it to your PATH
pause
exit /b 1
)
makecert.exe -b 01/01/2023 -r -n CN="%FILENAME_PREFIX%" -sv "%MYDIR%/%FILENAME_PREFIX%.pvk" "%MYDIR%/%FILENAME_PREFIX%.cer"
certmgr.exe -add "%MYDIR%/%FILENAME_PREFIX%.cer" -s -r localMachine ROOT
certmgr.exe -add "%MYDIR%/%FILENAME_PREFIX%.cer" -s -r localMachine TRUSTEDPUBLISHER
cert2spc.exe "%MYDIR%/%FILENAME_PREFIX%.cer" "%MYDIR%/%FILENAME_PREFIX%.spc"
pvk2pfx.exe -pvk "%MYDIR%/%FILENAME_PREFIX%.pvk" -spc "%MYDIR%/%FILENAME_PREFIX%.spc" -pfx "%MYDIR%/%FILENAME_PREFIX%.pfx"
pause