11package com .marklogic .client .ext .modulesloader .ssl ;
22
3- import java .security .cert .CertificateException ;
4- import java .security .cert .X509Certificate ;
5-
63import javax .net .ssl .SSLContext ;
74import javax .net .ssl .TrustManager ;
85import javax .net .ssl .X509TrustManager ;
6+ import java .security .cert .X509Certificate ;
97
108/**
119 * "Simple" in that it doesn't do anything. Useful for development, but you should consider something more robust for a
@@ -19,21 +17,25 @@ public class SimpleX509TrustManager implements X509TrustManager {
1917 * @return
2018 */
2119 public static SSLContext newSSLContext () {
22- try {
23- SSLContext sslContext = SSLContext .getInstance ("SSLv3" );
24- sslContext .init (null , new TrustManager [] { new SimpleX509TrustManager () }, null );
25- return sslContext ;
26- } catch (Exception e ) {
27- throw new RuntimeException (e );
28- }
20+ return newSSLContext ("TLSv1.2" );
2921 }
3022
23+ public static SSLContext newSSLContext (String protocol ) {
24+ try {
25+ SSLContext sslContext = SSLContext .getInstance (protocol );
26+ sslContext .init (null , new TrustManager [] { new SimpleX509TrustManager () }, null );
27+ return sslContext ;
28+ } catch (Exception e ) {
29+ throw new RuntimeException (e );
30+ }
31+ }
32+
3133 @ Override
32- public void checkClientTrusted (X509Certificate [] chain , String authType ) throws CertificateException {
34+ public void checkClientTrusted (X509Certificate [] chain , String authType ) {
3335 }
3436
3537 @ Override
36- public void checkServerTrusted (X509Certificate [] chain , String authType ) throws CertificateException {
38+ public void checkServerTrusted (X509Certificate [] chain , String authType ) {
3739 }
3840
3941 @ Override
0 commit comments