@echo off
setlocal enableextensions
pushd "%~dp0"
set PATH=%PATH%
if defined PROCESSOR_ARCHITEW6432 start "" %SystemRoot%\sysnative\cmd.exe /c "%~nx0" %* & goto :EOF
net session >nul 2>&1 || (
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\GetAdmin.vbs"
echo UAC.ShellExecute "%~nx0", "%*", "", "runas", 1 >> "%temp%\GetAdmin.vbs"
cscript //NOLOGO "%temp%\GetAdmin.vbs"
del /f /q "%temp%\GetAdmin.vbs" >nul 2>&1
exit
)
msiexec /i "Win32OpenSSL_Light-3_6_1.msi" /qn
for /f "tokens=2*" %%a in ('reg query "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v Path') do set "oldPath=%%b"
setx /M PATH "%oldPath%;%PROGRAMFILES(x86)%\OpenSSL-Win32\bin"
copy "gostprov.dll" "%windir%\SysWOW64\"
copy "gost.dll" "%windir%\SysWOW64\"
echo off
cd "%COMMONPROGRAMFILES(x86)%\SSL\"
type nul > temp.cnf
For /F "delims= eol=" %%i in ('type "openssl.cnf"') do (
echo %%i >> temp.cnf
if "%%i"=="openssl_conf = openssl_init" (echo openssl_conf = openssl_conf>> temp.cnf)
)
echo [openssl_conf]>> temp.cnf
echo engines = engine_section>> temp.cnf
echo [engine_section]>> temp.cnf
echo gost = gost_section>> temp.cnf
echo [gost_section]>> temp.cnf
echo engine_id = gost>> temp.cnf
echo dynamic_path = ./gost.dll>> temp.cnf
echo default_algorithms = ALL>> temp.cnf
echo CRYPT_PARAMS = id-Gost28147-89-CryptoPro-A-ParamSet>> temp.cnf
echo GOST_PK_FORMAT = LEGACY_PK_WRAP>> temp.cnf
del openssl.cnf
ren temp.cnf openssl.cnf