1 16 package org.apache.axis.components.net; 17 18 import com.ibm.net.ssl.SSLContext; 19 import com.ibm.net.ssl.TrustManager; 20 import com.ibm.net.ssl.X509TrustManager; 21 import org.apache.axis.components.logger.LogFactory; 22 import org.apache.axis.utils.Messages; 23 import org.apache.commons.logging.Log; 24 25 import java.util.Hashtable ; 26 27 30 public class IBMFakeTrustSocketFactory extends IBMJSSESocketFactory { 31 32 33 protected static Log log = 34 LogFactory.getLog(IBMFakeTrustSocketFactory.class.getName()); 35 36 41 public IBMFakeTrustSocketFactory(Hashtable attributes) { 42 super(attributes); 43 } 44 45 52 protected SSLContext getContext() throws Exception { 53 54 try { 55 SSLContext sc = SSLContext.getInstance("SSL"); 56 57 sc.init(null, new TrustManager[]{new FakeX509TrustManager()}, 59 new java.security.SecureRandom ()); 60 if (log.isDebugEnabled()) { 61 log.debug(Messages.getMessage("ftsf00")); 62 } 63 return sc; 64 } catch (Exception exc) { 65 log.error(Messages.getMessage("ftsf01"), exc); 66 throw new Exception (Messages.getMessage("ftsf02")); 67 } 68 } 69 70 73 public static class FakeX509TrustManager implements X509TrustManager { 74 75 76 protected static Log log = 77 LogFactory.getLog(FakeX509TrustManager.class.getName()); 78 79 86 public boolean isClientTrusted(java.security.cert 87 .X509Certificate[] chain) { 88 89 if (log.isDebugEnabled()) { 90 log.debug(Messages.getMessage("ftsf03")); 91 } 92 return true; 93 } 94 95 102 public boolean isServerTrusted(java.security.cert 103 .X509Certificate[] chain) { 104 105 if (log.isDebugEnabled()) { 106 log.debug(Messages.getMessage("ftsf04")); 107 } 108 return true; 109 } 110 111 116 public java.security.cert.X509Certificate [] getAcceptedIssuers() { 117 118 if (log.isDebugEnabled()) { 119 log.debug(Messages.getMessage("ftsf05")); 120 } 121 return null; 122 } 123 } 124 } 125 | Popular Tags |