diff --git a/src/java.base/share/classes/com/sun/net/ssl/HostnameVerifier.java b/src/java.base/share/classes/com/sun/net/ssl/HostnameVerifier.java deleted file mode 100644 index f6413802395..00000000000 --- a/src/java.base/share/classes/com/sun/net/ssl/HostnameVerifier.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * NOTE: this file was copied from javax.net.ssl.HostnameVerifier - */ - -package com.sun.net.ssl; - -/** - * HostnameVerifier provides a callback mechanism so that - * implementers of this interface can supply a policy for - * handling the case where the host to connect to and - * the server name from the certificate mismatch. - * - * @deprecated As of JDK 1.4, this implementation-specific class was - * replaced by {@link javax.net.ssl.HostnameVerifier} and - * {@link javax.net.ssl.CertificateHostnameVerifier}. - */ -@Deprecated(since="1.4") -public interface HostnameVerifier { - /** - * Verify that the hostname from the URL is an acceptable - * match with the value from the common name entry in the - * server certificate's distinguished name. - * - * @param urlHostname the host name of the URL - * @param certHostname the common name entry from the certificate - * @return true if the certificate host name is acceptable - */ - public boolean verify(String urlHostname, String certHostname); -} diff --git a/src/java.base/share/classes/com/sun/net/ssl/HttpsURLConnection.java b/src/java.base/share/classes/com/sun/net/ssl/HttpsURLConnection.java deleted file mode 100644 index 8a1e69f9d5f..00000000000 --- a/src/java.base/share/classes/com/sun/net/ssl/HttpsURLConnection.java +++ /dev/null @@ -1,203 +0,0 @@ -/* - * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * NOTE: this file was copied from javax.net.ssl.HttpsURLConnection - */ - -package com.sun.net.ssl; - -import java.net.URL; -import java.net.HttpURLConnection; -import java.io.IOException; -import java.security.cert.Certificate; -import javax.net.SocketFactory; -import javax.net.ssl.SSLSocketFactory; -import javax.net.ssl.SSLPeerUnverifiedException; - -/** - * HTTP URL connection with support for HTTPS-specific features. See - * the spec for - * details. - * - * @deprecated As of JDK 1.4, this implementation-specific class was - * replaced by {@link javax.net.ssl.HttpsURLConnection}. - */ -@Deprecated(since="1.4") -public abstract -class HttpsURLConnection extends HttpURLConnection -{ - /* - * Initialize an HTTPS URLConnection ... could check that the URL - * is an "https" URL, and that the handler is also an HTTPS one, - * but that's established by other code in this package. - * @param url the URL - */ - public HttpsURLConnection(URL url) throws IOException { - super(url); - } - - /** - * Returns the cipher suite in use on this connection. - * @return the cipher suite - */ - public abstract String getCipherSuite(); - - /** - * Returns the server's X.509 certificate chain, or null if - * the server did not authenticate. - *
- * Note: The returned value may not be a valid certificate chain - * and should not be relied on for trust decisions. - * - * @return the server certificate chain - */ - public abstract Certificate[] getServerCertificates() - throws SSLPeerUnverifiedException; - - /** - * HostnameVerifier provides a callback mechanism so that - * implementers of this interface can supply a policy for - * handling the case where the host to connect to and - * the server name from the certificate mismatch. - * - * The default implementation will deny such connections. - */ - private static HostnameVerifier defaultHostnameVerifier = - new HostnameVerifier() { - public boolean verify(String urlHostname, String certHostname) { - return false; - } - }; - - protected HostnameVerifier hostnameVerifier = defaultHostnameVerifier; - - /** - * Sets the default HostnameVerifier inherited when an instance - * of this class is created. - * @param v the default host name verifier - */ - public static void setDefaultHostnameVerifier(HostnameVerifier v) { - if (v == null) { - throw new IllegalArgumentException( - "no default HostnameVerifier specified"); - } - - SecurityManager sm = System.getSecurityManager(); - if (sm != null) { - sm.checkPermission(new SSLPermission("setHostnameVerifier")); - } - defaultHostnameVerifier = v; - } - - /** - * Gets the default HostnameVerifier. - * @return the default host name verifier - */ - public static HostnameVerifier getDefaultHostnameVerifier() { - return defaultHostnameVerifier; - } - - /** - * Sets the HostnameVerifier. - * @param v the host name verifier - */ - public void setHostnameVerifier(HostnameVerifier v) { - if (v == null) { - throw new IllegalArgumentException( - "no HostnameVerifier specified"); - } - - hostnameVerifier = v; - } - - /** - * Gets the HostnameVerifier. - * @return the host name verifier - */ - public HostnameVerifier getHostnameVerifier() { - return hostnameVerifier; - } - - private static SSLSocketFactory defaultSSLSocketFactory = null; - - private SSLSocketFactory sslSocketFactory = getDefaultSSLSocketFactory(); - - /** - * Sets the default SSL socket factory inherited when an instance - * of this class is created. - * @param sf the default SSL socket factory - */ - public static void setDefaultSSLSocketFactory(SSLSocketFactory sf) { - if (sf == null) { - throw new IllegalArgumentException( - "no default SSLSocketFactory specified"); - } - - SecurityManager sm = System.getSecurityManager(); - if (sm != null) { - sm.checkSetFactory(); - } - defaultSSLSocketFactory = sf; - } - - /** - * Gets the default SSL socket factory. - * @return the default SSL socket factory - */ - public static SSLSocketFactory getDefaultSSLSocketFactory() { - if (defaultSSLSocketFactory == null) { - defaultSSLSocketFactory = - (SSLSocketFactory)SSLSocketFactory.getDefault(); - } - return defaultSSLSocketFactory; - } - - /** - * Sets the SSL socket factory. - * @param sf the SSL socket factory - */ - public void setSSLSocketFactory(SSLSocketFactory sf) { - if (sf == null) { - throw new IllegalArgumentException( - "no SSLSocketFactory specified"); - } - - SecurityManager sm = System.getSecurityManager(); - if (sm != null) { - sm.checkSetFactory(); - } - - sslSocketFactory = sf; - } - - /** - * Gets the SSL socket factory. - * @return the SSL socket factory - */ - public SSLSocketFactory getSSLSocketFactory() { - return sslSocketFactory; - } -} diff --git a/src/java.base/share/classes/com/sun/net/ssl/KeyManager.java b/src/java.base/share/classes/com/sun/net/ssl/KeyManager.java deleted file mode 100644 index 903e2578e79..00000000000 --- a/src/java.base/share/classes/com/sun/net/ssl/KeyManager.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * NOTE: this file was copied from javax.net.ssl.KeyManager - */ - -package com.sun.net.ssl; - -/** - * Base interface for JSSE key managers. These manage the - * key material which is used to authenticate to the peer - * of a secure socket. - * - * @deprecated As of JDK 1.4, this implementation-specific class was - * replaced by {@link javax.net.ssl.KeyManager}. - */ -@Deprecated(since="1.4") -public interface KeyManager { -} diff --git a/src/java.base/share/classes/com/sun/net/ssl/KeyManagerFactory.java b/src/java.base/share/classes/com/sun/net/ssl/KeyManagerFactory.java deleted file mode 100644 index 2142dd50ebb..00000000000 --- a/src/java.base/share/classes/com/sun/net/ssl/KeyManagerFactory.java +++ /dev/null @@ -1,220 +0,0 @@ -/* - * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * NOTE: this file was copied from javax.net.ssl.KeyManagerFactory - */ - -package com.sun.net.ssl; - -import java.security.*; - -/** - * This class acts as a factory for key managers based on a - * source of key material. Each key manager manages a specific - * type of key material for use by secure sockets. The key - * material is based on a KeyStore and/or provider specific sources. - * - * @deprecated As of JDK 1.4, this implementation-specific class was - * replaced by {@link javax.net.ssl.KeyManagerFactory}. - */ -@Deprecated(since="1.4") -public class KeyManagerFactory { - // The provider - private Provider provider; - - // The provider implementation (delegate) - private KeyManagerFactorySpi factorySpi; - - // The name of the key management algorithm. - private String algorithm; - - /** - *
The default KeyManager can be changed by setting the value of the
- * {@code sun.ssl.keymanager.type} security property to the desired name.
- *
- * @return the default type as specified by the
- * {@code sun.ssl.keymanager.type} security property, or an
- * implementation-specific default if no such property exists.
- *
- * @see java.security.Security security properties
- */
- public static final String getDefaultAlgorithm() {
- String type;
- type = AccessController.doPrivileged(new PrivilegedAction<>() {
- public String run() {
- return Security.getProperty("sun.ssl.keymanager.type");
- }
- });
- if (type == null) {
- type = "SunX509";
- }
- return type;
-
- }
-
- /**
- * Creates a KeyManagerFactory object.
- *
- * @param factorySpi the delegate
- * @param provider the provider
- * @param algorithm the algorithm
- */
- protected KeyManagerFactory(KeyManagerFactorySpi factorySpi,
- Provider provider, String algorithm) {
- this.factorySpi = factorySpi;
- this.provider = provider;
- this.algorithm = algorithm;
- }
-
- /**
- * Returns the algorithm name of this KeyManagerFactory object.
- *
- *
This is the same name that was specified in one of the
- * getInstance calls that created this
- * KeyManagerFactory object.
- *
- * @return the algorithm name of this KeyManagerFactory object.
- */
- public final String getAlgorithm() {
- return this.algorithm;
- }
-
- /**
- * Generates a KeyManagerFactory object that implements the
- * specified key management algorithm.
- * If the default provider package provides an implementation of the
- * requested key management algorithm, an instance of
- * KeyManagerFactory containing that implementation is
- * returned. If the algorithm is not available in the default provider
- * package, other provider packages are searched.
- *
- * @param algorithm the standard name of the requested
- * algorithm.
- *
- * @return the new KeyManagerFactory object
- *
- * @exception NoSuchAlgorithmException if the specified algorithm is not
- * available in the default provider package or any of the other provider
- * packages that were searched.
- */
- public static final KeyManagerFactory getInstance(String algorithm)
- throws NoSuchAlgorithmException
- {
- try {
- Object[] objs = SSLSecurity.getImpl(algorithm, "KeyManagerFactory",
- (String) null);
- return new KeyManagerFactory((KeyManagerFactorySpi)objs[0],
- (Provider)objs[1],
- algorithm);
- } catch (NoSuchProviderException e) {
- throw new NoSuchAlgorithmException(algorithm + " not found");
- }
- }
-
- /**
- * Generates a KeyManagerFactory object for the specified
- * key management algorithm from the specified provider.
- *
- * @param algorithm the standard name of the requested
- * algorithm.
- * @param provider the name of the provider
- *
- * @return the new KeyManagerFactory object
- *
- * @exception NoSuchAlgorithmException if the specified algorithm is not
- * available from the specified provider.
- * @exception NoSuchProviderException if the specified provider has not
- * been configured.
- */
- public static final KeyManagerFactory getInstance(String algorithm,
- String provider)
- throws NoSuchAlgorithmException, NoSuchProviderException
- {
- if (provider == null || provider.isEmpty())
- throw new IllegalArgumentException("missing provider");
- Object[] objs = SSLSecurity.getImpl(algorithm, "KeyManagerFactory",
- provider);
- return new KeyManagerFactory((KeyManagerFactorySpi)objs[0],
- (Provider)objs[1], algorithm);
- }
-
- /**
- * Generates a KeyManagerFactory object for the specified
- * key management algorithm from the specified provider.
- *
- * @param algorithm the standard name of the requested
- * algorithm.
- * @param provider an instance of the provider
- *
- * @return the new KeyManagerFactory object
- *
- * @exception NoSuchAlgorithmException if the specified algorithm is not
- * available from the specified provider.
- */
- public static final KeyManagerFactory getInstance(String algorithm,
- Provider provider)
- throws NoSuchAlgorithmException
- {
- if (provider == null)
- throw new IllegalArgumentException("missing provider");
- Object[] objs = SSLSecurity.getImpl(algorithm, "KeyManagerFactory",
- provider);
- return new KeyManagerFactory((KeyManagerFactorySpi)objs[0],
- (Provider)objs[1], algorithm);
- }
-
- /**
- * Returns the provider of this KeyManagerFactory object.
- *
- * @return the provider of this KeyManagerFactory object
- */
- public final Provider getProvider() {
- return this.provider;
- }
-
-
- /**
- * Initializes this factory with a source of key material. The
- * provider may also include a provider-specific source
- * of key material.
- *
- * @param ks the key store or null
- * @param password the password for recovering keys
- */
- public void init(KeyStore ks, char[] password)
- throws KeyStoreException, NoSuchAlgorithmException,
- UnrecoverableKeyException {
- factorySpi.engineInit(ks, password);
- }
-
- /**
- * Returns one key manager for each type of key material.
- * @return the key managers
- */
- public KeyManager[] getKeyManagers() {
- return factorySpi.engineGetKeyManagers();
- }
-}
diff --git a/src/java.base/share/classes/com/sun/net/ssl/KeyManagerFactorySpi.java b/src/java.base/share/classes/com/sun/net/ssl/KeyManagerFactorySpi.java
deleted file mode 100644
index eb72c96954d..00000000000
--- a/src/java.base/share/classes/com/sun/net/ssl/KeyManagerFactorySpi.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * NOTE: this file was copied from javax.net.ssl.KeyManagerFactorySpi
- */
-
-package com.sun.net.ssl;
-
-import java.security.*;
-
-/**
- * This class defines the Service Provider Interface (SPI)
- * for the KeyManagerFactory class.
- *
- *
All the abstract methods in this class must be implemented by each
- * cryptographic service provider who wishes to supply the implementation
- * of a particular key manager factory.
- *
- * @deprecated As of JDK 1.4, this implementation-specific class was
- * replaced by {@link javax.net.ssl.KeyManagerFactorySpi}.
- */
-@Deprecated(since="1.4")
-public abstract class KeyManagerFactorySpi {
- /**
- * Initializes this factory with a source of key material. The
- * provider may also include a provider-specific source
- * of key material.
- *
- * @param ks the key store or null
- * @param password the password for recovering keys
- */
- protected abstract void engineInit(KeyStore ks, char[] password)
- throws KeyStoreException, NoSuchAlgorithmException,
- UnrecoverableKeyException;
-
- /**
- * Returns one trust manager for each type of trust material.
- * @return the key managers
- */
- protected abstract KeyManager[] engineGetKeyManagers();
-}
diff --git a/src/java.base/share/classes/com/sun/net/ssl/SSLContext.java b/src/java.base/share/classes/com/sun/net/ssl/SSLContext.java
deleted file mode 100644
index 84cc2d1182a..00000000000
--- a/src/java.base/share/classes/com/sun/net/ssl/SSLContext.java
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * NOTE: this file was copied from javax.net.ssl.SSLContext
- */
-
-package com.sun.net.ssl;
-
-import java.security.*;
-import java.util.*;
-import javax.net.ssl.*;
-
-import sun.security.ssl.SSLSocketFactoryImpl;
-import sun.security.ssl.SSLServerSocketFactoryImpl;
-
-/**
- * Instances of this class represent a secure socket protocol
- * implementation which acts as a factory for secure socket
- * factories. This class is initialized with an optional set of
- * key and trust managers and source of secure random bytes.
- *
- * @deprecated As of JDK 1.4, this implementation-specific class was
- * replaced by {@link javax.net.ssl.SSLContext}.
- */
-@Deprecated(since="1.4")
-public class SSLContext {
- private Provider provider;
-
- private SSLContextSpi contextSpi;
-
- private String protocol;
-
- /**
- * Creates an SSLContext object.
- *
- * @param contextSpi the delegate
- * @param provider the provider
- * @param protocol the protocol
- */
- protected SSLContext(SSLContextSpi contextSpi, Provider provider,
- String protocol) {
- this.contextSpi = contextSpi;
- this.provider = provider;
- this.protocol = protocol;
- }
-
- /**
- * Generates a SSLContext object that implements the
- * specified secure socket protocol.
- *
- * @param protocol the standard name of the requested protocol.
- *
- * @return the new SSLContext object
- *
- * @exception NoSuchAlgorithmException if the specified protocol is not
- * available in the default provider package or any of the other provider
- * packages that were searched.
- */
- public static SSLContext getInstance(String protocol)
- throws NoSuchAlgorithmException
- {
- try {
- Object[] objs = SSLSecurity.getImpl(protocol, "SSLContext",
- (String) null);
- return new SSLContext((SSLContextSpi)objs[0], (Provider)objs[1],
- protocol);
- } catch (NoSuchProviderException e) {
- throw new NoSuchAlgorithmException(protocol + " not found");
- }
- }
-
- /**
- * Generates a SSLContext object that implements the
- * specified secure socket protocol.
- *
- * @param protocol the standard name of the requested protocol.
- * @param provider the name of the provider
- *
- * @return the new SSLContext object
- *
- * @exception NoSuchAlgorithmException if the specified protocol is not
- * available from the specified provider.
- * @exception NoSuchProviderException if the specified provider has not
- * been configured.
- */
- public static SSLContext getInstance(String protocol, String provider)
- throws NoSuchAlgorithmException, NoSuchProviderException
- {
- if (provider == null || provider.isEmpty())
- throw new IllegalArgumentException("missing provider");
- Object[] objs = SSLSecurity.getImpl(protocol, "SSLContext",
- provider);
- return new SSLContext((SSLContextSpi)objs[0], (Provider)objs[1],
- protocol);
- }
-
- /**
- * Generates a SSLContext object that implements the
- * specified secure socket protocol.
- *
- * @param protocol the standard name of the requested protocol.
- * @param provider an instance of the provider
- *
- * @return the new SSLContext object
- *
- * @exception NoSuchAlgorithmException if the specified protocol is not
- * available from the specified provider.
- */
- public static SSLContext getInstance(String protocol, Provider provider)
- throws NoSuchAlgorithmException
- {
- if (provider == null)
- throw new IllegalArgumentException("missing provider");
- Object[] objs = SSLSecurity.getImpl(protocol, "SSLContext",
- provider);
- return new SSLContext((SSLContextSpi)objs[0], (Provider)objs[1],
- protocol);
- }
-
- /**
- * Returns the protocol name of this SSLContext object.
- *
- *
This is the same name that was specified in one of the
- * getInstance calls that created this
- * SSLContext object.
- *
- * @return the protocol name of this SSLContext object.
- */
- public final String getProtocol() {
- return this.protocol;
- }
-
- /**
- * Returns the provider of this SSLContext object.
- *
- * @return the provider of this SSLContext object
- */
- public final Provider getProvider() {
- return this.provider;
- }
-
- /**
- * Initializes this context. Either of the first two parameters
- * may be null in which case the installed security providers will
- * be searched for the highest priority implementation of the
- * appropriate factory. Likewise, the secure random parameter may
- * be null in which case the default implementation will be used.
- *
- * @param km the sources of authentication keys or null
- * @param tm the sources of peer authentication trust decisions or null
- * @param random the source of randomness for this generator or null
- */
- public final void init(KeyManager[] km, TrustManager[] tm,
- SecureRandom random)
- throws KeyManagementException {
- contextSpi.engineInit(km, tm, random);
- }
-
- /**
- * Returns a SocketFactory object for this
- * context.
- *
- * @return the factory
- */
- public final SSLSocketFactory getSocketFactory() {
- return contextSpi.engineGetSocketFactory();
- }
-
- /**
- * Returns a ServerSocketFactory object for
- * this context.
- *
- * @return the factory
- */
- public final SSLServerSocketFactory getServerSocketFactory() {
- return contextSpi.engineGetServerSocketFactory();
- }
-}
diff --git a/src/java.base/share/classes/com/sun/net/ssl/SSLContextSpi.java b/src/java.base/share/classes/com/sun/net/ssl/SSLContextSpi.java
deleted file mode 100644
index 993f86f614d..00000000000
--- a/src/java.base/share/classes/com/sun/net/ssl/SSLContextSpi.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * NOTE: this file was copied from javax.net.ssl.SSLContextSpi
- */
-
-package com.sun.net.ssl;
-
-import java.util.*;
-import java.security.*;
-import javax.net.ssl.*;
-
-/**
- * This class defines the Service Provider Interface (SPI)
- * for the SSLContext class.
- *
- *
All the abstract methods in this class must be implemented by each
- * cryptographic service provider who wishes to supply the implementation
- * of a particular SSL context.
- *
- * @deprecated As of JDK 1.4, this implementation-specific class was
- * replaced by {@link javax.net.ssl.SSLContextSpi}.
- */
-@Deprecated(since="1.4")
-public abstract class SSLContextSpi {
- /**
- * Initializes this context.
- *
- * @param ah the sources of authentication keys
- * @param th the sources of peer authentication trust decisions
- * @param sr the source of randomness for this generator
- */
- protected abstract void engineInit(KeyManager[] ah, TrustManager[] th,
- SecureRandom sr) throws KeyManagementException;
-
- /**
- * Returns a SocketFactory object for this
- * context.
- *
- * @return the factory
- */
- protected abstract SSLSocketFactory engineGetSocketFactory();
-
- /**
- * Returns a ServerSocketFactory object for
- * this context.
- *
- * @return the factory
- */
- protected abstract SSLServerSocketFactory engineGetServerSocketFactory();
-}
diff --git a/src/java.base/share/classes/com/sun/net/ssl/SSLPermission.java b/src/java.base/share/classes/com/sun/net/ssl/SSLPermission.java
deleted file mode 100644
index 93469a0c867..00000000000
--- a/src/java.base/share/classes/com/sun/net/ssl/SSLPermission.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * NOTE: this file was copied from javax.net.ssl.SSLPermission
- */
-
-package com.sun.net.ssl;
-
-import java.security.*;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.StringTokenizer;
-import java.security.Permissions;
-import java.lang.SecurityManager;
-
-/**
- * This class is for various network permissions.
- * An SSLPermission contains a name (also referred to as a "target name") but
- * no actions list; you either have the named permission
- * or you don't.
- *
- * The target name is the name of the network permission (see below). The naming - * convention follows the hierarchical property naming convention. - * Also, an asterisk - * may appear at the end of the name, following a ".", or by itself, to - * signify a wildcard match. For example: "foo.*" and "*" signify a wildcard - * match, while "*foo" and "a*b" do not. - *
- * The following table lists all the possible SSLPermission target names, - * and for each provides a description of what the permission allows - * and a discussion of the risks of granting code the permission. - * - *
| Permission Target Name | - *What the Permission Allows | - *Risks of Allowing this Permission | - *
|---|---|---|
| setHostnameVerifier | - *The ability to set a callback which can decide whether to - * allow a mismatch between the host being connected to by - * an HttpsURLConnection and the common name field in - * server certificate. - * | - *Malicious - * code can set a verifier that monitors host names visited by - * HttpsURLConnection requests or that allows server certificates - * with invalid common names. - * | - *
| getSSLSessionContext | - *The ability to get the SSLSessionContext of an SSLSession. - * | - *Malicious code may monitor sessions which have been established - * with SSL peers or might invalidate sessions to slow down performance. - * | - *
Policy object
- * to instantiate new Permission objects.
- *
- * @param name the name of the SSLPermission.
- * @param actions should be null.
- */
-
- public SSLPermission(String name, String actions)
- {
- super(name, actions);
- }
-}
diff --git a/src/java.base/share/classes/com/sun/net/ssl/SSLSecurity.java b/src/java.base/share/classes/com/sun/net/ssl/SSLSecurity.java
deleted file mode 100644
index 664b53e0489..00000000000
--- a/src/java.base/share/classes/com/sun/net/ssl/SSLSecurity.java
+++ /dev/null
@@ -1,699 +0,0 @@
-/*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * NOTE: this file was copied from javax.net.ssl.SSLSecurity,
- * but was heavily modified to allow com.sun.* users to
- * access providers written using the javax.sun.* APIs.
- */
-
-package com.sun.net.ssl;
-
-import java.util.*;
-import java.io.*;
-import java.security.*;
-import java.security.Provider.Service;
-import java.net.Socket;
-
-import sun.security.jca.*;
-
-/**
- * This class instantiates implementations of JSSE engine classes from
- * providers registered with the java.security.Security object.
- *
- * @author Jan Luehe
- * @author Jeff Nisewanger
- * @author Brad Wetmore
- */
-
-final class SSLSecurity {
-
- /*
- * Don't let anyone instantiate this.
- */
- private SSLSecurity() {
- }
-
-
- // ProviderList.getService() is not accessible now, implement our own loop
- private static Service getService(String type, String alg) {
- ProviderList list = Providers.getProviderList();
- for (Provider p : list.providers()) {
- Service s = p.getService(type, alg);
- if (s != null) {
- return s;
- }
- }
- return null;
- }
-
- /**
- * The body of the driver for the getImpl method.
- */
- private static Object[] getImpl1(String algName, String engineType,
- Service service) throws NoSuchAlgorithmException
- {
- Provider provider = service.getProvider();
- String className = service.getClassName();
- Class> implClass;
- try {
- ClassLoader cl = provider.getClass().getClassLoader();
- if (cl == null) {
- // system class
- implClass = Class.forName(className);
- } else {
- implClass = cl.loadClass(className);
- }
- } catch (ClassNotFoundException e) {
- throw new NoSuchAlgorithmException("Class " + className +
- " configured for " +
- engineType +
- " not found: " +
- e.getMessage());
- } catch (SecurityException e) {
- throw new NoSuchAlgorithmException("Class " + className +
- " configured for " +
- engineType +
- " cannot be accessed: " +
- e.getMessage());
- }
-
- /*
- * JSSE 1.0, 1.0.1, and 1.0.2 used the com.sun.net.ssl API as the
- * API was being developed. As JSSE was folded into the main
- * release, it was decided to promote the com.sun.net.ssl API to
- * be javax.net.ssl. It is desired to keep binary compatibility
- * with vendors of JSSE implementation written using the
- * com.sun.net.sll API, so we do this magic to handle everything.
- *
- * API used Implementation used Supported?
- * ======== =================== ==========
- * com.sun javax Yes
- * com.sun com.sun Yes
- * javax javax Yes
- * javax com.sun Not Currently
- *
- * Make sure the implementation class is a subclass of the
- * corresponding engine class.
- *
- * In wrapping these classes, there's no way to know how to
- * wrap all possible classes that extend the TrustManager/KeyManager.
- * We only wrap the x509 variants.
- */
-
- try { // catch instantiation errors
-
- /*
- * (The following Class.forName()s should alway work, because
- * this class and all the SPI classes in javax.crypto are
- * loaded by the same class loader.) That is, unless they
- * give us a SPI class that doesn't exist, say SSLFoo,
- * or someone has removed classes from the java.base module.
- */
-
- Class> typeClassJavax;
- Class> typeClassCom;
- Object obj = null;
-
- /*
- * Odds are more likely that we have a javax variant, try this
- * first.
- */
- if (((typeClassJavax = Class.forName("javax.net.ssl." +
- engineType + "Spi")) != null) &&
- (checkSuperclass(implClass, typeClassJavax))) {
-
- if (engineType.equals("SSLContext")) {
- obj = new SSLContextSpiWrapper(algName, provider);
- } else if (engineType.equals("TrustManagerFactory")) {
- obj = new TrustManagerFactorySpiWrapper(algName, provider);
- } else if (engineType.equals("KeyManagerFactory")) {
- obj = new KeyManagerFactorySpiWrapper(algName, provider);
- } else {
- /*
- * We should throw an error if we get
- * something totally unexpected. Don't ever
- * expect to see this one...
- */
- throw new IllegalStateException(
- "Class " + implClass.getName() +
- " unknown engineType wrapper:" + engineType);
- }
-
- } else if (((typeClassCom = Class.forName("com.sun.net.ssl." +
- engineType + "Spi")) != null) &&
- (checkSuperclass(implClass, typeClassCom))) {
- obj = service.newInstance(null);
- }
-
- if (obj != null) {
- return new Object[] { obj, provider };
- } else {
- throw new NoSuchAlgorithmException(
- "Couldn't locate correct object or wrapper: " +
- engineType + " " + algName);
- }
-
- } catch (ClassNotFoundException e) {
- IllegalStateException exc = new IllegalStateException(
- "Engine Class Not Found for " + engineType);
- exc.initCause(e);
- throw exc;
- }
- }
-
- /**
- * Returns an array of objects: the first object in the array is
- * an instance of an implementation of the requested algorithm
- * and type, and the second object in the array identifies the provider
- * of that implementation.
- * The provName argument can be null, in which case all
- * configured providers will be searched in order of preference.
- */
- static Object[] getImpl(String algName, String engineType, String provName)
- throws NoSuchAlgorithmException, NoSuchProviderException
- {
- Service service;
- if (provName != null) {
- ProviderList list = Providers.getProviderList();
- Provider prov = list.getProvider(provName);
- if (prov == null) {
- throw new NoSuchProviderException("No such provider: " +
- provName);
- }
- service = prov.getService(engineType, algName);
- } else {
- service = getService(engineType, algName);
- }
- if (service == null) {
- throw new NoSuchAlgorithmException("Algorithm " + algName
- + " not available");
- }
- return getImpl1(algName, engineType, service);
- }
-
-
- /**
- * Returns an array of objects: the first object in the array is
- * an instance of an implementation of the requested algorithm
- * and type, and the second object in the array identifies the provider
- * of that implementation.
- * The prov argument can be null, in which case all
- * configured providers will be searched in order of preference.
- */
- static Object[] getImpl(String algName, String engineType, Provider prov)
- throws NoSuchAlgorithmException
- {
- Service service = prov.getService(engineType, algName);
- if (service == null) {
- throw new NoSuchAlgorithmException("No such algorithm: " +
- algName);
- }
- return getImpl1(algName, engineType, service);
- }
-
- /*
- * Checks whether one class is the superclass of another
- */
- private static boolean checkSuperclass(Class> subclass, Class> superclass) {
- if ((subclass == null) || (superclass == null))
- return false;
-
- while (!subclass.equals(superclass)) {
- subclass = subclass.getSuperclass();
- if (subclass == null) {
- return false;
- }
- }
- return true;
- }
-
- /*
- * Return at most the first "resize" elements of an array.
- *
- * Didn't want to use java.util.Arrays, as PJava may not have it.
- */
- static Object[] truncateArray(Object[] oldArray, Object[] newArray) {
-
- for (int i = 0; i < newArray.length; i++) {
- newArray[i] = oldArray[i];
- }
-
- return newArray;
- }
-
-}
-
-
-/*
- * =================================================================
- * The remainder of this file is for the wrapper and wrapper-support
- * classes. When SSLSecurity finds something which extends the
- * javax.net.ssl.*Spi, we need to go grab a real instance of the
- * thing that the Spi supports, and wrap into a com.sun.net.ssl.*Spi
- * object. This also mean that anything going down into the SPI
- * needs to be wrapped, as well as anything coming back up.
- */
-@SuppressWarnings("deprecation")
-final class SSLContextSpiWrapper extends SSLContextSpi {
-
- private javax.net.ssl.SSLContext theSSLContext;
-
- SSLContextSpiWrapper(String algName, Provider prov) throws
- NoSuchAlgorithmException {
- theSSLContext = javax.net.ssl.SSLContext.getInstance(algName, prov);
- }
-
- @SuppressWarnings("deprecation")
- protected void engineInit(KeyManager[] kma, TrustManager[] tma,
- SecureRandom sr) throws KeyManagementException {
-
- // Keep track of the actual number of array elements copied
- int dst;
- int src;
- javax.net.ssl.KeyManager[] kmaw;
- javax.net.ssl.TrustManager[] tmaw;
-
- // Convert com.sun.net.ssl.kma to a javax.net.ssl.kma
- // wrapper if need be.
- if (kma != null) {
- kmaw = new javax.net.ssl.KeyManager[kma.length];
- for (src = 0, dst = 0; src < kma.length; ) {
- /*
- * These key managers may implement both javax
- * and com.sun interfaces, so if they do
- * javax, there's no need to wrap them.
- */
- if (!(kma[src] instanceof javax.net.ssl.KeyManager)) {
- /*
- * Do we know how to convert them? If not, oh well...
- * We'll have to drop them on the floor in this
- * case, cause we don't know how to handle them.
- * This will be pretty rare, but put here for
- * completeness.
- */
- if (kma[src] instanceof X509KeyManager) {
- kmaw[dst] = (javax.net.ssl.KeyManager)
- new X509KeyManagerJavaxWrapper(
- (X509KeyManager)kma[src]);
- dst++;
- }
- } else {
- // We can convert directly, since they implement.
- kmaw[dst] = (javax.net.ssl.KeyManager)kma[src];
- dst++;
- }
- src++;
- }
-
- /*
- * If dst != src, there were more items in the original array
- * than in the new array. Compress the new elements to avoid
- * any problems down the road.
- */
- if (dst != src) {
- kmaw = (javax.net.ssl.KeyManager [])
- SSLSecurity.truncateArray(kmaw,
- new javax.net.ssl.KeyManager [dst]);
- }
- } else {
- kmaw = null;
- }
-
- // Now do the same thing with the TrustManagers.
- if (tma != null) {
- tmaw = new javax.net.ssl.TrustManager[tma.length];
-
- for (src = 0, dst = 0; src < tma.length; ) {
- /*
- * These key managers may implement both...see above...
- */
- if (!(tma[src] instanceof javax.net.ssl.TrustManager)) {
- // Do we know how to convert them?
- if (tma[src] instanceof X509TrustManager) {
- tmaw[dst] = (javax.net.ssl.TrustManager)
- new X509TrustManagerJavaxWrapper(
- (X509TrustManager)tma[src]);
- dst++;
- }
- } else {
- tmaw[dst] = (javax.net.ssl.TrustManager)tma[src];
- dst++;
- }
- src++;
- }
-
- if (dst != src) {
- tmaw = (javax.net.ssl.TrustManager [])
- SSLSecurity.truncateArray(tmaw,
- new javax.net.ssl.TrustManager [dst]);
- }
- } else {
- tmaw = null;
- }
-
- theSSLContext.init(kmaw, tmaw, sr);
- }
-
- protected javax.net.ssl.SSLSocketFactory
- engineGetSocketFactory() {
- return theSSLContext.getSocketFactory();
- }
-
- protected javax.net.ssl.SSLServerSocketFactory
- engineGetServerSocketFactory() {
- return theSSLContext.getServerSocketFactory();
- }
-
-}
-
-@SuppressWarnings("deprecation")
-final class TrustManagerFactorySpiWrapper extends TrustManagerFactorySpi {
-
- private javax.net.ssl.TrustManagerFactory theTrustManagerFactory;
-
- TrustManagerFactorySpiWrapper(String algName, Provider prov) throws
- NoSuchAlgorithmException {
- theTrustManagerFactory =
- javax.net.ssl.TrustManagerFactory.getInstance(algName, prov);
- }
-
- protected void engineInit(KeyStore ks) throws KeyStoreException {
- theTrustManagerFactory.init(ks);
- }
-
- protected TrustManager[] engineGetTrustManagers() {
-
- int dst;
- int src;
-
- javax.net.ssl.TrustManager[] tma =
- theTrustManagerFactory.getTrustManagers();
-
- TrustManager[] tmaw = new TrustManager[tma.length];
-
- for (src = 0, dst = 0; src < tma.length; ) {
- if (!(tma[src] instanceof com.sun.net.ssl.TrustManager)) {
- // We only know how to wrap X509TrustManagers, as
- // TrustManagers don't have any methods to wrap.
- if (tma[src] instanceof javax.net.ssl.X509TrustManager) {
- tmaw[dst] = (TrustManager)
- new X509TrustManagerComSunWrapper(
- (javax.net.ssl.X509TrustManager)tma[src]);
- dst++;
- }
- } else {
- tmaw[dst] = (TrustManager)tma[src];
- dst++;
- }
- src++;
- }
-
- if (dst != src) {
- tmaw = (TrustManager [])
- SSLSecurity.truncateArray(tmaw, new TrustManager [dst]);
- }
-
- return tmaw;
- }
-
-}
-
-@SuppressWarnings("deprecation")
-final class KeyManagerFactorySpiWrapper extends KeyManagerFactorySpi {
-
- private javax.net.ssl.KeyManagerFactory theKeyManagerFactory;
-
- KeyManagerFactorySpiWrapper(String algName, Provider prov) throws
- NoSuchAlgorithmException {
- theKeyManagerFactory =
- javax.net.ssl.KeyManagerFactory.getInstance(algName, prov);
- }
-
- protected void engineInit(KeyStore ks, char[] password)
- throws KeyStoreException, NoSuchAlgorithmException,
- UnrecoverableKeyException {
- theKeyManagerFactory.init(ks, password);
- }
-
- protected KeyManager[] engineGetKeyManagers() {
-
- int dst;
- int src;
-
- javax.net.ssl.KeyManager[] kma =
- theKeyManagerFactory.getKeyManagers();
-
- KeyManager[] kmaw = new KeyManager[kma.length];
-
- for (src = 0, dst = 0; src < kma.length; ) {
- if (!(kma[src] instanceof com.sun.net.ssl.KeyManager)) {
- // We only know how to wrap X509KeyManagers, as
- // KeyManagers don't have any methods to wrap.
- if (kma[src] instanceof javax.net.ssl.X509KeyManager) {
- kmaw[dst] = (KeyManager)
- new X509KeyManagerComSunWrapper(
- (javax.net.ssl.X509KeyManager)kma[src]);
- dst++;
- }
- } else {
- kmaw[dst] = (KeyManager)kma[src];
- dst++;
- }
- src++;
- }
-
- if (dst != src) {
- kmaw = (KeyManager [])
- SSLSecurity.truncateArray(kmaw, new KeyManager [dst]);
- }
-
- return kmaw;
- }
-
-}
-
-// =================================
-
-@SuppressWarnings("deprecation")
-final class X509KeyManagerJavaxWrapper implements
- javax.net.ssl.X509KeyManager {
-
- private X509KeyManager theX509KeyManager;
-
- X509KeyManagerJavaxWrapper(X509KeyManager obj) {
- theX509KeyManager = obj;
- }
-
- public String[] getClientAliases(String keyType, Principal[] issuers) {
- return theX509KeyManager.getClientAliases(keyType, issuers);
- }
-
- public String chooseClientAlias(String[] keyTypes, Principal[] issuers,
- Socket socket) {
- String retval;
-
- if (keyTypes == null) {
- return null;
- }
-
- /*
- * Scan the list, look for something we can pass back.
- */
- for (int i = 0; i < keyTypes.length; i++) {
- if ((retval = theX509KeyManager.chooseClientAlias(keyTypes[i],
- issuers)) != null)
- return retval;
- }
- return null;
-
- }
-
- /*
- * JSSE 1.0.x was only socket based, but it's possible someone might
- * want to install a really old provider. We should at least
- * try to be nice.
- */
- public String chooseEngineClientAlias(
- String[] keyTypes, Principal[] issuers,
- javax.net.ssl.SSLEngine engine) {
- String retval;
-
- if (keyTypes == null) {
- return null;
- }
-
- /*
- * Scan the list, look for something we can pass back.
- */
- for (int i = 0; i < keyTypes.length; i++) {
- if ((retval = theX509KeyManager.chooseClientAlias(keyTypes[i],
- issuers)) != null)
- return retval;
- }
-
- return null;
- }
-
- public String[] getServerAliases(String keyType, Principal[] issuers) {
- return theX509KeyManager.getServerAliases(keyType, issuers);
- }
-
- public String chooseServerAlias(String keyType, Principal[] issuers,
- Socket socket) {
-
- if (keyType == null) {
- return null;
- }
- return theX509KeyManager.chooseServerAlias(keyType, issuers);
- }
-
- /*
- * JSSE 1.0.x was only socket based, but it's possible someone might
- * want to install a really old provider. We should at least
- * try to be nice.
- */
- public String chooseEngineServerAlias(
- String keyType, Principal[] issuers,
- javax.net.ssl.SSLEngine engine) {
-
- if (keyType == null) {
- return null;
- }
- return theX509KeyManager.chooseServerAlias(keyType, issuers);
- }
-
- public java.security.cert.X509Certificate[]
- getCertificateChain(String alias) {
- return theX509KeyManager.getCertificateChain(alias);
- }
-
- public PrivateKey getPrivateKey(String alias) {
- return theX509KeyManager.getPrivateKey(alias);
- }
-}
-
-@SuppressWarnings("deprecation")
-final class X509TrustManagerJavaxWrapper implements
- javax.net.ssl.X509TrustManager {
-
- private X509TrustManager theX509TrustManager;
-
- X509TrustManagerJavaxWrapper(X509TrustManager obj) {
- theX509TrustManager = obj;
- }
-
- public void checkClientTrusted(
- java.security.cert.X509Certificate[] chain, String authType)
- throws java.security.cert.CertificateException {
- if (!theX509TrustManager.isClientTrusted(chain)) {
- throw new java.security.cert.CertificateException(
- "Untrusted Client Certificate Chain");
- }
- }
-
- public void checkServerTrusted(
- java.security.cert.X509Certificate[] chain, String authType)
- throws java.security.cert.CertificateException {
- if (!theX509TrustManager.isServerTrusted(chain)) {
- throw new java.security.cert.CertificateException(
- "Untrusted Server Certificate Chain");
- }
- }
-
- public java.security.cert.X509Certificate[] getAcceptedIssuers() {
- return theX509TrustManager.getAcceptedIssuers();
- }
-}
-
-@SuppressWarnings("deprecation")
-final class X509KeyManagerComSunWrapper implements X509KeyManager {
-
- private javax.net.ssl.X509KeyManager theX509KeyManager;
-
- X509KeyManagerComSunWrapper(javax.net.ssl.X509KeyManager obj) {
- theX509KeyManager = obj;
- }
-
- public String[] getClientAliases(String keyType, Principal[] issuers) {
- return theX509KeyManager.getClientAliases(keyType, issuers);
- }
-
- public String chooseClientAlias(String keyType, Principal[] issuers) {
- String [] keyTypes = new String [] { keyType };
- return theX509KeyManager.chooseClientAlias(keyTypes, issuers, null);
- }
-
- public String[] getServerAliases(String keyType, Principal[] issuers) {
- return theX509KeyManager.getServerAliases(keyType, issuers);
- }
-
- public String chooseServerAlias(String keyType, Principal[] issuers) {
- return theX509KeyManager.chooseServerAlias(keyType, issuers, null);
- }
-
- public java.security.cert.X509Certificate[]
- getCertificateChain(String alias) {
- return theX509KeyManager.getCertificateChain(alias);
- }
-
- public PrivateKey getPrivateKey(String alias) {
- return theX509KeyManager.getPrivateKey(alias);
- }
-}
-
-@SuppressWarnings("deprecation")
-final class X509TrustManagerComSunWrapper implements X509TrustManager {
-
- private javax.net.ssl.X509TrustManager theX509TrustManager;
-
- X509TrustManagerComSunWrapper(javax.net.ssl.X509TrustManager obj) {
- theX509TrustManager = obj;
- }
-
- public boolean isClientTrusted(
- java.security.cert.X509Certificate[] chain) {
- try {
- theX509TrustManager.checkClientTrusted(chain, "UNKNOWN");
- return true;
- } catch (java.security.cert.CertificateException e) {
- return false;
- }
- }
-
- public boolean isServerTrusted(
- java.security.cert.X509Certificate[] chain) {
- try {
- theX509TrustManager.checkServerTrusted(chain, "UNKNOWN");
- return true;
- } catch (java.security.cert.CertificateException e) {
- return false;
- }
- }
-
- public java.security.cert.X509Certificate[] getAcceptedIssuers() {
- return theX509TrustManager.getAcceptedIssuers();
- }
-}
diff --git a/src/java.base/share/classes/com/sun/net/ssl/TrustManager.java b/src/java.base/share/classes/com/sun/net/ssl/TrustManager.java
deleted file mode 100644
index 376b111fd81..00000000000
--- a/src/java.base/share/classes/com/sun/net/ssl/TrustManager.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * NOTE: this file was copied from javax.net.ssl.TrustManager
- */
-
-package com.sun.net.ssl;
-
-/**
- * Base interface for JSSE trust managers which manage
- * authentication trust decisions for different types of
- * authentication material.
- *
- * @deprecated As of JDK 1.4, this implementation-specific class was
- * replaced by {@link javax.net.ssl.TrustManager}.
- */
-@Deprecated(since="1.4")
-public interface TrustManager {
-}
diff --git a/src/java.base/share/classes/com/sun/net/ssl/TrustManagerFactory.java b/src/java.base/share/classes/com/sun/net/ssl/TrustManagerFactory.java
deleted file mode 100644
index b580f04af34..00000000000
--- a/src/java.base/share/classes/com/sun/net/ssl/TrustManagerFactory.java
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * NOTE: this file was copied from javax.net.ssl.TrustManagerFactory
- */
-
-package com.sun.net.ssl;
-
-import java.security.*;
-
-/**
- * This class acts as a factory for trust managers based on a
- * source of trust material. Each trust manager manages a specific
- * type of trust material for use by secure sockets. The trust
- * material is based on a KeyStore and/or provider specific sources.
- *
- * @deprecated As of JDK 1.4, this implementation-specific class was
- * replaced by {@link javax.net.ssl.TrustManagerFactory}.
- */
-@Deprecated(since="1.4")
-public class TrustManagerFactory {
- // The provider
- private Provider provider;
-
- // The provider implementation (delegate)
- private TrustManagerFactorySpi factorySpi;
-
- // The name of the trust management algorithm.
- private String algorithm;
-
- /**
- * The default TrustManager can be changed by setting the value of the
- * {@code sun.ssl.trustmanager.type} security property to the desired name.
- *
- * @return the default type as specified by the
- * {@code sun.ssl.trustmanager.type} security property, or an
- * implementation-specific default if no such property exists.
- *
- * @see java.security.Security security properties
- */
- public static final String getDefaultAlgorithm() {
- String type;
- type = AccessController.doPrivileged(new PrivilegedAction<>() {
- public String run() {
- return Security.getProperty("sun.ssl.trustmanager.type");
- }
- });
- if (type == null) {
- type = "SunX509";
- }
- return type;
-
- }
-
- /**
- * Creates a TrustManagerFactory object.
- *
- * @param factorySpi the delegate
- * @param provider the provider
- * @param algorithm the algorithm
- */
- protected TrustManagerFactory(TrustManagerFactorySpi factorySpi,
- Provider provider, String algorithm) {
- this.factorySpi = factorySpi;
- this.provider = provider;
- this.algorithm = algorithm;
- }
-
- /**
- * Returns the algorithm name of this TrustManagerFactory
- * object.
- *
- *
This is the same name that was specified in one of the
- * getInstance calls that created this
- * TrustManagerFactory object.
- *
- * @return the algorithm name of this TrustManagerFactory
- * object.
- */
- public final String getAlgorithm() {
- return this.algorithm;
- }
-
- /**
- * Generates a TrustManagerFactory object that implements the
- * specified trust management algorithm.
- * If the default provider package provides an implementation of the
- * requested trust management algorithm, an instance of
- * TrustManagerFactory containing that implementation is
- * returned. If the algorithm is not available in the default provider
- * package, other provider packages are searched.
- *
- * @param algorithm the standard name of the requested trust management
- * algorithm.
- *
- * @return the new TrustManagerFactory object
- *
- * @exception NoSuchAlgorithmException if the specified algorithm is not
- * available in the default provider package or any of the other provider
- * packages that were searched.
- */
- public static final TrustManagerFactory getInstance(String algorithm)
- throws NoSuchAlgorithmException
- {
- try {
- Object[] objs = SSLSecurity.getImpl(algorithm,
- "TrustManagerFactory", (String) null);
- return new TrustManagerFactory((TrustManagerFactorySpi)objs[0],
- (Provider)objs[1],
- algorithm);
- } catch (NoSuchProviderException e) {
- throw new NoSuchAlgorithmException(algorithm + " not found");
- }
- }
-
- /**
- * Generates a TrustManagerFactory object for the specified
- * trust management algorithm from the specified provider.
- *
- * @param algorithm the standard name of the requested trust management
- * algorithm.
- * @param provider the name of the provider
- *
- * @return the new TrustManagerFactory object
- *
- * @exception NoSuchAlgorithmException if the specified algorithm is not
- * available from the specified provider.
- * @exception NoSuchProviderException if the specified provider has not
- * been configured.
- */
- public static final TrustManagerFactory getInstance(String algorithm,
- String provider)
- throws NoSuchAlgorithmException, NoSuchProviderException
- {
- if (provider == null || provider.isEmpty())
- throw new IllegalArgumentException("missing provider");
- Object[] objs = SSLSecurity.getImpl(algorithm, "TrustManagerFactory",
- provider);
- return new TrustManagerFactory((TrustManagerFactorySpi)objs[0],
- (Provider)objs[1], algorithm);
- }
-
- /**
- * Generates a TrustManagerFactory object for the specified
- * trust management algorithm from the specified provider.
- *
- * @param algorithm the standard name of the requested trust management
- * algorithm.
- * @param provider an instance of the provider
- *
- * @return the new TrustManagerFactory object
- *
- * @exception NoSuchAlgorithmException if the specified algorithm is not
- * available from the specified provider.
- */
- public static final TrustManagerFactory getInstance(String algorithm,
- Provider provider)
- throws NoSuchAlgorithmException
- {
- if (provider == null)
- throw new IllegalArgumentException("missing provider");
- Object[] objs = SSLSecurity.getImpl(algorithm, "TrustManagerFactory",
- provider);
- return new TrustManagerFactory((TrustManagerFactorySpi)objs[0],
- (Provider)objs[1], algorithm);
- }
-
- /**
- * Returns the provider of this TrustManagerFactory object.
- *
- * @return the provider of this TrustManagerFactory object
- */
- public final Provider getProvider() {
- return this.provider;
- }
-
-
- /**
- * Initializes this factory with a source of certificate
- * authorities and related trust material. The
- * provider may also include a provider-specific source
- * of key material.
- *
- * @param ks the key store or null
- */
- public void init(KeyStore ks) throws KeyStoreException {
- factorySpi.engineInit(ks);
- }
-
- /**
- * Returns one trust manager for each type of trust material.
- * @return the trust managers
- */
- public TrustManager[] getTrustManagers() {
- return factorySpi.engineGetTrustManagers();
- }
-}
diff --git a/src/java.base/share/classes/com/sun/net/ssl/TrustManagerFactorySpi.java b/src/java.base/share/classes/com/sun/net/ssl/TrustManagerFactorySpi.java
deleted file mode 100644
index 8ab1901c4ea..00000000000
--- a/src/java.base/share/classes/com/sun/net/ssl/TrustManagerFactorySpi.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * NOTE: this file was copied from javax.net.ssl.TrustManagerFactorySpi
- */
-
-package com.sun.net.ssl;
-
-import java.security.*;
-
-/**
- * This class defines the Service Provider Interface (SPI)
- * for the TrustManagerFactory class.
- *
- *
All the abstract methods in this class must be implemented by each
- * cryptographic service provider who wishes to supply the implementation
- * of a particular trust manager factory.
- *
- * @deprecated As of JDK 1.4, this implementation-specific class was
- * replaced by {@link javax.net.ssl.TrustManagerFactorySpi}.
- */
-@Deprecated(since="1.4")
-public abstract class TrustManagerFactorySpi {
- /**
- * Initializes this factory with a source of certificate
- * authorities and related trust material. The
- * provider may also include a provider-specific source
- * of key material.
- *
- * @param ks the key store or null
- */
- protected abstract void engineInit(KeyStore ks) throws KeyStoreException;
-
- /**
- * Returns one trust manager for each type of trust material.
- * @return the trust managers
- */
- protected abstract TrustManager[] engineGetTrustManagers();
-}
diff --git a/src/java.base/share/classes/com/sun/net/ssl/X509KeyManager.java b/src/java.base/share/classes/com/sun/net/ssl/X509KeyManager.java
deleted file mode 100644
index 8d4019c8721..00000000000
--- a/src/java.base/share/classes/com/sun/net/ssl/X509KeyManager.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * NOTE: this file was copied from javax.net.ssl.X509KeyManager
- */
-
-package com.sun.net.ssl;
-
-import java.security.KeyManagementException;
-import java.security.PrivateKey;
-import java.security.Principal;
-import java.security.cert.X509Certificate;
-
-/**
- * Instances of this interface manage which X509 certificate-based
- * key pairs are used to authenticate the local side of a secure
- * socket. The individual entries are identified by unique alias names.
- *
- * @deprecated As of JDK 1.4, this implementation-specific class was
- * replaced by {@link javax.net.ssl.X509KeyManager}.
- */
-@Deprecated(since="1.4")
-public interface X509KeyManager extends KeyManager {
- /**
- * Get the matching aliases for authenticating the client side of a secure
- * socket given the public key type and the list of
- * certificate issuer authorities recognized by the peer (if any).
- *
- * @param keyType the key algorithm type name
- * @param issuers the list of acceptable CA issuer subject names
- * @return the matching alias names
- */
- public String[] getClientAliases(String keyType, Principal[] issuers);
-
- /**
- * Choose an alias to authenticate the client side of a secure
- * socket given the public key type and the list of
- * certificate issuer authorities recognized by the peer (if any).
- *
- * @param keyType the key algorithm type name
- * @param issuers the list of acceptable CA issuer subject names
- * @return the alias name for the desired key
- */
- public String chooseClientAlias(String keyType, Principal[] issuers);
-
- /**
- * Get the matching aliases for authenticating the server side of a secure
- * socket given the public key type and the list of
- * certificate issuer authorities recognized by the peer (if any).
- *
- * @param keyType the key algorithm type name
- * @param issuers the list of acceptable CA issuer subject names
- * @return the matching alias names
- */
- public String[] getServerAliases(String keyType, Principal[] issuers);
-
- /**
- * Choose an alias to authenticate the server side of a secure
- * socket given the public key type and the list of
- * certificate issuer authorities recognized by the peer (if any).
- *
- * @param keyType the key algorithm type name
- * @param issuers the list of acceptable CA issuer subject names
- * @return the alias name for the desired key
- */
- public String chooseServerAlias(String keyType, Principal[] issuers);
-
- /**
- * Returns the certificate chain associated with the given alias.
- *
- * @param alias the alias name
- *
- * @return the certificate chain (ordered with the user's certificate first
- * and the root certificate authority last)
- */
- public X509Certificate[] getCertificateChain(String alias);
-
- /*
- * Returns the key associated with the given alias.
- *
- * @param alias the alias name
- *
- * @return the requested key
- */
- public PrivateKey getPrivateKey(String alias);
-}
diff --git a/src/java.base/share/classes/com/sun/net/ssl/X509TrustManager.java b/src/java.base/share/classes/com/sun/net/ssl/X509TrustManager.java
deleted file mode 100644
index 041c3e6f587..00000000000
--- a/src/java.base/share/classes/com/sun/net/ssl/X509TrustManager.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * NOTE: this file was copied from javax.net.ssl.X509TrustManager
- */
-
-package com.sun.net.ssl;
-
-import java.security.cert.X509Certificate;
-
-/**
- * Instance of this interface manage which X509 certificates
- * may be used to authenticate the remote side of a secure
- * socket. Decisions may be based on trusted certificate
- * authorities, certificate revocation lists, online
- * status checking or other means.
- *
- * @deprecated As of JDK 1.4, this implementation-specific class was
- * replaced by {@link javax.net.ssl.X509TrustManager}.
- */
-@Deprecated(since="1.4")
-public interface X509TrustManager extends TrustManager {
- /**
- * Given the partial or complete certificate chain
- * provided by the peer, build a certificate path
- * to a trusted root and return true if it can be
- * validated and is trusted for client SSL authentication.
- *
- * @param chain the peer certificate chain
- */
- public boolean isClientTrusted(X509Certificate[] chain);
-
- /**
- * Given the partial or complete certificate chain
- * provided by the peer, build a certificate path
- * to a trusted root and return true if it can be
- * validated and is trusted for server SSL authentication.
- *
- * @param chain the peer certificate chain
- */
- public boolean isServerTrusted(X509Certificate[] chain);
-
- /**
- * Return an array of certificate authority certificates
- * which are trusted for authenticating peers.
- *
- * @return the acceptable CA issuer certificates
- */
- public X509Certificate[] getAcceptedIssuers();
-}
diff --git a/src/java.base/share/classes/com/sun/net/ssl/internal/ssl/Provider.java b/src/java.base/share/classes/com/sun/net/ssl/internal/ssl/Provider.java
deleted file mode 100644
index 40e3317dd0f..00000000000
--- a/src/java.base/share/classes/com/sun/net/ssl/internal/ssl/Provider.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.net.ssl.internal.ssl;
-
-import sun.security.ssl.SunJSSE;
-
-/**
- * Main class for the SunJSSE provider. The actual code was moved to the
- * class sun.security.ssl.SunJSSE, but for backward compatibility we
- * continue to use this class as the main Provider class.
- */
-@Deprecated(since="9")
-public final class Provider extends SunJSSE {
-
- private static final long serialVersionUID = 3231825739635378733L;
-
- // standard constructor
- public Provider() {
- super();
- }
-
- /**
- * Installs the JSSE provider.
- */
- public static synchronized void install() {
- /* nop. Remove this method in the future. */
- }
-
-}
diff --git a/src/java.base/share/classes/com/sun/net/ssl/internal/ssl/X509ExtendedTrustManager.java b/src/java.base/share/classes/com/sun/net/ssl/internal/ssl/X509ExtendedTrustManager.java
deleted file mode 100644
index 2af41b97fe5..00000000000
--- a/src/java.base/share/classes/com/sun/net/ssl/internal/ssl/X509ExtendedTrustManager.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.net.ssl.internal.ssl;
-
-import javax.net.ssl.X509TrustManager;
-
-import java.security.cert.X509Certificate;
-import java.security.cert.CertificateException;
-
-/**
- * Instance of this class is an extension of X509TrustManager.
- *
- * Note that this class is referenced by the Deploy workspace. Any updates - * must make sure that they do not cause any breakage there. - *
- * It takes the responsiblity of checking the peer identity with its - * principal declared in the cerificate. - *
- * The class provides an alternative to HostnameVerifer.
- * If application customizes its HostnameVerifer for
- * HttpsURLConnection, the peer identity will be checked
- * by the customized HostnameVerifer; otherwise, it will
- * be checked by the extended trust manager.
- *
- * RFC2830 defines the server identification specification for "LDAP" - * algorithm. RFC2818 defines both the server identification and the - * client identification specification for "HTTPS" algorithm. - * - * @see X509TrustManager - * @see HostnameVerifier - * - * @since 1.6 - * @author Xuelei Fan - */ -@Deprecated(since="9") -public abstract class X509ExtendedTrustManager implements X509TrustManager { - /** - * Constructor used by subclasses only. - */ - protected X509ExtendedTrustManager() { - } - - /** - * Given the partial or complete certificate chain provided by the - * peer, check its identity and build a certificate path to a trusted - * root, return if it can be validated and is trusted for client SSL - * authentication based on the authentication type. - *
- * The authentication type is determined by the actual certificate - * used. For instance, if RSAPublicKey is used, the authType - * should be "RSA". Checking is case-sensitive. - *
- * The algorithm parameter specifies the client identification protocol - * to use. If the algorithm and the peer hostname are available, the - * peer hostname is checked against the peer's identity presented in - * the X509 certificate, in order to prevent masquerade attacks. - * - * @param chain the peer certificate chain - * @param authType the authentication type based on the client certificate - * @param hostname the peer hostname - * @param algorithm the identification algorithm - * @throws IllegalArgumentException if null or zero-length chain - * is passed in for the chain parameter or if null or zero-length - * string is passed in for the authType parameter - * @throws CertificateException if the certificate chain is not trusted - * by this TrustManager. - */ - public abstract void checkClientTrusted(X509Certificate[] chain, - String authType, String hostname, String algorithm) - throws CertificateException; - - /** - * Given the partial or complete certificate chain provided by the - * peer, check its identity and build a certificate path to a trusted - * root, return if it can be validated and is trusted for server SSL - * authentication based on the authentication type. - *
- * The authentication type is the key exchange algorithm portion - * of the cipher suites represented as a String, such as "RSA", - * "DHE_DSS". Checking is case-sensitive. - *
- * The algorithm parameter specifies the server identification protocol - * to use. If the algorithm and the peer hostname are available, the - * peer hostname is checked against the peer's identity presented in - * the X509 certificate, in order to prevent masquerade attacks. - * - * @param chain the peer certificate chain - * @param authType the key exchange algorithm used - * @param hostname the peer hostname - * @param algorithm the identification algorithm - * @throws IllegalArgumentException if null or zero-length chain - * is passed in for the chain parameter or if null or zero-length - * string is passed in for the authType parameter - * @throws CertificateException if the certificate chain is not trusted - * by this TrustManager. - */ - public abstract void checkServerTrusted(X509Certificate[] chain, - String authType, String hostname, String algorithm) - throws CertificateException; -} diff --git a/src/java.base/share/classes/com/sun/net/ssl/internal/www/protocol/https/DelegateHttpsURLConnection.java b/src/java.base/share/classes/com/sun/net/ssl/internal/www/protocol/https/DelegateHttpsURLConnection.java deleted file mode 100644 index 46b8e299911..00000000000 --- a/src/java.base/share/classes/com/sun/net/ssl/internal/www/protocol/https/DelegateHttpsURLConnection.java +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.net.ssl.internal.www.protocol.https; - -import java.net.URL; -import java.net.Proxy; -import java.io.IOException; -import java.util.Collection; -import java.util.List; -import java.util.Iterator; - -import java.security.Principal; -import java.security.cert.*; - -import javax.security.auth.x500.X500Principal; - -import sun.security.util.HostnameChecker; -import sun.security.util.DerValue; -import sun.security.x509.X500Name; - -import sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection; - -/** - * This class was introduced to provide an additional level of - * abstraction between javax.net.ssl.HttpURLConnection and - * com.sun.net.ssl.HttpURLConnection objects.
- *
- * javax.net.ssl.HttpURLConnection is used in the new sun.net version
- * of protocol implementation (this one)
- * com.sun.net.ssl.HttpURLConnection is used in the com.sun version.
- *
- */
-@Deprecated(since="9")
-@SuppressWarnings("deprecation") // HttpsURLConnection is deprecated
-public class DelegateHttpsURLConnection extends AbstractDelegateHttpsURLConnection {
-
- // we need a reference to the HttpsURLConnection to get
- // the properties set there
- // we also need it to be public so that it can be referenced
- // from sun.net.www.protocol.http.HttpURLConnection
- // this is for ResponseCache.put(URI, URLConnection)
- // second parameter needs to be cast to javax.net.ssl.HttpsURLConnection
- // instead of AbstractDelegateHttpsURLConnection
-
- public com.sun.net.ssl.HttpsURLConnection httpsURLConnection;
-
- DelegateHttpsURLConnection(URL url,
- sun.net.www.protocol.http.Handler handler,
- com.sun.net.ssl.HttpsURLConnection httpsURLConnection)
- throws IOException {
- this(url, null, handler, httpsURLConnection);
- }
-
- DelegateHttpsURLConnection(URL url, Proxy p,
- sun.net.www.protocol.http.Handler handler,
- com.sun.net.ssl.HttpsURLConnection httpsURLConnection)
- throws IOException {
- super(url, p, handler);
- this.httpsURLConnection = httpsURLConnection;
- }
-
- protected javax.net.ssl.SSLSocketFactory getSSLSocketFactory() {
- return httpsURLConnection.getSSLSocketFactory();
- }
-
- protected javax.net.ssl.HostnameVerifier getHostnameVerifier() {
- // note: getHostnameVerifier() never returns null
- return new VerifierWrapper(httpsURLConnection.getHostnameVerifier());
- }
-
- /*
- * Called by layered delegator's finalize() method to handle closing
- * the underlying object.
- */
- protected void dispose() throws Throwable {
- super.finalize();
- }
-}
-
-class VerifierWrapper implements javax.net.ssl.HostnameVerifier {
- @SuppressWarnings("deprecation")
- private com.sun.net.ssl.HostnameVerifier verifier;
-
- @SuppressWarnings("deprecation")
- VerifierWrapper(com.sun.net.ssl.HostnameVerifier verifier) {
- this.verifier = verifier;
- }
-
- /*
- * In com.sun.net.ssl.HostnameVerifier the method is defined
- * as verify(String urlHostname, String certHostname).
- * This means we need to extract the hostname from the X.509 certificate
- * in this wrapper.
- */
- public boolean verify(String hostname, javax.net.ssl.SSLSession session) {
- try {
- Certificate[] serverChain = session.getPeerCertificates();
- if ((serverChain == null) || (serverChain.length == 0)) {
- return false;
- }
- if (serverChain[0] instanceof X509Certificate == false) {
- return false;
- }
- X509Certificate serverCert = (X509Certificate)serverChain[0];
- String serverName = getServername(serverCert);
- if (serverName == null) {
- return false;
- }
- return verifier.verify(hostname, serverName);
- } catch (javax.net.ssl.SSLPeerUnverifiedException e) {
- return false;
- }
- }
-
- /*
- * Extract the name of the SSL server from the certificate.
- *
- * Note this code is essentially a subset of the hostname extraction
- * code in HostnameChecker.
- */
- private static String getServername(X509Certificate peerCert) {
- try {
- // compare to subjectAltNames if dnsName is present
- Collection> subjAltNames = peerCert.getSubjectAlternativeNames();
- if (subjAltNames != null) {
- for (Iterator
> itr = subjAltNames.iterator(); itr.hasNext(); ) {
- List> next = itr.next();
- if (((Integer)next.get(0)).intValue() == 2) {
- // compare dNSName with host in url
- String dnsName = ((String)next.get(1));
- return dnsName;
- }
- }
- }
-
- // else check against common name in the subject field
- X500Name subject = HostnameChecker.getSubjectX500Name(peerCert);
-
- DerValue derValue = subject.findMostSpecificAttribute
- (X500Name.commonName_oid);
- if (derValue != null) {
- try {
- String name = derValue.getAsString();
- return name;
- } catch (IOException e) {
- // ignore
- }
- }
- } catch (java.security.cert.CertificateException e) {
- // ignore
- }
- return null;
- }
-
-}
diff --git a/src/java.base/share/classes/com/sun/net/ssl/internal/www/protocol/https/Handler.java b/src/java.base/share/classes/com/sun/net/ssl/internal/www/protocol/https/Handler.java
deleted file mode 100644
index 42874841bfc..00000000000
--- a/src/java.base/share/classes/com/sun/net/ssl/internal/www/protocol/https/Handler.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.net.ssl.internal.www.protocol.https;
-
-import java.io.IOException;
-import java.net.URL;
-import java.net.Proxy;
-
-/**
- * This class exists for compatibility with previous JSSE releases
- * only. The HTTPS implementation can now be found in
- * sun.net.www.protocol.https.
- *
- */
-@Deprecated(since="9")
-public class Handler extends sun.net.www.protocol.https.Handler {
-
- public Handler() {
- super();
- }
-
- public Handler(String proxy, int port) {
- super(proxy, port);
- }
-
- protected java.net.URLConnection openConnection(URL u) throws IOException {
- return openConnection(u, (Proxy)null);
- }
-
- protected java.net.URLConnection openConnection(URL u, Proxy p) throws IOException {
- return new HttpsURLConnectionOldImpl(u, p, this);
- }
-}
diff --git a/src/java.base/share/classes/com/sun/net/ssl/internal/www/protocol/https/HttpsURLConnectionOldImpl.java b/src/java.base/share/classes/com/sun/net/ssl/internal/www/protocol/https/HttpsURLConnectionOldImpl.java
deleted file mode 100644
index eb7c11b21f9..00000000000
--- a/src/java.base/share/classes/com/sun/net/ssl/internal/www/protocol/https/HttpsURLConnectionOldImpl.java
+++ /dev/null
@@ -1,506 +0,0 @@
-/*
- * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * NOTE: This class lives in the package sun.net.www.protocol.https.
- * There is a copy in com.sun.net.ssl.internal.www.protocol.https for JSSE
- * 1.0.2 compatibility. It is 100% identical except the package and extends
- * lines. Any changes should be made to be class in sun.net.* and then copied
- * to com.sun.net.*.
- */
-
-// For both copies of the file, uncomment one line and comment the other
-// package sun.net.www.protocol.https;
-package com.sun.net.ssl.internal.www.protocol.https;
-
-import java.net.URL;
-import java.net.Proxy;
-import java.net.ProtocolException;
-import java.net.MalformedURLException;
-import java.io.*;
-import java.net.Authenticator;
-import javax.net.ssl.*;
-import java.security.Permission;
-import java.util.Map;
-import java.util.List;
-import sun.net.www.http.HttpClient;
-
-/**
- * A class to represent an HTTP connection to a remote object.
- *
- * Ideally, this class should subclass and inherit the http handler
- * implementation, but it can't do so because that class have the
- * wrong Java Type. Thus it uses the delegate (aka, the
- * Adapter/Wrapper design pattern) to reuse code from the http
- * handler.
- *
- * Since it would use a delegate to access
- * sun.net.www.protocol.http.HttpURLConnection functionalities, it
- * needs to implement all public methods in it's super class and all
- * the way to Object.
- *
- */
-
-// For both copies of the file, uncomment one line and comment the other
-// public class HttpsURLConnectionImpl
-// extends javax.net.ssl.HttpsURLConnection {
-@Deprecated(since="9")
-@SuppressWarnings("deprecation") // HttpsURLConnection is deprecated
-public class HttpsURLConnectionOldImpl
- extends com.sun.net.ssl.HttpsURLConnection {
-
- private DelegateHttpsURLConnection delegate;
-
-// For both copies of the file, uncomment one line and comment the other
-// HttpsURLConnectionImpl(URL u, Handler handler) throws IOException {
- HttpsURLConnectionOldImpl(URL u, Handler handler) throws IOException {
- this(u, null, handler);
- }
-
- static URL checkURL(URL u) throws IOException {
- if (u != null) {
- if (u.toExternalForm().indexOf('\n') > -1) {
- throw new MalformedURLException("Illegal character in URL");
- }
- }
- return u;
- }
-// For both copies of the file, uncomment one line and comment the other
-// HttpsURLConnectionImpl(URL u, Handler handler) throws IOException {
- HttpsURLConnectionOldImpl(URL u, Proxy p, Handler handler) throws IOException {
- super(checkURL(u));
- delegate = new DelegateHttpsURLConnection(url, p, handler, this);
- }
-
- /**
- * Create a new HttpClient object, bypassing the cache of
- * HTTP client objects/connections.
- *
- * @param url the URL being accessed
- */
- protected void setNewClient(URL url) throws IOException {
- delegate.setNewClient(url, false);
- }
-
- /**
- * Obtain a HttpClient object. Use the cached copy if specified.
- *
- * @param url the URL being accessed
- * @param useCache whether the cached connection should be used
- * if present
- */
- protected void setNewClient(URL url, boolean useCache)
- throws IOException {
- delegate.setNewClient(url, useCache);
- }
-
- /**
- * Create a new HttpClient object, set up so that it uses
- * per-instance proxying to the given HTTP proxy. This
- * bypasses the cache of HTTP client objects/connections.
- *
- * @param url the URL being accessed
- * @param proxyHost the proxy host to use
- * @param proxyPort the proxy port to use
- */
- protected void setProxiedClient(URL url, String proxyHost, int proxyPort)
- throws IOException {
- delegate.setProxiedClient(url, proxyHost, proxyPort);
- }
-
- /**
- * Obtain a HttpClient object, set up so that it uses per-instance
- * proxying to the given HTTP proxy. Use the cached copy of HTTP
- * client objects/connections if specified.
- *
- * @param url the URL being accessed
- * @param proxyHost the proxy host to use
- * @param proxyPort the proxy port to use
- * @param useCache whether the cached connection should be used
- * if present
- */
- protected void setProxiedClient(URL url, String proxyHost, int proxyPort,
- boolean useCache) throws IOException {
- delegate.setProxiedClient(url, proxyHost, proxyPort, useCache);
- }
-
- /**
- * Implements the HTTP protocol handler's "connect" method,
- * establishing an SSL connection to the server as necessary.
- */
- public void connect() throws IOException {
- delegate.connect();
- }
-
- /**
- * Used by subclass to access "connected" variable. Since we are
- * delegating the actual implementation to "delegate", we need to
- * delegate the access of "connected" as well.
- */
- protected boolean isConnected() {
- return delegate.isConnected();
- }
-
- /**
- * Used by subclass to access "connected" variable. Since we are
- * delegating the actual implementation to "delegate", we need to
- * delegate the access of "connected" as well.
- */
- protected void setConnected(boolean conn) {
- delegate.setConnected(conn);
- }
-
- /**
- * Returns the cipher suite in use on this connection.
- */
- public String getCipherSuite() {
- return delegate.getCipherSuite();
- }
-
- /**
- * Returns the certificate chain the client sent to the
- * server, or null if the client did not authenticate.
- */
- public java.security.cert.Certificate []
- getLocalCertificates() {
- return delegate.getLocalCertificates();
- }
-
- /**
- * Returns the server's certificate chain, or throws
- * SSLPeerUnverified Exception if
- * the server did not authenticate.
- */
- public java.security.cert.Certificate []
- getServerCertificates() throws SSLPeerUnverifiedException {
- return delegate.getServerCertificates();
- }
-
- /*
- * Allowable input/output sequences:
- * [interpreted as POST/PUT]
- * - get output, [write output,] get input, [read input]
- * - get output, [write output]
- * [interpreted as GET]
- * - get input, [read input]
- * Disallowed:
- * - get input, [read input,] get output, [write output]
- */
-
- public synchronized OutputStream getOutputStream() throws IOException {
- return delegate.getOutputStream();
- }
-
- public synchronized InputStream getInputStream() throws IOException {
- return delegate.getInputStream();
- }
-
- public InputStream getErrorStream() {
- return delegate.getErrorStream();
- }
-
- /**
- * Disconnect from the server.
- */
- public void disconnect() {
- delegate.disconnect();
- }
-
- public boolean usingProxy() {
- return delegate.usingProxy();
- }
-
- /**
- * Returns an unmodifiable Map of the header fields.
- * The Map keys are Strings that represent the
- * response-header field names. Each Map value is an
- * unmodifiable List of Strings that represents
- * the corresponding field values.
- *
- * @return a Map of header fields
- * @since 1.4
- */
- public Map
accept").
- * @param value the value associated with it.
- * @see #getRequestProperties(java.lang.String)
- * @since 1.4
- */
- public void addRequestProperty(String key, String value) {
- delegate.addRequestProperty(key, value);
- }
-
- /**
- * Overwrite super class method
- */
- public int getResponseCode() throws IOException {
- return delegate.getResponseCode();
- }
-
- public String getRequestProperty(String key) {
- return delegate.getRequestProperty(key);
- }
-
- /**
- * Returns an unmodifiable Map of general request
- * properties for this connection. The Map keys
- * are Strings that represent the request-header
- * field names. Each Map value is a unmodifiable List
- * of Strings that represents the corresponding
- * field values.
- *
- * @return a Map of the general request properties for this connection.
- * @throws IllegalStateException if already connected
- * @since 1.4
- */
- public Map