Mercurial Hosting > luan
diff src/goodjava/io/IoUtils.java @ 1506:d80395468b4e
ssl security in code
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Fri, 15 May 2020 18:29:47 -0600 |
parents | e66e3d50b289 |
children | 86c5e7000ecf |
line wrap: on
line diff
--- a/src/goodjava/io/IoUtils.java Thu May 14 15:49:45 2020 -0600 +++ b/src/goodjava/io/IoUtils.java Fri May 15 18:29:47 2020 -0600 @@ -5,6 +5,9 @@ import java.io.OutputStream; import java.io.IOException; import java.nio.file.Files; +import java.security.Security; +import javax.net.ssl.SSLSocketFactory; +import javax.net.ssl.SSLServerSocketFactory; public final class IoUtils { @@ -54,4 +57,18 @@ in.close(); } + + static { + // undo restrictions of modern scum + Security.setProperty("jdk.tls.disabledAlgorithms","SSLv3, RC4, DES, MD5withRSA, DH keySize < 1024, EC keySize < 224, 3DES_EDE_CBC"); + } + + public static SSLSocketFactory getSSLSocketFactory() { + return (SSLSocketFactory)SSLSocketFactory.getDefault(); + } + + public static SSLServerSocketFactory getSSLServerSocketFactory() { + return (SSLServerSocketFactory)SSLServerSocketFactory.getDefault(); + } + } \ No newline at end of file