class:SSLParameters [CHANGED]



  • public class SSLParameters
    extends Object
    
    Encapsulates parameters for an SSL/TLS connection. The parameters are the list of ciphersuites to be accepted in an SSL/TLS handshake, the list of protocols to be allowed, the endpoint identification algorithm during SSL/TLS handshaking, the Server Name Indication (SNI), the algorithm constraints and whether SSL/TLS servers should request or require client authentication, etc.

    SSLParameters can be created via the constructors in this class. Objects can also be obtained using the getSSLParameters() methods in SSLSocket and SSLServerSocket and SSLEngine or the getDefaultSSLParameters() and getSupportedSSLParameters() methods in SSLContext.

    SSLParameters can be applied to a connection via the methods SSLSocket.setSSLParameters() and SSLServerSocket.setSSLParameters() and SSLEngine.setSSLParameters().

    For example:

         
    SSLParameters p = sslSocket.getSSLParameters();
         p.setProtocols(new String[] { "TLSv1.2" });
         p.setCipherSuites(
             new String[] { "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256", ... });
         p.setApplicationProtocols(new String[] {"h2", "http/1.1"});
         sslSocket.setSSLParameters(p);
     
    
    *
    Since:
    1.6
    See Also:
    SSLSocket, SSLEngine, SSLContext


  • public class SSLParameters
    extends Object
    
    Encapsulates parameters for an SSL/TLS connection. The parameters are the list of ciphersuites to be accepted in an SSL/TLS handshake, the list of protocols to be allowed, the endpoint identification algorithm during SSL/TLS handshaking, the Server Name Indication (SNI), the algorithm constraints and whether SSL/TLS servers should request or require client authentication, etc.

    SSLParameters can be created via the constructors in this class. Objects can also be obtained using the getSSLParameters() methods in SSLSocket and SSLServerSocket and SSLEngine or the getDefaultSSLParameters() and getSupportedSSLParameters() methods in SSLContext.

    SSLParameters can be applied to a connection via the methods SSLSocket.setSSLParameters() and SSLServerSocket.setSSLParameters() and SSLEngine.setSSLParameters().

    For example:

         SSLParameters p = sslSocket.getSSLParameters();
         p.setProtocols(new String[] { "TLSv1.2" });
         p.setCipherSuites(
             new String[] { "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256", ... });
         p.setApplicationProtocols(new String[] {"h2", "http/1.1"});
         sslSocket.setSSLParameters(p);
     
    *
    Since:
    1.6
    See Also:
    SSLSocket, SSLEngine, SSLContext

method:setEndpointIdentificationAlgorithm(java.lang.String) [NONE]

  • setEndpointIdentificationAlgorithm

    public void setEndpointIdentificationAlgorithm(String algorithm)
    Sets the endpoint identification algorithm.

    If the algorithm parameter is non-null or non-empty, the endpoint identification/verification procedures must be handled during SSL/TLS handshaking. This is to prevent man-in-the-middle attacks.

    Parameters:
    algorithm - The standard string name of the endpoint identification algorithm (or null). See Appendix A in the Java Cryptography Architecture API Specification & Reference for information about standard algorithm names.
    Since:
    1.7
    See Also:
    X509ExtendedTrustManager

method:getApplicationProtocols() [ADDED]

  • getApplicationProtocols

    public String[] getApplicationProtocols()
    
    Returns a prioritized array of application-layer protocol names that can be negotiated over the SSL/TLS/DTLS protocols.

    The array could be empty (zero-length), in which case protocol indications will not be used.

    This method will return a new array each time it is invoked.

    Returns:
    a non-null, possibly zero-length array of application protocol Strings. The array is ordered based on protocol preference, with protocols[0] being the most preferred.
    Since:
    8
    See Also:
    setApplicationProtocols(java.lang.String[])

method:setApplicationProtocols(java.lang.String[]) [ADDED]

  • setApplicationProtocols

    public void setApplicationProtocols(String[] protocols)
    
    Sets the prioritized array of application-layer protocol names that can be negotiated over the SSL/TLS/DTLS protocols.

    If application-layer protocols are supported by the underlying SSL/TLS implementation, this method configures which values can be negotiated by protocols such as RFC 7301 , the Application Layer Protocol Negotiation (ALPN).

    If this end of the connection is expected to offer application protocol values, all protocols configured by this method will be sent to the peer.

    If this end of the connection is expected to select the application protocol value, the protocols configured by this method are compared with those sent by the peer. The first matched value becomes the negotiated value. If none of the protocols were actually requested by the peer, the underlying protocol will determine what action to take. (For example, ALPN will send a "no_application_protocol" alert and terminate the connection.)

    Implementation Requirements:
    This method will make a copy of the protocols array.
    Parameters:
    protocols - an ordered array of application protocols, with protocols[0] being the most preferred. If the array is empty (zero-length), protocol indications will not be used.
    Throws:
    IllegalArgumentException - if protocols is null, or if any element in a non-empty array is null or an empty (zero-length) string
    Since:
    8
    See Also:
    getApplicationProtocols()

© 2019 Oracle Corporation and/or its affiliates