public interface SSLSession
In SSL, sessions are used to describe an ongoing relationship between
two entities. Each SSL connection involves one session at a time, but
that session may be used on many connections between those entities,
simultaneously or sequentially. The session used on a connection may
also be replaced by a different session. Sessions are created, or
rejoined, as part of the SSL handshaking protocol. Sessions may be
invalidated due to policies affecting security or resource usage,
or by an application explicitly calling invalidate.
Session management policies are typically used to tune performance.
In addition to the standard session attributes, SSL sessions expose these read-only attributes:
Sessions may be explicitly invalidated. Invalidation may also be done implicitly, when faced with certain kinds of errors.
| Method Summary | |
|---|---|
int |
getApplicationBufferSize()
Gets the size of the largest application buffer that may occur when using this session. |
String |
getCipherSuite()
Returns the name of the SSL cipher suite which is used for all connections in the session. |
long |
getCreationTime()
Returns the time at which this Session representation was created, in milliseconds since midnight, January 1, 1970 UTC. |
byte[] |
getId()
Returns the identifier assigned to this Session. |
long |
getLastAccessedTime()
Returns the last time this Session representation was accessed by the session level infrastructure, in milliseconds since midnight, January 1, 1970 UTC. |
Certificate[] |
getLocalCertificates()
Returns the certificate(s) that were sent to the peer during handshaking. |
Principal |
getLocalPrincipal()
Returns the principal that was sent to the peer during handshaking. |
int |
getPacketBufferSize()
Gets the size of the largest SSL/TLS packet that may occur when using this session. |
X509Certificate[] |
getPeerCertificateChain()
Returns the identity of the peer which was identified as part of defining the session. |
Certificate[] |
getPeerCertificates()
Returns the identity of the peer which was established as part of defining the session. |
String |
getPeerHost()
Returns the host name of the peer in this session. |
int |
getPeerPort()
Returns the port number of the peer in this session. |
Principal |
getPeerPrincipal()
Returns the identity of the peer which was established as part of defining the session. |
String |
getProtocol()
Returns the standard name of the protocol used for all connections in the session. |
SSLSessionContext |
getSessionContext()
Returns the context in which this session is bound. |
Object |
getValue(String name)
Returns the object bound to the given name in the session's application layer data. |
String[] |
getValueNames()
Returns an array of the names of all the application layer data objects bound into the Session. |
void |
invalidate()
Invalidates the session. |
boolean |
isValid()
Returns whether this session is valid and available for resuming or joining. |
void |
putValue(String name,
Object value)
Binds the specified value object into the
session's application layer data
with the given name. |
void |
removeValue(String name)
Removes the object bound to the given name in the session's application layer data. |
| Method Detail |
|---|
byte[] getId()
SSLSessionContext getSessionContext()
This context may be unavailable in some environments, in which case this method returns null.
If the context is available and there is a
security manager installed, the caller may require
permission to access it or a security exception may be thrown.
In a Java 2 environment, the security manager's
checkPermission method is called with a
SSLPermission("getSSLSessionContext") permission.
long getCreationTime()
long getLastAccessedTime()
Access indicates a new connection being established using session data. Application level operations, such as getting or setting a value associated with the session, are not reflected in this access time.
This information is particularly useful in session management policies. For example, a session manager thread could leave all sessions in a given context which haven't been used in a long time; or, the sessions might be sorted according to age to optimize some task.
void invalidate()
Future connections will not be able to resume or join this session. However, any existing connection using this session can continue to use the session until the connection is closed.
isValid()boolean isValid()
invalidate()void putValue(String name, Object value)
value object into the
session's application layer data
with the given name.
Any existing binding using the same name is
replaced. If the new (or existing) value implements the
SSLSessionBindingListener interface, the object
represented by value is notified appropriately.
For security reasons, the same named values may not be visible across different access control contexts.
name - the name to which the data object will be bound.
This may not be null.value - the data object to be bound. This may not be null.
IllegalArgumentException - if either argument is null.Object getValue(String name)
For security reasons, the same named values may not be visible across different access control contexts.
name - the name of the binding to find.
IllegalArgumentException - if the argument is null.void removeValue(String name)
SessionBindingListener interface,
it is notified appropriately.
For security reasons, the same named values may not be visible across different access control contexts.
name - the name of the object to remove visible
across different access control contexts
IllegalArgumentException - if the argument is null.String[] getValueNames()
For security reasons, the same named values may not be visible across different access control contexts.
Certificate[] getPeerCertificates() throws SSLPeerUnverifiedException
Note: This method can be used only when using certificate-based cipher suites; using it with non-certificate-based cipher suites, such as Kerberos, will throw an SSLPeerUnverifiedException.
SSLPeerUnverifiedException - if the peer's identity has not
been verifiedgetPeerPrincipal()Certificate[] getLocalCertificates()
Note: This method is useful only when using certificate-based cipher suites.
When multiple certificates are available for use in a handshake, the implementation chooses what it considers the "best" certificate chain available, and transmits that to the other side. This method allows the caller to know which certificate chain was actually used.
getLocalPrincipal()X509Certificate[] getPeerCertificateChain() throws SSLPeerUnverifiedException
Note: This method can be used only when using certificate-based cipher suites; using it with non-certificate-based cipher suites, such as Kerberos, will throw an SSLPeerUnverifiedException.
Note: this method exists for compatibility with previous
releases. New applications should use
getPeerCertificates() instead.
X509Certificate format.)
SSLPeerUnverifiedException - if the peer's identity
has not been verifiedgetPeerPrincipal()Principal getPeerPrincipal() throws SSLPeerUnverifiedException
SSLPeerUnverifiedException - if the peer's identity has not
been verifiedgetPeerCertificates(),
getLocalPrincipal()Principal getLocalPrincipal()
getLocalCertificates(),
getPeerPrincipal()String getCipherSuite()
This defines the level of protection provided to the data sent on the connection, including the kind of encryption used and most aspects of how authentication is done.
String getProtocol()
This defines the protocol used in the connection.
String getPeerHost()
For the server, this is the client's host; and for the client, it is the server's host. The name may not be a fully qualified host name or even a host name at all as it may represent a string encoding of the peer's network address. If such a name is desired, it might be resolved through a name service based on the value returned by this method.
This value is not authenticated and should not be relied upon.
It is mainly used as a hint for SSLSession caching
strategies.
int getPeerPort()
For the server, this is the client's port number; and for the client, it is the server's port number.
This value is not authenticated and should not be relied upon.
It is mainly used as a hint for SSLSession caching
strategies.
int getPacketBufferSize()
A SSLEngine using this session may generate SSL/TLS
packets of any size up to and including the value returned by this
method. All SSLEngine network buffers should be sized
at least this large to avoid insufficient space problems when
performing wrap and unwrap
SSLEngine.wrap(ByteBuffer, ByteBuffer),
SSLEngine.unwrap(ByteBuffer, ByteBuffer)int getApplicationBufferSize()
SSLEngine application data buffers must be large
enough to hold the application data from any inbound network
application data packet received. Typically, outbound
application data buffers can be of any size.
SSLEngine.wrap(ByteBuffer, ByteBuffer),
SSLEngine.unwrap(ByteBuffer, ByteBuffer)Ces informations proviennent du site de http://java.sun.com
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 :
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.
Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher les interactions avec les réseaux sociaux sur ces pages.
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.
Recherche (afficher)
Utilisateur (masquer)
Navigation (masquer)
Apparence (afficher)
Stats (afficher)
Citation (masquer)