jdk/src/java.base/share/classes/javax/net/ssl/SSLContext.java
author xuelei
Tue, 02 Jun 2015 04:01:04 +0000
changeset 30904 ec0224270f90
parent 25859 3317bb8137f4
child 32210 958d823579c3
permissions -rw-r--r--
8043758: Datagram Transport Layer Security (DTLS) Reviewed-by: jnimeh, weijun, mullan, wetmore
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
30904
ec0224270f90 8043758: Datagram Transport Layer Security (DTLS)
xuelei
parents: 25859
diff changeset
     2
 * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 473
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 473
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 473
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 473
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 473
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package javax.net.ssl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.security.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import sun.security.jca.GetInstance;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * Instances of this class represent a secure socket protocol
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * implementation which acts as a factory for secure socket
30904
ec0224270f90 8043758: Datagram Transport Layer Security (DTLS)
xuelei
parents: 25859
diff changeset
    35
 * factories or {@code SSLEngine}s. This class is initialized
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * with an optional set of key and trust managers and source of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * secure random bytes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 *
8152
94e5966bdf22 5001004: Required Security Algorithms need to be defined
mullan
parents: 5820
diff changeset
    39
 * <p> Every implementation of the Java platform is required to support the
30904
ec0224270f90 8043758: Datagram Transport Layer Security (DTLS)
xuelei
parents: 25859
diff changeset
    40
 * following standard {@code SSLContext} protocol:
8152
94e5966bdf22 5001004: Required Security Algorithms need to be defined
mullan
parents: 5820
diff changeset
    41
 * <ul>
94e5966bdf22 5001004: Required Security Algorithms need to be defined
mullan
parents: 5820
diff changeset
    42
 * <li><tt>TLSv1</tt></li>
94e5966bdf22 5001004: Required Security Algorithms need to be defined
mullan
parents: 5820
diff changeset
    43
 * </ul>
94e5966bdf22 5001004: Required Security Algorithms need to be defined
mullan
parents: 5820
diff changeset
    44
 * This protocol is described in the <a href=
94e5966bdf22 5001004: Required Security Algorithms need to be defined
mullan
parents: 5820
diff changeset
    45
 * "{@docRoot}/../technotes/guides/security/StandardNames.html#SSLContext">
94e5966bdf22 5001004: Required Security Algorithms need to be defined
mullan
parents: 5820
diff changeset
    46
 * SSLContext section</a> of the
94e5966bdf22 5001004: Required Security Algorithms need to be defined
mullan
parents: 5820
diff changeset
    47
 * Java Cryptography Architecture Standard Algorithm Name Documentation.
94e5966bdf22 5001004: Required Security Algorithms need to be defined
mullan
parents: 5820
diff changeset
    48
 * Consult the release documentation for your implementation to see if any
94e5966bdf22 5001004: Required Security Algorithms need to be defined
mullan
parents: 5820
diff changeset
    49
 * other algorithms are supported.
94e5966bdf22 5001004: Required Security Algorithms need to be defined
mullan
parents: 5820
diff changeset
    50
 *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
public class SSLContext {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
    private final Provider provider;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
    private final SSLContextSpi contextSpi;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
    private final String protocol;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
     * Creates an SSLContext object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
     * @param contextSpi the delegate
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
     * @param provider the provider
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
     * @param protocol the protocol
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
    protected SSLContext(SSLContextSpi contextSpi, Provider provider,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
            String protocol) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
        this.contextSpi = contextSpi;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
        this.provider = provider;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
        this.protocol = protocol;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
    private static SSLContext defaultContext;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
     * Returns the default SSL context.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
     * <p>If a default context was set using the {@link #setDefault
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
     * SSLContext.setDefault()} method, it is returned. Otherwise, the first
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
     * call of this method triggers the call
30904
ec0224270f90 8043758: Datagram Transport Layer Security (DTLS)
xuelei
parents: 25859
diff changeset
    82
     * {@code SSLContext.getInstance("Default")}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
     * If successful, that object is made the default SSL context and returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
     * <p>The default context is immediately
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
     * usable and does not require {@linkplain #init initialization}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
     * @return the default SSL context
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
     * @throws NoSuchAlgorithmException if the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     *   {@link SSLContext#getInstance SSLContext.getInstance()} call fails
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
    public static synchronized SSLContext getDefault()
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
            throws NoSuchAlgorithmException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
        if (defaultContext == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
            defaultContext = SSLContext.getInstance("Default");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
        return defaultContext;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     * Sets the default SSL context. It will be returned by subsequent calls
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
     * to {@link #getDefault}. The default context must be immediately usable
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
     * and not require {@linkplain #init initialization}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
     * @param context the SSLContext
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
     * @throws  NullPointerException if context is null
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     * @throws  SecurityException if a security manager exists and its
30904
ec0224270f90 8043758: Datagram Transport Layer Security (DTLS)
xuelei
parents: 25859
diff changeset
   109
     *          {@code checkPermission} method does not allow
ec0224270f90 8043758: Datagram Transport Layer Security (DTLS)
xuelei
parents: 25859
diff changeset
   110
     *          {@code SSLPermission("setDefaultSSLContext")}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
    public static synchronized void setDefault(SSLContext context) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
        if (context == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
            throw new NullPointerException();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
        SecurityManager sm = System.getSecurityManager();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
        if (sm != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
            sm.checkPermission(new SSLPermission("setDefaultSSLContext"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
        defaultContext = context;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
    /**
30904
ec0224270f90 8043758: Datagram Transport Layer Security (DTLS)
xuelei
parents: 25859
diff changeset
   125
     * Returns a {@code SSLContext} object that implements the
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     * specified secure socket protocol.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
     * <p> This method traverses the list of registered security Providers,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
     * starting with the most preferred Provider.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
     * A new SSLContext object encapsulating the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
     * SSLContextSpi implementation from the first
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
     * Provider that supports the specified protocol is returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
     * <p> Note that the list of registered providers may be retrieved via
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
     * the {@link Security#getProviders() Security.getProviders()} method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
     * @param protocol the standard name of the requested protocol.
8152
94e5966bdf22 5001004: Required Security Algorithms need to be defined
mullan
parents: 5820
diff changeset
   138
     *          See the SSLContext section in the <a href=
94e5966bdf22 5001004: Required Security Algorithms need to be defined
mullan
parents: 5820
diff changeset
   139
     * "{@docRoot}/../technotes/guides/security/StandardNames.html#SSLContext">
94e5966bdf22 5001004: Required Security Algorithms need to be defined
mullan
parents: 5820
diff changeset
   140
     *          Java Cryptography Architecture Standard Algorithm Name
94e5966bdf22 5001004: Required Security Algorithms need to be defined
mullan
parents: 5820
diff changeset
   141
     *          Documentation</a>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
     *          for information about standard protocol names.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
     *
30904
ec0224270f90 8043758: Datagram Transport Layer Security (DTLS)
xuelei
parents: 25859
diff changeset
   144
     * @return the new {@code SSLContext} object.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
     * @exception NoSuchAlgorithmException if no Provider supports a
12557
30cadbf1ecbd 7158688: Typo in SSLContext Spec
xuelei
parents: 9035
diff changeset
   147
     *          SSLContextSpi implementation for the
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
     *          specified protocol.
473
80bf10b052ee 6546639: (spec)javax.net.ssl.SSLContext.getInstance(null) throws undocumented NPE
xuelei
parents: 2
diff changeset
   149
     * @exception NullPointerException if protocol is null.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
     * @see java.security.Provider
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
    public static SSLContext getInstance(String protocol)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
            throws NoSuchAlgorithmException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
        GetInstance.Instance instance = GetInstance.getInstance
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
                ("SSLContext", SSLContextSpi.class, protocol);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
        return new SSLContext((SSLContextSpi)instance.impl, instance.provider,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
                protocol);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
    /**
30904
ec0224270f90 8043758: Datagram Transport Layer Security (DTLS)
xuelei
parents: 25859
diff changeset
   162
     * Returns a {@code SSLContext} object that implements the
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
     * specified secure socket protocol.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
     * <p> A new SSLContext object encapsulating the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
     * SSLContextSpi implementation from the specified provider
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
     * is returned.  The specified provider must be registered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
     * in the security provider list.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
     * <p> Note that the list of registered providers may be retrieved via
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
     * the {@link Security#getProviders() Security.getProviders()} method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
     * @param protocol the standard name of the requested protocol.
8152
94e5966bdf22 5001004: Required Security Algorithms need to be defined
mullan
parents: 5820
diff changeset
   174
     *          See the SSLContext section in the <a href=
94e5966bdf22 5001004: Required Security Algorithms need to be defined
mullan
parents: 5820
diff changeset
   175
     * "{@docRoot}/../technotes/guides/security/StandardNames.html#SSLContext">
94e5966bdf22 5001004: Required Security Algorithms need to be defined
mullan
parents: 5820
diff changeset
   176
     *          Java Cryptography Architecture Standard Algorithm Name
94e5966bdf22 5001004: Required Security Algorithms need to be defined
mullan
parents: 5820
diff changeset
   177
     *          Documentation</a>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
     *          for information about standard protocol names.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
     * @param provider the name of the provider.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
     *
30904
ec0224270f90 8043758: Datagram Transport Layer Security (DTLS)
xuelei
parents: 25859
diff changeset
   182
     * @return the new {@code SSLContext} object.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
     * @throws NoSuchAlgorithmException if a SSLContextSpi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
     *          implementation for the specified protocol is not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
     *          available from the specified provider.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
     * @throws NoSuchProviderException if the specified provider is not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
     *          registered in the security provider list.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
     * @throws IllegalArgumentException if the provider name is null or empty.
473
80bf10b052ee 6546639: (spec)javax.net.ssl.SSLContext.getInstance(null) throws undocumented NPE
xuelei
parents: 2
diff changeset
   192
     * @throws NullPointerException if protocol is null.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
     * @see java.security.Provider
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
    public static SSLContext getInstance(String protocol, String provider)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
            throws NoSuchAlgorithmException, NoSuchProviderException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
        GetInstance.Instance instance = GetInstance.getInstance
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
                ("SSLContext", SSLContextSpi.class, protocol, provider);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
        return new SSLContext((SSLContextSpi)instance.impl, instance.provider,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
                protocol);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
    /**
30904
ec0224270f90 8043758: Datagram Transport Layer Security (DTLS)
xuelei
parents: 25859
diff changeset
   205
     * Returns a {@code SSLContext} object that implements the
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
     * specified secure socket protocol.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
     * <p> A new SSLContext object encapsulating the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
     * SSLContextSpi implementation from the specified Provider
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
     * object is returned.  Note that the specified Provider object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
     * does not have to be registered in the provider list.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
     * @param protocol the standard name of the requested protocol.
8152
94e5966bdf22 5001004: Required Security Algorithms need to be defined
mullan
parents: 5820
diff changeset
   214
     *          See the SSLContext section in the <a href=
94e5966bdf22 5001004: Required Security Algorithms need to be defined
mullan
parents: 5820
diff changeset
   215
     * "{@docRoot}/../technotes/guides/security/StandardNames.html#SSLContext">
94e5966bdf22 5001004: Required Security Algorithms need to be defined
mullan
parents: 5820
diff changeset
   216
     *          Java Cryptography Architecture Standard Algorithm Name
94e5966bdf22 5001004: Required Security Algorithms need to be defined
mullan
parents: 5820
diff changeset
   217
     *          Documentation</a>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
     *          for information about standard protocol names.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
     * @param provider an instance of the provider.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
     *
30904
ec0224270f90 8043758: Datagram Transport Layer Security (DTLS)
xuelei
parents: 25859
diff changeset
   222
     * @return the new {@code SSLContext} object.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
     *
12557
30cadbf1ecbd 7158688: Typo in SSLContext Spec
xuelei
parents: 9035
diff changeset
   224
     * @throws NoSuchAlgorithmException if a SSLContextSpi
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
     *          implementation for the specified protocol is not available
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
     *          from the specified Provider object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
     *
12557
30cadbf1ecbd 7158688: Typo in SSLContext Spec
xuelei
parents: 9035
diff changeset
   228
     * @throws IllegalArgumentException if the provider is null.
473
80bf10b052ee 6546639: (spec)javax.net.ssl.SSLContext.getInstance(null) throws undocumented NPE
xuelei
parents: 2
diff changeset
   229
     * @throws NullPointerException if protocol is null.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
     * @see java.security.Provider
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
    public static SSLContext getInstance(String protocol, Provider provider)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
            throws NoSuchAlgorithmException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
        GetInstance.Instance instance = GetInstance.getInstance
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
                ("SSLContext", SSLContextSpi.class, protocol, provider);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
        return new SSLContext((SSLContextSpi)instance.impl, instance.provider,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
                protocol);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
    /**
30904
ec0224270f90 8043758: Datagram Transport Layer Security (DTLS)
xuelei
parents: 25859
diff changeset
   242
     * Returns the protocol name of this {@code SSLContext} object.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
     * <p>This is the same name that was specified in one of the
30904
ec0224270f90 8043758: Datagram Transport Layer Security (DTLS)
xuelei
parents: 25859
diff changeset
   245
     * {@code getInstance} calls that created this
ec0224270f90 8043758: Datagram Transport Layer Security (DTLS)
xuelei
parents: 25859
diff changeset
   246
     * {@code SSLContext} object.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
     *
30904
ec0224270f90 8043758: Datagram Transport Layer Security (DTLS)
xuelei
parents: 25859
diff changeset
   248
     * @return the protocol name of this {@code SSLContext} object.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
    public final String getProtocol() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
        return this.protocol;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
    /**
30904
ec0224270f90 8043758: Datagram Transport Layer Security (DTLS)
xuelei
parents: 25859
diff changeset
   255
     * Returns the provider of this {@code SSLContext} object.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
     *
30904
ec0224270f90 8043758: Datagram Transport Layer Security (DTLS)
xuelei
parents: 25859
diff changeset
   257
     * @return the provider of this {@code SSLContext} object
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
    public final Provider getProvider() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
        return this.provider;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
     * Initializes this context. Either of the first two parameters
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
     * may be null in which case the installed security providers will
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
     * be searched for the highest priority implementation of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
     * appropriate factory. Likewise, the secure random parameter may
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
     * be null in which case the default implementation will be used.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
     * Only the first instance of a particular key and/or trust manager
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
     * implementation type in the array is used.  (For example, only
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
     * the first javax.net.ssl.X509KeyManager in the array will be used.)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
     * @param km the sources of authentication keys or null
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
     * @param tm the sources of peer authentication trust decisions or null
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
     * @param random the source of randomness for this generator or null
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
     * @throws KeyManagementException if this operation fails
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
    public final void init(KeyManager[] km, TrustManager[] tm,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
                                SecureRandom random)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
        throws KeyManagementException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
        contextSpi.engineInit(km, tm, random);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
    /**
30904
ec0224270f90 8043758: Datagram Transport Layer Security (DTLS)
xuelei
parents: 25859
diff changeset
   286
     * Returns a {@code SocketFactory} object for this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
     * context.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
     *
30904
ec0224270f90 8043758: Datagram Transport Layer Security (DTLS)
xuelei
parents: 25859
diff changeset
   289
     * @return the {@code SocketFactory} object
ec0224270f90 8043758: Datagram Transport Layer Security (DTLS)
xuelei
parents: 25859
diff changeset
   290
     * @throws UnsupportedOperationException if the underlying provider
ec0224270f90 8043758: Datagram Transport Layer Security (DTLS)
xuelei
parents: 25859
diff changeset
   291
     *         does not implement the operation.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
     * @throws IllegalStateException if the SSLContextImpl requires
30904
ec0224270f90 8043758: Datagram Transport Layer Security (DTLS)
xuelei
parents: 25859
diff changeset
   293
     *         initialization and the {@code init()} has not been called
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
    public final SSLSocketFactory getSocketFactory() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
        return contextSpi.engineGetSocketFactory();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
    /**
30904
ec0224270f90 8043758: Datagram Transport Layer Security (DTLS)
xuelei
parents: 25859
diff changeset
   300
     * Returns a {@code ServerSocketFactory} object for
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
     * this context.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
     *
30904
ec0224270f90 8043758: Datagram Transport Layer Security (DTLS)
xuelei
parents: 25859
diff changeset
   303
     * @return the {@code ServerSocketFactory} object
ec0224270f90 8043758: Datagram Transport Layer Security (DTLS)
xuelei
parents: 25859
diff changeset
   304
     * @throws UnsupportedOperationException if the underlying provider
ec0224270f90 8043758: Datagram Transport Layer Security (DTLS)
xuelei
parents: 25859
diff changeset
   305
     *         does not implement the operation.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
     * @throws IllegalStateException if the SSLContextImpl requires
30904
ec0224270f90 8043758: Datagram Transport Layer Security (DTLS)
xuelei
parents: 25859
diff changeset
   307
     *         initialization and the {@code init()} has not been called
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
    public final SSLServerSocketFactory getServerSocketFactory() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
        return contextSpi.engineGetServerSocketFactory();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
    /**
30904
ec0224270f90 8043758: Datagram Transport Layer Security (DTLS)
xuelei
parents: 25859
diff changeset
   314
     * Creates a new {@code SSLEngine} using this context.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
     * Applications using this factory method are providing no hints
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
     * for an internal session reuse strategy. If hints are desired,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
     * {@link #createSSLEngine(String, int)} should be used
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
     * instead.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
     * Some cipher suites (such as Kerberos) require remote hostname
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
     * information, in which case this factory method should not be used.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
     *
30904
ec0224270f90 8043758: Datagram Transport Layer Security (DTLS)
xuelei
parents: 25859
diff changeset
   324
     * @return  the {@code SSLEngine} object
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
     * @throws  UnsupportedOperationException if the underlying provider
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
     *          does not implement the operation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
     * @throws  IllegalStateException if the SSLContextImpl requires
30904
ec0224270f90 8043758: Datagram Transport Layer Security (DTLS)
xuelei
parents: 25859
diff changeset
   328
     *          initialization and the {@code init()} has not been called
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
     * @since   1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
    public final SSLEngine createSSLEngine() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
            return contextSpi.engineCreateSSLEngine();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
        } catch (AbstractMethodError e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
            UnsupportedOperationException unsup =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
                new UnsupportedOperationException(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
                    "Provider: " + getProvider() +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
                    " doesn't support this operation");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
            unsup.initCause(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
            throw unsup;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
    /**
30904
ec0224270f90 8043758: Datagram Transport Layer Security (DTLS)
xuelei
parents: 25859
diff changeset
   345
     * Creates a new {@code SSLEngine} using this context using
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
     * advisory peer information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
     * Applications using this factory method are providing hints
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
     * for an internal session reuse strategy.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
     * Some cipher suites (such as Kerberos) require remote hostname
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
     * information, in which case peerHost needs to be specified.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
     * @param   peerHost the non-authoritative name of the host
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
     * @param   peerPort the non-authoritative port
30904
ec0224270f90 8043758: Datagram Transport Layer Security (DTLS)
xuelei
parents: 25859
diff changeset
   356
     * @return  the new {@code SSLEngine} object
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
     * @throws  UnsupportedOperationException if the underlying provider
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
     *          does not implement the operation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
     * @throws  IllegalStateException if the SSLContextImpl requires
30904
ec0224270f90 8043758: Datagram Transport Layer Security (DTLS)
xuelei
parents: 25859
diff changeset
   360
     *          initialization and the {@code init()} has not been called
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
     * @since   1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
    public final SSLEngine createSSLEngine(String peerHost, int peerPort) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
            return contextSpi.engineCreateSSLEngine(peerHost, peerPort);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
        } catch (AbstractMethodError e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
            UnsupportedOperationException unsup =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
                new UnsupportedOperationException(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
                    "Provider: " + getProvider() +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
                    " does not support this operation");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
            unsup.initCause(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
            throw unsup;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
     * Returns the server session context, which represents the set of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
     * SSL sessions available for use during the handshake phase of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
     * server-side SSL sockets.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
     * This context may be unavailable in some environments, in which
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
     * case this method returns null. For example, when the underlying
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
     * SSL provider does not provide an implementation of SSLSessionContext
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
     * interface, this method returns null. A non-null session context
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
     * is returned otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
     * @return server session context bound to this SSL context
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
    public final SSLSessionContext getServerSessionContext() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
        return contextSpi.engineGetServerSessionContext();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
     * Returns the client session context, which represents the set of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
     * SSL sessions available for use during the handshake phase of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
     * client-side SSL sockets.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
     * This context may be unavailable in some environments, in which
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
     * case this method returns null. For example, when the underlying
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
     * SSL provider does not provide an implementation of SSLSessionContext
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
     * interface, this method returns null. A non-null session context
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
     * is returned otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
     * @return client session context bound to this SSL context
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
    public final SSLSessionContext getClientSessionContext() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
        return contextSpi.engineGetClientSessionContext();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
     * Returns a copy of the SSLParameters indicating the default
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
     * settings for this SSL context.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
     * <p>The parameters will always have the ciphersuites and protocols
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
     * arrays set to non-null values.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
     * @return a copy of the SSLParameters object with the default settings
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
     * @throws UnsupportedOperationException if the default SSL parameters
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
     *   could not be obtained.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
    public final SSLParameters getDefaultSSLParameters() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
        return contextSpi.engineGetDefaultSSLParameters();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
     * Returns a copy of the SSLParameters indicating the supported
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
     * settings for this SSL context.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
     * <p>The parameters will always have the ciphersuites and protocols
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
     * arrays set to non-null values.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
     * @return a copy of the SSLParameters object with the supported
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
     *   settings
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
     * @throws UnsupportedOperationException if the supported SSL parameters
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
     *   could not be obtained.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
    public final SSLParameters getSupportedSSLParameters() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
        return contextSpi.engineGetSupportedSSLParameters();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
}