19 lines
526 B
Text
19 lines
526 B
Text
|
|
||
|
SSLContext ctx;
|
||
|
try {
|
||
|
ctx = SSLContext.getInstance("TLSv1.2", "SunJSSE");
|
||
|
} catch (NoSuchAlgorithmException e) {
|
||
|
try {
|
||
|
ctx = SSLContext.getInstance("TLSv1", "SunJSSE");
|
||
|
} catch (NoSuchAlgorithmException e1) {
|
||
|
throw new AssertionError(e1);
|
||
|
} catch (NoSuchProviderException e1) {
|
||
|
throw new AssertionError(e1);
|
||
|
}
|
||
|
} catch (NoSuchProviderException e) {
|
||
|
throw new AssertionError(e);
|
||
|
}
|
||
|
MyTrustManager tm = new MyTrustManager(certHash);
|
||
|
ctx.init(null, new TrustManager[] {tm}, null);
|
||
|
|