java.security.properties - changes not applied

6.5k views Asked by At

I try to append security properties to java.security. Hence I add a property "java.security.properties" specifying the file to be appended.

I checked that security.overridePropertiesFile is set to true.

For some reason the changes to the security policy are not applied. If I change the file "java.security" directly everything works fine.

Either the file cannot be found or the content of the file is not correct. I do not get any error message about the location. I tried absolute, relativ paths. The content of the file is the following (one line):

jdk.tls.disabledAlgorithms=ECDH, DH, RC4, DES, MD5withRSA, 3DES_EDE_CBC, DESede, DES, anon, NULL

I guess there is something wrong with the path but don't know since there are no logs about it. Couln't find good information about the path though. All examples are relativ paths which do not work either for me.

I am using JDK11.

1

There are 1 answers

5
Sean Mullan On

Try running your application with -Djava.security.debug=properties on the command line. If there is an issue loading the file, you should get a message such as "unable to load security properties from <filename>" with an exception stack trace.

Also, you should set the java.security.properties system property on the command line if possible. If not, it should be set as early as possible in your code; otherwise depending on what the application does, it may read and cache the values of security properties from the java.security file before it loads your properties file.