0N/A/*
2362N/A * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/A/*
0N/A * NOTE: this file was copied from javax.net.ssl.SSLSecurity,
0N/A * but was heavily modified to allow com.sun.* users to
0N/A * access providers written using the javax.sun.* APIs.
0N/A */
0N/A
0N/Apackage com.sun.net.ssl;
0N/A
0N/Aimport java.util.*;
0N/Aimport java.io.*;
0N/Aimport java.security.*;
0N/Aimport java.security.Provider.Service;
0N/Aimport java.net.Socket;
0N/A
0N/Aimport sun.security.jca.*;
0N/A
0N/A/**
0N/A * This class instantiates implementations of JSSE engine classes from
0N/A * providers registered with the java.security.Security object.
0N/A *
0N/A * @author Jan Luehe
0N/A * @author Jeff Nisewanger
0N/A * @author Brad Wetmore
0N/A */
0N/A
0N/Afinal class SSLSecurity {
0N/A
0N/A /*
0N/A * Don't let anyone instantiate this.
0N/A */
0N/A private SSLSecurity() {
0N/A }
0N/A
0N/A
0N/A // ProviderList.getService() is not accessible now, implement our own loop
0N/A private static Service getService(String type, String alg) {
0N/A ProviderList list = Providers.getProviderList();
0N/A for (Provider p : list.providers()) {
0N/A Service s = p.getService(type, alg);
0N/A if (s != null) {
0N/A return s;
0N/A }
0N/A }
0N/A return null;
0N/A }
0N/A
0N/A /**
0N/A * The body of the driver for the getImpl method.
0N/A */
0N/A private static Object[] getImpl1(String algName, String engineType,
0N/A Service service) throws NoSuchAlgorithmException
0N/A {
0N/A Provider provider = service.getProvider();
0N/A String className = service.getClassName();
0N/A Class implClass;
0N/A try {
0N/A ClassLoader cl = provider.getClass().getClassLoader();
0N/A if (cl == null) {
0N/A // system class
0N/A implClass = Class.forName(className);
0N/A } else {
0N/A implClass = cl.loadClass(className);
0N/A }
0N/A } catch (ClassNotFoundException e) {
0N/A throw new NoSuchAlgorithmException("Class " + className +
0N/A " configured for " +
0N/A engineType +
0N/A " not found: " +
0N/A e.getMessage());
0N/A } catch (SecurityException e) {
0N/A throw new NoSuchAlgorithmException("Class " + className +
0N/A " configured for " +
0N/A engineType +
0N/A " cannot be accessed: " +
0N/A e.getMessage());
0N/A }
0N/A
0N/A /*
0N/A * JSSE 1.0, 1.0.1, and 1.0.2 used the com.sun.net.ssl API as the
0N/A * API was being developed. As JSSE was folded into the main
0N/A * release, it was decided to promote the com.sun.net.ssl API to
0N/A * be javax.net.ssl. It is desired to keep binary compatibility
0N/A * with vendors of JSSE implementation written using the
0N/A * com.sun.net.sll API, so we do this magic to handle everything.
0N/A *
0N/A * API used Implementation used Supported?
0N/A * ======== =================== ==========
0N/A * com.sun javax Yes
0N/A * com.sun com.sun Yes
0N/A * javax javax Yes
0N/A * javax com.sun Not Currently
0N/A *
0N/A * Make sure the implementation class is a subclass of the
0N/A * corresponding engine class.
0N/A *
0N/A * In wrapping these classes, there's no way to know how to
0N/A * wrap all possible classes that extend the TrustManager/KeyManager.
0N/A * We only wrap the x509 variants.
0N/A */
0N/A
0N/A try { // catch instantiation errors
0N/A
0N/A /*
0N/A * (The following Class.forName()s should alway work, because
0N/A * this class and all the SPI classes in javax.crypto are
0N/A * loaded by the same class loader.) That is, unless they
0N/A * give us a SPI class that doesn't exist, say SSLFoo,
0N/A * or someone has removed classes from the jsse.jar file.
0N/A */
0N/A
0N/A Class typeClassJavax;
0N/A Class typeClassCom;
0N/A Object obj = null;
0N/A
0N/A /*
0N/A * Odds are more likely that we have a javax variant, try this
0N/A * first.
0N/A */
0N/A if (((typeClassJavax = Class.forName("javax.net.ssl." +
0N/A engineType + "Spi")) != null) &&
0N/A (checkSuperclass(implClass, typeClassJavax))) {
0N/A
0N/A if (engineType.equals("SSLContext")) {
0N/A obj = new SSLContextSpiWrapper(algName, provider);
0N/A } else if (engineType.equals("TrustManagerFactory")) {
0N/A obj = new TrustManagerFactorySpiWrapper(algName, provider);
0N/A } else if (engineType.equals("KeyManagerFactory")) {
0N/A obj = new KeyManagerFactorySpiWrapper(algName, provider);
0N/A } else {
0N/A /*
0N/A * We should throw an error if we get
0N/A * something totally unexpected. Don't ever
0N/A * expect to see this one...
0N/A */
0N/A throw new IllegalStateException(
0N/A "Class " + implClass.getName() +
0N/A " unknown engineType wrapper:" + engineType);
0N/A }
0N/A
0N/A } else if (((typeClassCom = Class.forName("com.sun.net.ssl." +
0N/A engineType + "Spi")) != null) &&
0N/A (checkSuperclass(implClass, typeClassCom))) {
0N/A obj = service.newInstance(null);
0N/A }
0N/A
0N/A if (obj != null) {
0N/A return new Object[] { obj, provider };
0N/A } else {
0N/A throw new NoSuchAlgorithmException(
0N/A "Couldn't locate correct object or wrapper: " +
0N/A engineType + " " + algName);
0N/A }
0N/A
0N/A } catch (ClassNotFoundException e) {
0N/A IllegalStateException exc = new IllegalStateException(
0N/A "Engine Class Not Found for " + engineType);
0N/A exc.initCause(e);
0N/A throw exc;
0N/A }
0N/A }
0N/A
0N/A /**
0N/A * Returns an array of objects: the first object in the array is
0N/A * an instance of an implementation of the requested algorithm
0N/A * and type, and the second object in the array identifies the provider
0N/A * of that implementation.
0N/A * The <code>provName</code> argument can be null, in which case all
0N/A * configured providers will be searched in order of preference.
0N/A */
0N/A static Object[] getImpl(String algName, String engineType, String provName)
0N/A throws NoSuchAlgorithmException, NoSuchProviderException
0N/A {
0N/A Service service;
0N/A if (provName != null) {
0N/A ProviderList list = Providers.getProviderList();
0N/A Provider prov = list.getProvider(provName);
0N/A if (prov == null) {
0N/A throw new NoSuchProviderException("No such provider: " +
0N/A provName);
0N/A }
0N/A service = prov.getService(engineType, algName);
0N/A } else {
0N/A service = getService(engineType, algName);
0N/A }
0N/A if (service == null) {
0N/A throw new NoSuchAlgorithmException("Algorithm " + algName
0N/A + " not available");
0N/A }
0N/A return getImpl1(algName, engineType, service);
0N/A }
0N/A
0N/A
0N/A /**
0N/A * Returns an array of objects: the first object in the array is
0N/A * an instance of an implementation of the requested algorithm
0N/A * and type, and the second object in the array identifies the provider
0N/A * of that implementation.
0N/A * The <code>prov</code> argument can be null, in which case all
0N/A * configured providers will be searched in order of preference.
0N/A */
0N/A static Object[] getImpl(String algName, String engineType, Provider prov)
0N/A throws NoSuchAlgorithmException
0N/A {
0N/A Service service = prov.getService(engineType, algName);
0N/A if (service == null) {
0N/A throw new NoSuchAlgorithmException("No such algorithm: " +
0N/A algName);
0N/A }
0N/A return getImpl1(algName, engineType, service);
0N/A }
0N/A
0N/A /*
0N/A * Checks whether one class is the superclass of another
0N/A */
0N/A private static boolean checkSuperclass(Class subclass, Class superclass) {
0N/A if ((subclass == null) || (superclass == null))
0N/A return false;
0N/A
0N/A while (!subclass.equals(superclass)) {
0N/A subclass = subclass.getSuperclass();
0N/A if (subclass == null) {
0N/A return false;
0N/A }
0N/A }
0N/A return true;
0N/A }
0N/A
0N/A /*
0N/A * Return at most the first "resize" elements of an array.
0N/A *
0N/A * Didn't want to use java.util.Arrays, as PJava may not have it.
0N/A */
0N/A static Object[] truncateArray(Object[] oldArray, Object[] newArray) {
0N/A
0N/A for (int i = 0; i < newArray.length; i++) {
0N/A newArray[i] = oldArray[i];
0N/A }
0N/A
0N/A return newArray;
0N/A }
0N/A
0N/A}
0N/A
0N/A
0N/A/*
0N/A * =================================================================
0N/A * The remainder of this file is for the wrapper and wrapper-support
0N/A * classes. When SSLSecurity finds something which extends the
0N/A * javax.net.ssl.*Spi, we need to go grab a real instance of the
0N/A * thing that the Spi supports, and wrap into a com.sun.net.ssl.*Spi
0N/A * object. This also mean that anything going down into the SPI
0N/A * needs to be wrapped, as well as anything coming back up.
0N/A */
0N/A
0N/Afinal class SSLContextSpiWrapper extends SSLContextSpi {
0N/A
0N/A private javax.net.ssl.SSLContext theSSLContext;
0N/A
0N/A SSLContextSpiWrapper(String algName, Provider prov) throws
0N/A NoSuchAlgorithmException {
0N/A theSSLContext = javax.net.ssl.SSLContext.getInstance(algName, prov);
0N/A }
0N/A
0N/A protected void engineInit(KeyManager[] kma, TrustManager[] tma,
0N/A SecureRandom sr) throws KeyManagementException {
0N/A
0N/A // Keep track of the actual number of array elements copied
0N/A int dst;
0N/A int src;
0N/A javax.net.ssl.KeyManager[] kmaw;
0N/A javax.net.ssl.TrustManager[] tmaw;
0N/A
0N/A // Convert com.sun.net.ssl.kma to a javax.net.ssl.kma
0N/A // wrapper if need be.
0N/A if (kma != null) {
0N/A kmaw = new javax.net.ssl.KeyManager[kma.length];
0N/A for (src = 0, dst = 0; src < kma.length; ) {
0N/A /*
0N/A * These key managers may implement both javax
0N/A * and com.sun interfaces, so if they do
0N/A * javax, there's no need to wrap them.
0N/A */
0N/A if (!(kma[src] instanceof javax.net.ssl.KeyManager)) {
0N/A /*
0N/A * Do we know how to convert them? If not, oh well...
0N/A * We'll have to drop them on the floor in this
0N/A * case, cause we don't know how to handle them.
0N/A * This will be pretty rare, but put here for
0N/A * completeness.
0N/A */
0N/A if (kma[src] instanceof X509KeyManager) {
0N/A kmaw[dst] = (javax.net.ssl.KeyManager)
0N/A new X509KeyManagerJavaxWrapper(
0N/A (X509KeyManager)kma[src]);
0N/A dst++;
0N/A }
0N/A } else {
0N/A // We can convert directly, since they implement.
0N/A kmaw[dst] = (javax.net.ssl.KeyManager)kma[src];
0N/A dst++;
0N/A }
0N/A src++;
0N/A }
0N/A
0N/A /*
0N/A * If dst != src, there were more items in the original array
0N/A * than in the new array. Compress the new elements to avoid
0N/A * any problems down the road.
0N/A */
0N/A if (dst != src) {
0N/A kmaw = (javax.net.ssl.KeyManager [])
0N/A SSLSecurity.truncateArray(kmaw,
0N/A new javax.net.ssl.KeyManager [dst]);
0N/A }
0N/A } else {
0N/A kmaw = null;
0N/A }
0N/A
0N/A // Now do the same thing with the TrustManagers.
0N/A if (tma != null) {
0N/A tmaw = new javax.net.ssl.TrustManager[tma.length];
0N/A
0N/A for (src = 0, dst = 0; src < tma.length; ) {
0N/A /*
0N/A * These key managers may implement both...see above...
0N/A */
0N/A if (!(tma[src] instanceof javax.net.ssl.TrustManager)) {
0N/A // Do we know how to convert them?
0N/A if (tma[src] instanceof X509TrustManager) {
0N/A tmaw[dst] = (javax.net.ssl.TrustManager)
0N/A new X509TrustManagerJavaxWrapper(
0N/A (X509TrustManager)tma[src]);
0N/A dst++;
0N/A }
0N/A } else {
0N/A tmaw[dst] = (javax.net.ssl.TrustManager)tma[src];
0N/A dst++;
0N/A }
0N/A src++;
0N/A }
0N/A
0N/A if (dst != src) {
0N/A tmaw = (javax.net.ssl.TrustManager [])
0N/A SSLSecurity.truncateArray(tmaw,
0N/A new javax.net.ssl.TrustManager [dst]);
0N/A }
0N/A } else {
0N/A tmaw = null;
0N/A }
0N/A
0N/A theSSLContext.init(kmaw, tmaw, sr);
0N/A }
0N/A
0N/A protected javax.net.ssl.SSLSocketFactory
0N/A engineGetSocketFactory() {
0N/A return theSSLContext.getSocketFactory();
0N/A }
0N/A
0N/A protected javax.net.ssl.SSLServerSocketFactory
0N/A engineGetServerSocketFactory() {
0N/A return theSSLContext.getServerSocketFactory();
0N/A }
0N/A
0N/A}
0N/A
0N/Afinal class TrustManagerFactorySpiWrapper extends TrustManagerFactorySpi {
0N/A
0N/A private javax.net.ssl.TrustManagerFactory theTrustManagerFactory;
0N/A
0N/A TrustManagerFactorySpiWrapper(String algName, Provider prov) throws
0N/A NoSuchAlgorithmException {
0N/A theTrustManagerFactory =
0N/A javax.net.ssl.TrustManagerFactory.getInstance(algName, prov);
0N/A }
0N/A
0N/A protected void engineInit(KeyStore ks) throws KeyStoreException {
0N/A theTrustManagerFactory.init(ks);
0N/A }
0N/A
0N/A protected TrustManager[] engineGetTrustManagers() {
0N/A
0N/A int dst;
0N/A int src;
0N/A
0N/A javax.net.ssl.TrustManager[] tma =
0N/A theTrustManagerFactory.getTrustManagers();
0N/A
0N/A TrustManager[] tmaw = new TrustManager[tma.length];
0N/A
0N/A for (src = 0, dst = 0; src < tma.length; ) {
0N/A if (!(tma[src] instanceof com.sun.net.ssl.TrustManager)) {
0N/A // We only know how to wrap X509TrustManagers, as
0N/A // TrustManagers don't have any methods to wrap.
0N/A if (tma[src] instanceof javax.net.ssl.X509TrustManager) {
0N/A tmaw[dst] = (TrustManager)
0N/A new X509TrustManagerComSunWrapper(
0N/A (javax.net.ssl.X509TrustManager)tma[src]);
0N/A dst++;
0N/A }
0N/A } else {
0N/A tmaw[dst] = (TrustManager)tma[src];
0N/A dst++;
0N/A }
0N/A src++;
0N/A }
0N/A
0N/A if (dst != src) {
0N/A tmaw = (TrustManager [])
0N/A SSLSecurity.truncateArray(tmaw, new TrustManager [dst]);
0N/A }
0N/A
0N/A return tmaw;
0N/A }
0N/A
0N/A}
0N/A
0N/Afinal class KeyManagerFactorySpiWrapper extends KeyManagerFactorySpi {
0N/A
0N/A private javax.net.ssl.KeyManagerFactory theKeyManagerFactory;
0N/A
0N/A KeyManagerFactorySpiWrapper(String algName, Provider prov) throws
0N/A NoSuchAlgorithmException {
0N/A theKeyManagerFactory =
0N/A javax.net.ssl.KeyManagerFactory.getInstance(algName, prov);
0N/A }
0N/A
0N/A protected void engineInit(KeyStore ks, char[] password)
0N/A throws KeyStoreException, NoSuchAlgorithmException,
0N/A UnrecoverableKeyException {
0N/A theKeyManagerFactory.init(ks, password);
0N/A }
0N/A
0N/A protected KeyManager[] engineGetKeyManagers() {
0N/A
0N/A int dst;
0N/A int src;
0N/A
0N/A javax.net.ssl.KeyManager[] kma =
0N/A theKeyManagerFactory.getKeyManagers();
0N/A
0N/A KeyManager[] kmaw = new KeyManager[kma.length];
0N/A
0N/A for (src = 0, dst = 0; src < kma.length; ) {
0N/A if (!(kma[src] instanceof com.sun.net.ssl.KeyManager)) {
0N/A // We only know how to wrap X509KeyManagers, as
0N/A // KeyManagers don't have any methods to wrap.
0N/A if (kma[src] instanceof javax.net.ssl.X509KeyManager) {
0N/A kmaw[dst] = (KeyManager)
0N/A new X509KeyManagerComSunWrapper(
0N/A (javax.net.ssl.X509KeyManager)kma[src]);
0N/A dst++;
0N/A }
0N/A } else {
0N/A kmaw[dst] = (KeyManager)kma[src];
0N/A dst++;
0N/A }
0N/A src++;
0N/A }
0N/A
0N/A if (dst != src) {
0N/A kmaw = (KeyManager [])
0N/A SSLSecurity.truncateArray(kmaw, new KeyManager [dst]);
0N/A }
0N/A
0N/A return kmaw;
0N/A }
0N/A
0N/A}
0N/A
0N/A// =================================
0N/A
0N/Afinal class X509KeyManagerJavaxWrapper implements
0N/A javax.net.ssl.X509KeyManager {
0N/A
0N/A private X509KeyManager theX509KeyManager;
0N/A
0N/A X509KeyManagerJavaxWrapper(X509KeyManager obj) {
0N/A theX509KeyManager = obj;
0N/A }
0N/A
0N/A public String[] getClientAliases(String keyType, Principal[] issuers) {
0N/A return theX509KeyManager.getClientAliases(keyType, issuers);
0N/A }
0N/A
0N/A public String chooseClientAlias(String[] keyTypes, Principal[] issuers,
0N/A Socket socket) {
0N/A String retval;
0N/A
0N/A if (keyTypes == null) {
0N/A return null;
0N/A }
0N/A
0N/A /*
0N/A * Scan the list, look for something we can pass back.
0N/A */
0N/A for (int i = 0; i < keyTypes.length; i++) {
0N/A if ((retval = theX509KeyManager.chooseClientAlias(keyTypes[i],
0N/A issuers)) != null)
0N/A return retval;
0N/A }
0N/A return null;
0N/A
0N/A }
0N/A
0N/A /*
0N/A * JSSE 1.0.x was only socket based, but it's possible someone might
0N/A * want to install a really old provider. We should at least
0N/A * try to be nice.
0N/A */
0N/A public String chooseEngineClientAlias(
0N/A String[] keyTypes, Principal[] issuers,
0N/A javax.net.ssl.SSLEngine engine) {
0N/A String retval;
0N/A
0N/A if (keyTypes == null) {
0N/A return null;
0N/A }
0N/A
0N/A /*
0N/A * Scan the list, look for something we can pass back.
0N/A */
0N/A for (int i = 0; i < keyTypes.length; i++) {
0N/A if ((retval = theX509KeyManager.chooseClientAlias(keyTypes[i],
0N/A issuers)) != null)
0N/A return retval;
0N/A }
0N/A
0N/A return null;
0N/A }
0N/A
0N/A public String[] getServerAliases(String keyType, Principal[] issuers) {
0N/A return theX509KeyManager.getServerAliases(keyType, issuers);
0N/A }
0N/A
0N/A public String chooseServerAlias(String keyType, Principal[] issuers,
0N/A Socket socket) {
0N/A
0N/A if (keyType == null) {
0N/A return null;
0N/A }
0N/A return theX509KeyManager.chooseServerAlias(keyType, issuers);
0N/A }
0N/A
0N/A /*
0N/A * JSSE 1.0.x was only socket based, but it's possible someone might
0N/A * want to install a really old provider. We should at least
0N/A * try to be nice.
0N/A */
0N/A public String chooseEngineServerAlias(
0N/A String keyType, Principal[] issuers,
0N/A javax.net.ssl.SSLEngine engine) {
0N/A
0N/A if (keyType == null) {
0N/A return null;
0N/A }
0N/A return theX509KeyManager.chooseServerAlias(keyType, issuers);
0N/A }
0N/A
0N/A public java.security.cert.X509Certificate[]
0N/A getCertificateChain(String alias) {
0N/A return theX509KeyManager.getCertificateChain(alias);
0N/A }
0N/A
0N/A public PrivateKey getPrivateKey(String alias) {
0N/A return theX509KeyManager.getPrivateKey(alias);
0N/A }
0N/A}
0N/A
0N/Afinal class X509TrustManagerJavaxWrapper implements
0N/A javax.net.ssl.X509TrustManager {
0N/A
0N/A private X509TrustManager theX509TrustManager;
0N/A
0N/A X509TrustManagerJavaxWrapper(X509TrustManager obj) {
0N/A theX509TrustManager = obj;
0N/A }
0N/A
0N/A public void checkClientTrusted(
0N/A java.security.cert.X509Certificate[] chain, String authType)
0N/A throws java.security.cert.CertificateException {
0N/A if (!theX509TrustManager.isClientTrusted(chain)) {
0N/A throw new java.security.cert.CertificateException(
0N/A "Untrusted Client Certificate Chain");
0N/A }
0N/A }
0N/A
0N/A public void checkServerTrusted(
0N/A java.security.cert.X509Certificate[] chain, String authType)
0N/A throws java.security.cert.CertificateException {
0N/A if (!theX509TrustManager.isServerTrusted(chain)) {
0N/A throw new java.security.cert.CertificateException(
0N/A "Untrusted Server Certificate Chain");
0N/A }
0N/A }
0N/A
0N/A public java.security.cert.X509Certificate[] getAcceptedIssuers() {
0N/A return theX509TrustManager.getAcceptedIssuers();
0N/A }
0N/A}
0N/A
0N/Afinal class X509KeyManagerComSunWrapper implements X509KeyManager {
0N/A
0N/A private javax.net.ssl.X509KeyManager theX509KeyManager;
0N/A
0N/A X509KeyManagerComSunWrapper(javax.net.ssl.X509KeyManager obj) {
0N/A theX509KeyManager = obj;
0N/A }
0N/A
0N/A public String[] getClientAliases(String keyType, Principal[] issuers) {
0N/A return theX509KeyManager.getClientAliases(keyType, issuers);
0N/A }
0N/A
0N/A public String chooseClientAlias(String keyType, Principal[] issuers) {
0N/A String [] keyTypes = new String [] { keyType };
0N/A return theX509KeyManager.chooseClientAlias(keyTypes, issuers, null);
0N/A }
0N/A
0N/A public String[] getServerAliases(String keyType, Principal[] issuers) {
0N/A return theX509KeyManager.getServerAliases(keyType, issuers);
0N/A }
0N/A
0N/A public String chooseServerAlias(String keyType, Principal[] issuers) {
0N/A return theX509KeyManager.chooseServerAlias(keyType, issuers, null);
0N/A }
0N/A
0N/A public java.security.cert.X509Certificate[]
0N/A getCertificateChain(String alias) {
0N/A return theX509KeyManager.getCertificateChain(alias);
0N/A }
0N/A
0N/A public PrivateKey getPrivateKey(String alias) {
0N/A return theX509KeyManager.getPrivateKey(alias);
0N/A }
0N/A}
0N/A
0N/Afinal class X509TrustManagerComSunWrapper implements X509TrustManager {
0N/A
0N/A private javax.net.ssl.X509TrustManager theX509TrustManager;
0N/A
0N/A X509TrustManagerComSunWrapper(javax.net.ssl.X509TrustManager obj) {
0N/A theX509TrustManager = obj;
0N/A }
0N/A
0N/A public boolean isClientTrusted(
0N/A java.security.cert.X509Certificate[] chain) {
0N/A try {
0N/A theX509TrustManager.checkClientTrusted(chain, "UNKNOWN");
0N/A return true;
0N/A } catch (java.security.cert.CertificateException e) {
0N/A return false;
0N/A }
0N/A }
0N/A
0N/A public boolean isServerTrusted(
0N/A java.security.cert.X509Certificate[] chain) {
0N/A try {
0N/A theX509TrustManager.checkServerTrusted(chain, "UNKNOWN");
0N/A return true;
0N/A } catch (java.security.cert.CertificateException e) {
0N/A return false;
0N/A }
0N/A }
0N/A
0N/A public java.security.cert.X509Certificate[] getAcceptedIssuers() {
0N/A return theX509TrustManager.getAcceptedIssuers();
0N/A }
0N/A}