Mercurial Hosting > luan
comparison 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 |
comparison
equal
deleted
inserted
replaced
1505:01e38174d580 | 1506:d80395468b4e |
---|---|
3 import java.io.File; | 3 import java.io.File; |
4 import java.io.InputStream; | 4 import java.io.InputStream; |
5 import java.io.OutputStream; | 5 import java.io.OutputStream; |
6 import java.io.IOException; | 6 import java.io.IOException; |
7 import java.nio.file.Files; | 7 import java.nio.file.Files; |
8 import java.security.Security; | |
9 import javax.net.ssl.SSLSocketFactory; | |
10 import javax.net.ssl.SSLServerSocketFactory; | |
8 | 11 |
9 | 12 |
10 public final class IoUtils { | 13 public final class IoUtils { |
11 private IoUtils() {} // never | 14 private IoUtils() {} // never |
12 | 15 |
52 out.write(a,0,n); | 55 out.write(a,0,n); |
53 } | 56 } |
54 in.close(); | 57 in.close(); |
55 } | 58 } |
56 | 59 |
60 | |
61 static { | |
62 // undo restrictions of modern scum | |
63 Security.setProperty("jdk.tls.disabledAlgorithms","SSLv3, RC4, DES, MD5withRSA, DH keySize < 1024, EC keySize < 224, 3DES_EDE_CBC"); | |
64 } | |
65 | |
66 public static SSLSocketFactory getSSLSocketFactory() { | |
67 return (SSLSocketFactory)SSLSocketFactory.getDefault(); | |
68 } | |
69 | |
70 public static SSLServerSocketFactory getSSLServerSocketFactory() { | |
71 return (SSLServerSocketFactory)SSLServerSocketFactory.getDefault(); | |
72 } | |
73 | |
57 } | 74 } |