Stay organized with collections
    
    
      
      Save and categorize content based on your preferences.
    
  
  
    
  
  
  
  
    
    
    
  
  
    
    
  
  
SSLSockets
  public
  
  
  
  class
  SSLSockets
  
    extends Object
  
  
  
  
  
  
  
    
  Static utility methods for accessing additional functionality of supported instances of
 SSLSocket.  Sockets from the platform TLS provider will be compatible with all
 methods in this class.
Summary
| Inherited methods | 
|---|
| 
    From class
      
        
          java.lang.Object
        
      
      
  
  
  
    | 
        
        
        
        
        
        Object | 
      clone()
      Creates and returns a copy of this object.
        
    
 |  
  
  
    | 
        
        
        
        
        
        boolean | 
      equals(Object obj)
      Indicates whether some other object is "equal to" this one.
        
    
 |  
  
  
    | 
        
        
        
        
        
        void | 
      finalize()
      Called by the garbage collector on an object when garbage collection
 determines that there are no more references to the object.
        
    
 |  
  
  
    | 
        
        
        
        final
        
        Class<?> | 
      getClass()
      Returns the runtime class of this Object. |  
  
  
    | 
        
        
        
        
        
        int | 
      hashCode()
      Returns a hash code value for the object.
        
    
 |  
  
  
    | 
        
        
        
        final
        
        void | 
      notify()
      Wakes up a single thread that is waiting on this object's
 monitor.
        
    
 |  
  
  
    | 
        
        
        
        final
        
        void | 
      notifyAll()
      Wakes up all threads that are waiting on this object's monitor.
        
    
 |  
  
  
    | 
        
        
        
        
        
        String | 
      toString()
      Returns a string representation of the object.
        
    
 |  
  
  
    | 
        
        
        
        final
        
        void | 
      wait(long timeoutMillis, int nanos)
      Causes the current thread to wait until it is awakened, typically
 by being notified or interrupted, or until a
 certain amount of real time has elapsed.
        
    
 |  
  
  
    | 
        
        
        
        final
        
        void | 
      wait(long timeoutMillis)
      Causes the current thread to wait until it is awakened, typically
 by being notified or interrupted, or until a
 certain amount of real time has elapsed.
        
    
 |  
  
  
    | 
        
        
        
        final
        
        void | 
      wait()
      Causes the current thread to wait until it is awakened, typically
 by being notified or interrupted.
        
    
 |  | 
Public methods
    exportKeyingMaterial
    
public static byte[] exportKeyingMaterial (SSLSocket socket, 
                String label, 
                byte[] context, 
                int length)
    
    
    
  Exports a value derived from the TLS master secret as described in RFC 5705.
 A number of protocols leverage Transport Layer Security (TLS) to perform key
 establishment but then use some of the keying material for their own purposes.
 This method allows an application to export keying material from a TLS connection.
 The exported material will be the same on the client and server if they pass in
 the same values for label and context.  See RFC 5705 for further
 details.
    
    | Parameters | 
|---|
      
        | socket | SSLSocket: the socket to use for exporting keying material
 This value cannot benull. | 
      
        | label | String: the label to use in calculating the exported value.  This must be
 an ASCII-only string.
 This value cannot benull. | 
      
        | context | byte: the application-specific context value to use in calculating the
 exported value.  This may benullto use no application context, which is
 treated differently than an empty byte array. | 
      
        | length | int: the number of bytes of keying material to return. | 
    
    
      | Returns | 
|---|
      
        | byte[] | a value of the specified length, or nullif the handshake has not yet
 completed or the connection has been closed. | 
    
      
  
 
    isSupportedSocket
    
public static boolean isSupportedSocket (SSLSocket socket)
    
    
    
  Returns whether the given socket can be used with the methods in this class.  In general,
 only sockets from the platform TLS provider are supported.
    
    | Parameters | 
|---|
      
        | socket | SSLSocket: This value cannot benull. | 
    
    
 
    setUseSessionTickets
    
public static void setUseSessionTickets (SSLSocket socket, 
                boolean useSessionTickets)
    
    
    
  Enables or disables the use of session tickets.
 
This function must be called before the handshake is started or it will have no effect.
    
    | Parameters | 
|---|
      
        | socket | SSLSocket: the socket
 This value cannot benull. | 
      
        | useSessionTickets | boolean: whether to enable or disable the use of session tickets | 
    
      
  
 
 
 
  
  
    
  
 
  
    
      
      
    
    
      
    
    
  
       
    
    
      
    
  
  
  Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
  Last updated 2025-02-10 UTC.
  
  
  
    
      [[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[]]