我的应用程序需要在Java控制面板中设置使用TLS1.2和使用TLS1.1属性--->高级选项卡--->高级设置为假。
可以通过编辑deployment.properties文件来实现,如何使用bat文件对其进行编辑,因为这必须在每台客户机中执行。
答案 0 :(得分:0)
尚未完全测试:
@echo off
:: disabled strings
::deployment.security.TLSv1.2=false
::deployment.security.TLSv1.1=false
::deployment.security.TLSv1=false
set "deplProps=%userprofile%\AppData\LocalLow\Sun\Java\Deployment\security\deployment.properties"
:TLSv1
rem if if the property is disabled and the line needs to be stripped
find /i "deployment.security.TLSv1=false" "%deplProps%" >nul 2>nul && (
findstr /i /v "deployment.security.TLSv1=false" "%deplProps%" > "%temp%\deployment.properties"
(echo(deployment.security.TLSv1=true)>>"%temp%\deployment.properties"
move /y "%temp%\deployment.properties" "%deplProps%"
)
rem if there's no explicit disable property
find /i "deployment.security.TLSv1=false" "%deplProps%" >nul 2>nul || (
(echo(deployment.security.TLSv1=true)>>"%deplProps%"
)
:TLSv1.2
find /i "deployment.security.TLSv1.2=false" "%deplProps%" >nul 2>nul && (
findstr /i /v "deployment.security.TLSv1.2=false" "%deplProps%" > "%temp%\deployment.properties"
(echo(deployment.security.TLSv1.2=true)>>"%temp%\deployment.properties"
move /y "%temp%\deployment.properties" "%deplProps%"
)
find /i "deployment.security.TLSv1.2=false" "%deplProps%" >nul 2>nul || (
(echo(deployment.security.TLSv1.2=true)>>"%deplProps%"
)
:TLSv1.1
find /i "deployment.security.TLSv1.1=false" "%deplProps%" >nul 2>nul && (
findstr /i /v "deployment.security.TLSv1.1=false" "%deplProps%" > "%temp%\deployment.properties"
(echo(deployment.security.TLSv1.1=true)>>"%temp%\deployment.properties"
move /y "%temp%\deployment.properties" "%deplProps%"
)
find /i "deployment.security.TLSv1.1=false" "%deplProps%" >nul 2>nul || (
(echo(deployment.security.TLSv1.1=true)>>"%deplProps%"
)