public class

SSLContext

extends Object
java.lang.Object
   ↳ com.sun.net.ssl.SSLContext

This class is deprecated.
As of JDK 1.4, this implementation-specific class was replaced by SSLContext.

Class Overview

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.

Summary

Protected Constructors
SSLContext(SSLContextSpi contextSpi, Provider provider, String protocol)
Creates an SSLContext object.
Public Methods
static SSLContext getInstance(String protocol, String provider)
Generates a SSLContext object that implements the specified secure socket protocol.
static SSLContext getInstance(String protocol, Provider provider)
Generates a SSLContext object that implements the specified secure socket protocol.
static SSLContext getInstance(String protocol)
Generates a SSLContext object that implements the specified secure socket protocol.
final String getProtocol()
Returns the protocol name of this SSLContext object.
final Provider getProvider()
Returns the provider of this SSLContext object.
final SSLServerSocketFactory getServerSocketFactory()
Returns a ServerSocketFactory object for this context.
final SSLSocketFactory getSocketFactory()
Returns a SocketFactory object for this context.
final void init(KeyManager[] km, TrustManager[] tm, SecureRandom random)
Initializes this context.
[Expand]
Inherited Methods
From class java.lang.Object

Protected Constructors

protected SSLContext (SSLContextSpi contextSpi, Provider provider, String protocol)

Creates an SSLContext object.

Parameters
contextSpi the delegate
provider the provider

Public Methods

public static SSLContext getInstance (String protocol, String provider)

Generates a SSLContext object that implements the specified secure socket protocol.

Parameters
protocol the standard name of the requested protocol.
provider the name of the provider
Returns
  • the new SSLContext object
Throws
NoSuchAlgorithmException if the specified protocol is not available from the specified provider.
NoSuchProviderException if the specified provider has not been configured.

public static SSLContext getInstance (String protocol, Provider provider)

Generates a SSLContext object that implements the specified secure socket protocol.

Parameters
protocol the standard name of the requested protocol.
provider an instance of the provider
Returns
  • the new SSLContext object
Throws
NoSuchAlgorithmException if the specified protocol is not available from the specified provider.

public static SSLContext getInstance (String protocol)

Generates a SSLContext object that implements the specified secure socket protocol.

Parameters
protocol the standard name of the requested protocol.
Returns
  • the new SSLContext object
Throws
NoSuchAlgorithmException if the specified protocol is not available in the default provider package or any of the other provider packages that were searched.

public final String getProtocol ()

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.

Returns
  • the protocol name of this SSLContext object.

public final Provider getProvider ()

Returns the provider of this SSLContext object.

Returns
  • the provider of this SSLContext object

public final SSLServerSocketFactory getServerSocketFactory ()

Returns a ServerSocketFactory object for this context.

Returns
  • the factory

public final SSLSocketFactory getSocketFactory ()

Returns a SocketFactory object for this context.

Returns
  • the factory

public final void init (KeyManager[] km, TrustManager[] tm, SecureRandom random)

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.

Parameters
km the sources of authentication keys or null
tm the sources of peer authentication trust decisions or null
random the source of randomness for this generator or null