0N/A/*
4467N/A * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/A/*
0N/A * NOTE: this file was copied from javax.net.ssl.HttpsURLConnection
0N/A */
0N/A
0N/Apackage com.sun.net.ssl;
0N/A
0N/Aimport java.net.URL;
0N/Aimport java.net.HttpURLConnection;
0N/Aimport java.io.IOException;
0N/Aimport javax.net.SocketFactory;
0N/Aimport javax.net.ssl.SSLSocketFactory;
0N/A
0N/Aimport javax.security.cert.X509Certificate;
0N/A
0N/A/**
0N/A * HTTP URL connection with support for HTTPS-specific features. See
0N/A * <A HREF="http://www.w3.org/pub/WWW/Protocols/"> the spec </A> for
0N/A * details.
0N/A *
0N/A * @deprecated As of JDK 1.4, this implementation-specific class was
0N/A * replaced by {@link javax.net.ssl.HttpsURLConnection}.
0N/A */
0N/A@Deprecated
0N/Aabstract public
0N/Aclass HttpsURLConnection extends HttpURLConnection
0N/A{
0N/A /*
0N/A * Initialize an HTTPS URLConnection ... could check that the URL
0N/A * is an "https" URL, and that the handler is also an HTTPS one,
0N/A * but that's established by other code in this package.
0N/A * @param url the URL
0N/A */
0N/A public HttpsURLConnection(URL url) throws IOException {
0N/A super(url);
0N/A }
0N/A
0N/A /**
0N/A * Returns the cipher suite in use on this connection.
0N/A * @return the cipher suite
0N/A */
0N/A public abstract String getCipherSuite();
0N/A
0N/A /**
0N/A * Returns the server's X.509 certificate chain, or null if
0N/A * the server did not authenticate.
0N/A * @return the server certificate chain
0N/A */
0N/A public abstract X509Certificate [] getServerCertificateChain();
0N/A
0N/A /**
0N/A * HostnameVerifier provides a callback mechanism so that
0N/A * implementers of this interface can supply a policy for
0N/A * handling the case where the host to connect to and
0N/A * the server name from the certificate mismatch.
0N/A *
0N/A * The default implementation will deny such connections.
0N/A */
0N/A private static HostnameVerifier defaultHostnameVerifier =
0N/A new HostnameVerifier() {
0N/A public boolean verify(String urlHostname, String certHostname) {
0N/A return false;
0N/A }
0N/A };
0N/A
0N/A protected HostnameVerifier hostnameVerifier = defaultHostnameVerifier;
0N/A
0N/A /**
0N/A * Sets the default HostnameVerifier inherited when an instance
0N/A * of this class is created.
0N/A * @param v the default host name verifier
0N/A */
0N/A public static void setDefaultHostnameVerifier(HostnameVerifier v) {
0N/A if (v == null) {
0N/A throw new IllegalArgumentException(
0N/A "no default HostnameVerifier specified");
0N/A }
0N/A
0N/A SecurityManager sm = System.getSecurityManager();
0N/A if (sm != null) {
0N/A sm.checkPermission(new SSLPermission("setHostnameVerifier"));
0N/A }
0N/A defaultHostnameVerifier = v;
0N/A }
0N/A
0N/A /**
0N/A * Gets the default HostnameVerifier.
0N/A * @return the default host name verifier
0N/A */
0N/A public static HostnameVerifier getDefaultHostnameVerifier() {
0N/A return defaultHostnameVerifier;
0N/A }
0N/A
0N/A /**
0N/A * Sets the HostnameVerifier.
0N/A * @param v the host name verifier
0N/A */
0N/A public void setHostnameVerifier(HostnameVerifier v) {
0N/A if (v == null) {
0N/A throw new IllegalArgumentException(
0N/A "no HostnameVerifier specified");
0N/A }
0N/A
0N/A hostnameVerifier = v;
0N/A }
0N/A
0N/A /**
0N/A * Gets the HostnameVerifier.
0N/A * @return the host name verifier
0N/A */
0N/A public HostnameVerifier getHostnameVerifier() {
0N/A return hostnameVerifier;
0N/A }
0N/A
0N/A private static SSLSocketFactory defaultSSLSocketFactory = null;
0N/A
0N/A private SSLSocketFactory sslSocketFactory = getDefaultSSLSocketFactory();
0N/A
0N/A /**
0N/A * Sets the default SSL socket factory inherited when an instance
0N/A * of this class is created.
0N/A * @param sf the default SSL socket factory
0N/A */
0N/A public static void setDefaultSSLSocketFactory(SSLSocketFactory sf) {
0N/A if (sf == null) {
0N/A throw new IllegalArgumentException(
0N/A "no default SSLSocketFactory specified");
0N/A }
0N/A
0N/A SecurityManager sm = System.getSecurityManager();
0N/A if (sm != null) {
0N/A sm.checkSetFactory();
0N/A }
0N/A defaultSSLSocketFactory = sf;
0N/A }
0N/A
0N/A /**
0N/A * Gets the default SSL socket factory.
0N/A * @return the default SSL socket factory
0N/A */
0N/A public static SSLSocketFactory getDefaultSSLSocketFactory() {
0N/A if (defaultSSLSocketFactory == null) {
0N/A defaultSSLSocketFactory =
0N/A (SSLSocketFactory)SSLSocketFactory.getDefault();
0N/A }
0N/A return defaultSSLSocketFactory;
0N/A }
0N/A
0N/A /**
0N/A * Sets the SSL socket factory.
0N/A * @param sf the SSL socket factory
0N/A */
0N/A public void setSSLSocketFactory(SSLSocketFactory sf) {
0N/A if (sf == null) {
0N/A throw new IllegalArgumentException(
0N/A "no SSLSocketFactory specified");
0N/A }
4467N/A
4467N/A SecurityManager sm = System.getSecurityManager();
4467N/A if (sm != null) {
4467N/A sm.checkSetFactory();
4467N/A }
4467N/A
0N/A sslSocketFactory = sf;
0N/A }
0N/A
0N/A /**
0N/A * Gets the SSL socket factory.
0N/A * @return the SSL socket factory
0N/A */
0N/A public SSLSocketFactory getSSLSocketFactory() {
0N/A return sslSocketFactory;
0N/A }
0N/A}