-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCipherSuites.java
More file actions
31 lines (23 loc) · 795 Bytes
/
CipherSuites.java
File metadata and controls
31 lines (23 loc) · 795 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import java.io.IOException;
/*
This class returns an Array String of all the supported Cipher Suites of the Url
*/
public class CipherSuites {
public String[] getCipherSuites(String url) throws IOException {
String[] CS=null;
try {
url = url.replaceFirst("(http[s]?://www\\\\.|http[s]?://|www\\\\.)", "");
if (url.charAt(url.length() - 1) == '/') {
url = url.substring(0, url.length() - 1);
}
SSLSocket sslSocket = (SSLSocket) SSLSocketFactory.getDefault().createSocket(url, 80);
CS = sslSocket.getEnabledCipherSuites();
}
catch (Exception e){
CS = null;
}
return CS;
}
}