Geen cache-versie.

Caching uitgeschakeld. Standaardinstelling voor deze pagina:ingeschakeld (code LNG204)
Als het scherm te langzaam is, kunt u de gebruikersmodus uitschakelen om de cacheversie te bekijken.
javax.net.ssl

Class SSLContext


  • public class SSLContext
    extends Object
    Instances of this class represent a secure socket protocol implementation which acts as a factory for secure socket factories or SSLEngines. This class is initialized with an optional set of key and trust managers and source of secure random bytes.

    Every implementation of the Java platform is required to support the following standard SSLContext protocol:

    • TLSv1
    This protocol is described in the SSLContext section of the Java Cryptography Architecture Standard Algorithm Name Documentation. Consult the release documentation for your implementation to see if any other algorithms are supported.
    Since:
    1.4
    • Constructor Detail

      • SSLContext

        protected SSLContext(SSLContextSpi contextSpi,
                  Provider provider,
                  String protocol)
        Creates an SSLContext object.
        Parameters:
        contextSpi - the delegate
        provider - the provider
        protocol - the protocol
    • Method Detail

      • setDefault

        public static void setDefault(SSLContext context)
        Sets the default SSL context. It will be returned by subsequent calls to getDefault(). The default context must be immediately usable and not require initialization.
        Parameters:
        context - the SSLContext
        Throws:
        NullPointerException - if context is null
        SecurityException - if a security manager exists and its checkPermission method does not allow SSLPermission("setDefaultSSLContext")
        Since:
        1.6
      • getInstance

        public static SSLContext getInstance(String protocol)
                                      throws NoSuchAlgorithmException
        Returns a SSLContext object that implements the specified secure socket protocol.

        This method traverses the list of registered security Providers, starting with the most preferred Provider. A new SSLContext object encapsulating the SSLContextSpi implementation from the first Provider that supports the specified protocol is returned.

        Note that the list of registered providers may be retrieved via the Security.getProviders() method.

        Parameters:
        protocol - the standard name of the requested protocol. See the SSLContext section in the Java Cryptography Architecture Standard Algorithm Name Documentation for information about standard protocol names.
        Returns:
        the new SSLContext object.
        Throws:
        NoSuchAlgorithmException - if no Provider supports a TrustManagerFactorySpi implementation for the specified protocol.
        NullPointerException - if protocol is null.
        See Also:
        Provider
      • getInstance

        public static SSLContext getInstance(String protocol,
                             Provider provider)
                                      throws NoSuchAlgorithmException
        Returns a SSLContext object that implements the specified secure socket protocol.

        A new SSLContext object encapsulating the SSLContextSpi implementation from the specified Provider object is returned. Note that the specified Provider object does not have to be registered in the provider list.

        Parameters:
        protocol - the standard name of the requested protocol. See the SSLContext section in the Java Cryptography Architecture Standard Algorithm Name Documentation for information about standard protocol names.
        provider - an instance of the provider.
        Returns:
        the new SSLContext object.
        Throws:
        NoSuchAlgorithmException - if a KeyManagerFactorySpi implementation for the specified protocol is not available from the specified Provider object.
        IllegalArgumentException - if the provider name is null.
        NullPointerException - if protocol is null.
        See Also:
        Provider
      • getProtocol

        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.
      • getProvider

        public final Provider getProvider()
        Returns the provider of this SSLContext object.
        Returns:
        the provider of this SSLContext object
      • init

        public final void init(KeyManager[] km,
                TrustManager[] tm,
                SecureRandom random)
                        throws KeyManagementException
        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.

        Only the first instance of a particular key and/or trust manager implementation type in the array is used. (For example, only the first javax.net.ssl.X509KeyManager in the array 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
        Throws:
        KeyManagementException - if this operation fails
      • getSocketFactory

        public final SSLSocketFactory getSocketFactory()
        Returns a SocketFactory object for this context.
        Returns:
        the SocketFactory object
        Throws:
        IllegalStateException - if the SSLContextImpl requires initialization and the init() has not been called
      • getServerSocketFactory

        public final SSLServerSocketFactory getServerSocketFactory()
        Returns a ServerSocketFactory object for this context.
        Returns:
        the ServerSocketFactory object
        Throws:
        IllegalStateException - if the SSLContextImpl requires initialization and the init() has not been called
      • createSSLEngine

        public final SSLEngine createSSLEngine()
        Creates a new SSLEngine using this context.

        Applications using this factory method are providing no hints for an internal session reuse strategy. If hints are desired, createSSLEngine(String, int) should be used instead.

        Some cipher suites (such as Kerberos) require remote hostname information, in which case this factory method should not be used.

        Returns:
        the SSLEngine object
        Throws:
        UnsupportedOperationException - if the underlying provider does not implement the operation.
        IllegalStateException - if the SSLContextImpl requires initialization and the init() has not been called
        Since:
        1.5
      • createSSLEngine

        public final SSLEngine createSSLEngine(String peerHost,
                                int peerPort)
        Creates a new SSLEngine using this context using advisory peer information.

        Applications using this factory method are providing hints for an internal session reuse strategy.

        Some cipher suites (such as Kerberos) require remote hostname information, in which case peerHost needs to be specified.

        Parameters:
        peerHost - the non-authoritative name of the host
        peerPort - the non-authoritative port
        Returns:
        the new SSLEngine object
        Throws:
        UnsupportedOperationException - if the underlying provider does not implement the operation.
        IllegalStateException - if the SSLContextImpl requires initialization and the init() has not been called
        Since:
        1.5
      • getServerSessionContext

        public final SSLSessionContext getServerSessionContext()
        Returns the server session context, which represents the set of SSL sessions available for use during the handshake phase of server-side SSL sockets.

        This context may be unavailable in some environments, in which case this method returns null. For example, when the underlying SSL provider does not provide an implementation of SSLSessionContext interface, this method returns null. A non-null session context is returned otherwise.

        Returns:
        server session context bound to this SSL context
      • getClientSessionContext

        public final SSLSessionContext getClientSessionContext()
        Returns the client session context, which represents the set of SSL sessions available for use during the handshake phase of client-side SSL sockets.

        This context may be unavailable in some environments, in which case this method returns null. For example, when the underlying SSL provider does not provide an implementation of SSLSessionContext interface, this method returns null. A non-null session context is returned otherwise.

        Returns:
        client session context bound to this SSL context
      • getDefaultSSLParameters

        public final SSLParameters getDefaultSSLParameters()
        Returns a copy of the SSLParameters indicating the default settings for this SSL context.

        The parameters will always have the ciphersuites and protocols arrays set to non-null values.

        Returns:
        a copy of the SSLParameters object with the default settings
        Throws:
        UnsupportedOperationException - if the default SSL parameters could not be obtained.
        Since:
        1.6
      • getSupportedSSLParameters

        public final SSLParameters getSupportedSSLParameters()
        Returns a copy of the SSLParameters indicating the supported settings for this SSL context.

        The parameters will always have the ciphersuites and protocols arrays set to non-null values.

        Returns:
        a copy of the SSLParameters object with the supported settings
        Throws:
        UnsupportedOperationException - if the supported SSL parameters could not be obtained.
        Since:
        1.6

Nederlandse vertaling

U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.

Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.

Bij voorbaat dank.

Document heeft de 11/06/2005 gemaakt, de laatste keer de 04/03/2020 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/java-api-rf-javax/net/ssl/sslcontext.html

De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.

Referenties

  1. Bekijk - html-document Taal van het document:fr Manuel PHP : https://docs.oracle.com

Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur Deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.

Inhoudsopgave Haut