1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package org.apache.directory.ldap.client.api;
22
23
24 import java.net.Socket;
25 import java.security.cert.CertificateException;
26 import java.security.cert.X509Certificate;
27
28 import javax.net.ssl.SSLEngine;
29 import javax.net.ssl.X509ExtendedTrustManager;
30 import javax.net.ssl.X509TrustManager;
31
32 import org.apache.directory.api.i18n.I18n;
33 import org.slf4j.Logger;
34 import org.slf4j.LoggerFactory;
35
36
37
38
39
40
41
42 public class NoVerificationTrustManager extends X509ExtendedTrustManager
43 {
44
45 private static final Logger LOG = LoggerFactory.getLogger( NoVerificationTrustManager.class );
46
47
48
49
50
51 @Override
52 public void checkClientTrusted( X509Certificate[] x509Certificates, String authType, Socket socket )
53 throws CertificateException
54 {
55 if ( LOG.isDebugEnabled() )
56 {
57 LOG.debug( I18n.msg( I18n.MSG_04168_CHECK_CLIENT_TRUSTED, x509Certificates[0] ) );
58 }
59 }
60
61
62
63
64
65 @Override
66 public void checkClientTrusted( X509Certificate[] x509Certificates, String authType, SSLEngine engine )
67 throws CertificateException
68 {
69 if ( LOG.isDebugEnabled() )
70 {
71 LOG.debug( I18n.msg( I18n.MSG_04168_CHECK_CLIENT_TRUSTED, x509Certificates[0] ) );
72 }
73 }
74
75
76 public void checkServerTrusted( X509Certificate[] x509Certificates, String authType, Socket socket )
77 throws CertificateException
78 {
79 if ( LOG.isDebugEnabled() )
80 {
81 LOG.debug( I18n.msg( I18n.MSG_04169_CHECK_SERVER_TRUSTED, x509Certificates[0] ) );
82 }
83 }
84
85
86
87
88 @Override
89 public void checkServerTrusted( X509Certificate[] x509Certificates, String authType, SSLEngine engine )
90 throws CertificateException
91 {
92 if ( LOG.isDebugEnabled() )
93 {
94 LOG.debug( I18n.msg( I18n.MSG_04169_CHECK_SERVER_TRUSTED, x509Certificates[0] ) );
95 }
96 }
97
98
99
100
101
102 @Override
103 public void checkClientTrusted( X509Certificate[] x509Certificates, String s ) throws CertificateException
104 {
105 if ( LOG.isDebugEnabled() )
106 {
107 LOG.debug( I18n.msg( I18n.MSG_04168_CHECK_CLIENT_TRUSTED, x509Certificates[0] ) );
108 }
109 }
110
111
112
113
114
115 @Override
116 public void checkServerTrusted( X509Certificate[] x509Certificates, String s ) throws CertificateException
117 {
118 if ( LOG.isDebugEnabled() )
119 {
120 LOG.debug( I18n.msg( I18n.MSG_04169_CHECK_SERVER_TRUSTED, x509Certificates[0] ) );
121 }
122 }
123
124
125
126
127
128 @Override
129 public X509Certificate[] getAcceptedIssuers()
130 {
131 return new X509Certificate[0];
132 }
133 }