1 11 12 package org.jivesoftware.messenger.net; 13 14 import org.jivesoftware.util.LocaleUtils; 15 import org.jivesoftware.util.Log; 16 import com.sun.net.ssl.X509TrustManager; 17 import java.security.cert.CertificateExpiredException ; 18 import java.security.cert.CertificateNotYetValidException ; 19 import java.security.cert.X509Certificate ; 20 21 35 public class SSLJiveTrustManager implements X509TrustManager { 36 37 public void checkClientTrusted(X509Certificate [] chain, String authType) { 38 39 } 40 41 public void checkServerTrusted(X509Certificate [] chain, String authType) { 42 } 43 44 public boolean isClientTrusted(X509Certificate [] x509Certificates) { 45 return true; 46 } 47 48 public boolean isServerTrusted(X509Certificate [] x509Certificates) { 49 boolean trusted = true; 50 try { 51 x509Certificates[0].checkValidity(); 52 } 53 catch (CertificateExpiredException e) { 54 Log.error(LocaleUtils.getLocalizedString("admin.error"), e); 55 trusted = false; 56 } 57 catch (CertificateNotYetValidException e) { 58 Log.error(LocaleUtils.getLocalizedString("admin.error"), e); 59 trusted = false; 60 } 61 return trusted; 62 } 63 64 public X509Certificate [] getAcceptedIssuers() { 65 return new X509Certificate [0]; 66 } 67 } 68 | Popular Tags |