1

My application needs to set Use TLS1.2 and Use TLS1.1 properties in Java Control Panel --->Advanced tab--->Advanced Settings to false .

It can be acheived by editing deployment.properties file , how to edit this using a bat file , since this has to be performed in each and every client machine.

Magicprog.fr
  • 4,072
  • 4
  • 26
  • 35
Archu
  • 29
  • 1
  • 2

1 Answers1

0

Not completely tested:

@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%"
)
npocmaka
  • 55,367
  • 18
  • 148
  • 187
  • Hi thank you this is working..... But deployment.properties file is found in variable locations in different systems , can you please let me know how to determine the path of this file using any bat command etc? – Archu Aug 24 '15 at 10:47
  • You check this https://docs.oracle.com/javase/7/docs/technotes/guides/jweb/jcp/properties.html and this https://docs.oracle.com/javase/7/docs/technotes/guides/jweb/jcp/properties.html to see differences in the file location. As I have only one machine I cant perform much testing.I think using `%LOCALAPPDATA%` environment variable could give the location in more compatible way, – npocmaka Aug 24 '15 at 11:03