API java : SSLContext


javax.net.ssl
Class SSLContext

java.lang.Object
  extended by javax.net.ssl.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.

Since:
1.4

Constructor Summary
protected SSLContext(SSLContextSpi contextSpi, Provider provider, String protocol)
          Creates an SSLContext object.
 
Method Summary
 SSLEngine createSSLEngine()
          Creates a new SSLEngine using this context.
 SSLEngine createSSLEngine(String peerHost, int peerPort)
          Creates a new SSLEngine using this context using advisory peer information.
 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.
static SSLContext getInstance(String protocol)
          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 from the specified provider.
static SSLContext getInstance(String protocol, String provider)
          Generates a SSLContext object that implements the specified secure socket protocol from the specified provider.
 String getProtocol()
          Returns the protocol name of this SSLContext object.
 Provider getProvider()
          Returns the provider of this SSLContext object.
 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.
 SSLServerSocketFactory getServerSocketFactory()
          Returns a ServerSocketFactory object for this context.
 SSLSocketFactory getSocketFactory()
          Returns a SocketFactory object for this context.
 void init(KeyManager[] km, TrustManager[] tm, SecureRandom random)
          Initializes this context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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

getInstance

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

If the default provider package provides an implementation of the requested key management algorithm, an instance of SSLContext containing that implementation is returned. If the algorithm is not available in the default provider package, other provider packages are searched.

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.

getInstance

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

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.
IllegalArgumentException - if the provider name is null or empty.

getInstance

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

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.
IllegalArgumentException - if the provider name is null.

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

getServerSocketFactory

public final SSLServerSocketFactory getServerSocketFactory()
Returns a ServerSocketFactory object for this context.

Returns:
the ServerSocketFactory object

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

Ces informations proviennent du site de http://java.sun.com

Remarques

Contenu

Le contenu de cette page provient du site de Sun, et est généré depuis un cache sur l'infobrol après certains traitements automatisés. La présentation peut donc différer du document original, mais le contenu aussi. Vous pouvez utiliser ce bouton pour afficher la page originale du site de Sun :

Quels sont les motivations de cette démarche?

Maintenir les pages en cache sur différents sites peut offrir plus de disponibilité.

Chaque page est indexée dans la base de donnée, ce qui permet de retrouver facilement les informations, au moyen des sommaires, du moteur de recherche interne, etc.

Des facilités sont mises en place pour que les membres de l'infobrol puissent effectuer des traductions en français des différents documents. Ceci devrait permettre aux débutants en programmation Java de consulter les API en français s'ils maîtrisent moins bien la langue de Shakespeare. Dans le cas où une traduction a été soumise, elle est disponible au moyen d'un lien en bas de page. Si la traduction a été validée, la page s'affiche par défaut en français, et un lien en bas de page permet d'atteindre la version en anglais.

Le code sur l'infobrol est automatiquement coloré selon la syntaxe, et les différents mots clés sont transformés en liens pour accéder rapidement aux informations.

Vous avez la possibilité de partager vos expériences en proposant vos propres extraits de code en utilisant le bouton "ajouter un commentaire" en bas de page. Si vous visitez simplement l'infobrol, vous avez déjà accès à cette fonction, mais si vous étes membre du brol, vous pouvez en plus utiliser des boutons supplémentaires de mise en forme, dont la coloration automatique de vos extraits de codes.

Réseaux sociaux

Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher les interactions avec les réseaux sociaux sur ces pages.

 

Nuage de mots clés

7 mots clés dont 0 définis manuellement (plus d'information...).

Avertissement

Cette page ne possède pas encore de mots clés manuels, ceci est donc un exemple automatique (les niveaux de pertinence sont fictifs, mais les liens sont valables). Pour tester le nuage avec une page qui contient des mots définis manuellement, vous pouvez cliquer ici.

Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher le nuage de mots clés.

 

Astuce pour imprimer les couleurs des cellules de tableaux : http://www.gaudry.be/ast-rf-450.html
Aucun commentaire pour cette page

© Ce document issu de l′infobrol est enregistré sous le certificat Cyber PrInterDeposit Digital Numbertection. Enregistrement IDDN n° 5329-1448
Document créé le 30/08/06 00:03, dernière modification le Vendredi 17 Juin 2011, 12:12
Source du document imprimé : http://www.gaudry.be/java-api-rf-javax/net/ssl/SSLContext.html Document affiché 1 fois ce mois de Juin.
St.Gaudry©07.01.02
Outils (masquer)
||
Recherche (afficher)
Recherche :

Utilisateur (masquer)
Apparence (afficher)
Stats (afficher)
15832 documents
452 astuces.
549 niouzes.
3099 definitions.
447 membres.
8115 messages.

Document genere en :
0,41 seconde

Mises à jour :
Mises à jour du site
Citation (masquer)
Quand on renie le passé on perd l'avenir.

Dulce Maria Cardoso [Extrait de Les Anges, Violeta]
 
l'infobrol
Nous sommes le Samedi 02 Juin 2012, 01:52, toutes les heures sont au format GMT+1.00 Heure, heure d'été (+1)