final class SSLSessionImpl extends ExtendedSSLSession
Servers have the ability to manage the sessions associated with their authentication context(s). They can do this by enumerating the IDs of the sessions which are cached, examining those sessions, and then perhaps invalidating a given session so that it can't be used again. If servers do not explicitly manage the cache, sessions will linger until memory is low enough that the runtime environment purges cache entries automatically to reclaim space.
The only reason this class is not package-private is that there's no other public way to get at the server session context which is associated with any given authentication context.
| 构造器和说明 |
|---|
SSLSessionImpl() |
SSLSessionImpl(HandshakeContext hc,
CipherSuite cipherSuite) |
SSLSessionImpl(HandshakeContext hc,
CipherSuite cipherSuite,
SessionId id) |
SSLSessionImpl(HandshakeContext hc,
CipherSuite cipherSuite,
SessionId id,
long creationTime) |
SSLSessionImpl(SSLSessionImpl baseSession,
SessionId newId) |
| 限定符和类型 | 方法和说明 |
|---|---|
(专用程序包) void |
addChild(SSLSessionImpl session) |
(专用程序包) SecretKey |
consumePreSharedKey() |
(专用程序包) byte[] |
consumePskIdentity() |
boolean |
equals(Object obj)
Returns true if sessions have same ids, false otherwise.
|
protected void |
expandBufferSizes()
Expand the buffer size of both SSL/TLS network packet and
application data.
|
(专用程序包) SSLSessionImpl |
finish() |
int |
getApplicationBufferSize()
Gets the current size of the largest application data that is
expected when using this session.
|
X509Certificate[] |
getCertificateChain()
Return the cert chain presented by the peer.
|
String |
getCipherSuite()
Returns the name of the cipher suite in use on this session
|
long |
getCreationTime()
Returns the time this session was created.
|
byte[] |
getId()
Returns the ID for this session.
|
(专用程序包) String |
getIdentificationProtocol() |
long |
getLastAccessedTime()
Returns the last time this session was used to initialize
a connection.
|
Certificate[] |
getLocalCertificates()
Return the cert chain presented to the peer in the
java.security.cert format.
|
Principal |
getLocalPrincipal()
Returns the principal that was sent to the peer during handshaking.
|
String[] |
getLocalSupportedSignatureAlgorithms()
Gets an array of supported signature algorithm names that the local
side is willing to verify.
|
Collection<SignatureScheme> |
getLocalSupportedSignatureSchemes()
Gets an array of supported signature schemes that the local side is
willing to verify.
|
(专用程序包) SecretKey |
getMasterSecret()
Returns the master secret ... treat with extreme caution!
|
(专用程序包) int |
getMaximumPacketSize() |
(专用程序包) int |
getNegotiatedMaxFragSize()
Get the negotiated maximum fragment length, as specified by the
max_fragment_length ClientHello extension in RFC 6066.
|
int |
getPacketBufferSize()
Gets the current size of the largest SSL/TLS packet that is expected
when using this session.
|
InetAddress |
getPeerAddress()
Returns the network address of the session's peer.
|
X509Certificate[] |
getPeerCertificateChain()
已过时。
This method returns the deprecated
javax.security.cert.X509Certificate type.
Use getPeerCertificates() instead. |
Certificate[] |
getPeerCertificates()
Return the cert chain presented by the peer in the
java.security.cert format.
|
String |
getPeerHost() |
int |
getPeerPort()
Need to provide the port info for caching sessions based on
host and port.
|
Principal |
getPeerPrincipal()
Returns the identity of the peer which was established as part of
defining the session.
|
String[] |
getPeerSupportedSignatureAlgorithms()
Gets an array of supported signature algorithms that the peer is
able to verify.
|
(专用程序包) SecretKey |
getPreSharedKey() |
String |
getProtocol()
Returns the standard name of the protocol in use on this session
|
(专用程序包) ProtocolVersion |
getProtocolVersion() |
List<SNIServerName> |
getRequestedServerNames()
Obtains a
List containing all SNIServerNames
of the requested Server Name Indication (SNI) extension. |
(专用程序包) SecretKey |
getResumptionMasterSecret() |
SSLSessionContext |
getSessionContext()
For server sessions, this returns the set of sessions which
are currently valid in this process.
|
(专用程序包) SessionId |
getSessionId() |
List<byte[]> |
getStatusResponses()
Return a List of status responses presented by the peer.
|
(专用程序包) CipherSuite |
getSuite()
Returns the cipher spec in use on this session
|
(专用程序包) int |
getTicketAgeAdd() |
long |
getTicketCreationTime() |
Object |
getValue(String key)
Returns the specified session value.
|
String[] |
getValueNames()
Lists the names of the session values.
|
int |
hashCode()
Returns the hashcode for this session
|
(专用程序包) BigInteger |
incrTicketNonceCounter() |
void |
invalidate()
Invalidate a session.
|
private boolean |
isLocalAuthenticationValid()
Check if the authentication used when establishing this session
is still valid.
|
(专用程序包) boolean |
isRejoinable()
Returns true iff this session may be resumed ... sessions are
usually resumable.
|
(专用程序包) boolean |
isSessionResumption()
Return true if the session is currently re-established with a
session-resumption abbreviated initial handshake.
|
boolean |
isValid() |
void |
putValue(String key,
Object value)
Assigns a session value.
|
void |
removeValue(String key)
Removes the specified session value, delivering a session changed
event as appropriate.
|
(专用程序包) void |
setAsSessionResumption(boolean flag)
Resets whether the session is re-established with a session-resumption
abbreviated initial handshake.
|
(专用程序包) void |
setContext(SSLSessionContextImpl ctx) |
(专用程序包) void |
setLastAccessedTime(long time) |
(专用程序包) void |
setLocalCertificates(X509Certificate[] local) |
(专用程序包) void |
setLocalPrincipal(Principal local) |
(专用程序包) void |
setLocalPrivateKey(PrivateKey privateKey) |
(专用程序包) void |
setMasterSecret(SecretKey secret) |
(专用程序包) void |
setMaximumPacketSize(int maximumPacketSize) |
(专用程序包) void |
setNegotiatedMaxFragSize(int negotiatedMaxFragLen)
Sets the negotiated maximum fragment length, as specified by the
max_fragment_length ClientHello extension in RFC 6066.
|
(专用程序包) void |
setPeerCertificates(X509Certificate[] peer) |
(专用程序包) void |
setPeerPrincipal(Principal peer) |
(专用程序包) void |
setPeerSupportedSignatureAlgorithms(Collection<SignatureScheme> signatureSchemes) |
(专用程序包) void |
setPreSharedKey(SecretKey key) |
(专用程序包) void |
setPskIdentity(byte[] pskIdentity) |
(专用程序包) void |
setResumptionMasterSecret(SecretKey secret) |
(专用程序包) void |
setStatusResponses(List<byte[]> responses)
Provide status response data obtained during the SSL handshake.
|
(专用程序包) void |
setSuite(CipherSuite suite)
Resets the cipher spec in use on this session
|
(专用程序包) void |
setTicketAgeAdd(int ticketAgeAdd) |
(专用程序包) void |
setUseDefaultPeerSignAlgs() |
String |
toString()
Returns a string representation of this SSL session
|
private final ProtocolVersion protocolVersion
private final SessionId sessionId
private X509Certificate[] peerCerts
private Principal peerPrincipal
private CipherSuite cipherSuite
private SecretKey masterSecret
final boolean useExtendedMasterSecret
private final long creationTime
private long lastUsedTime
private final String host
private final int port
private SSLSessionContextImpl context
private boolean invalidated
private X509Certificate[] localCerts
private Principal localPrincipal
private PrivateKey localPrivateKey
private final Collection<SignatureScheme> localSupportedSignAlgs
private String[] peerSupportedSignAlgs
private boolean useDefaultPeerSignAlgs
private List<byte[]> statusResponses
private SecretKey resumptionMasterSecret
private SecretKey preSharedKey
private byte[] pskIdentity
private final long ticketCreationTime
private int ticketAgeAdd
private int negotiatedMaxFragLen
private int maximumPacketSize
private final Queue<SSLSessionImpl> childSessions
private boolean isSessionResumption
private static boolean defaultRejoinable
final SNIServerName serverNameIndication
private final List<SNIServerName> requestedServerNames
private BigInteger ticketNonceCounter
private final String identificationProtocol
private final ConcurrentHashMap<SecureKey,Object> boundValues
private boolean acceptLargeFragments
SSLSessionImpl()
SSLSessionImpl(HandshakeContext hc, CipherSuite cipherSuite)
SSLSessionImpl(HandshakeContext hc, CipherSuite cipherSuite, SessionId id)
SSLSessionImpl(HandshakeContext hc, CipherSuite cipherSuite, SessionId id, long creationTime)
SSLSessionImpl(SSLSessionImpl baseSession, SessionId newId)
void setMasterSecret(SecretKey secret)
void setResumptionMasterSecret(SecretKey secret)
void setPreSharedKey(SecretKey key)
void addChild(SSLSessionImpl session)
void setTicketAgeAdd(int ticketAgeAdd)
void setPskIdentity(byte[] pskIdentity)
BigInteger incrTicketNonceCounter()
SecretKey getMasterSecret()
SecretKey getResumptionMasterSecret()
SecretKey getPreSharedKey()
SecretKey consumePreSharedKey()
int getTicketAgeAdd()
String getIdentificationProtocol()
byte[] consumePskIdentity()
void setPeerCertificates(X509Certificate[] peer)
void setPeerPrincipal(Principal peer)
void setLocalCertificates(X509Certificate[] local)
void setLocalPrincipal(Principal local)
void setLocalPrivateKey(PrivateKey privateKey)
void setPeerSupportedSignatureAlgorithms(Collection<SignatureScheme> signatureSchemes)
void setUseDefaultPeerSignAlgs()
SSLSessionImpl finish()
void setStatusResponses(List<byte[]> responses)
responses - a List of responses in binary form.boolean isRejoinable()
public boolean isValid()
private boolean isLocalAuthenticationValid()
public byte[] getId()
public SSLSessionContext getSessionContext()
SessionId getSessionId()
CipherSuite getSuite()
void setSuite(CipherSuite suite)
boolean isSessionResumption()
void setAsSessionResumption(boolean flag)
public String getCipherSuite()
ProtocolVersion getProtocolVersion()
public String getProtocol()
public boolean equals(Object obj)
public Certificate[] getPeerCertificates() throws SSLPeerUnverifiedException
SSLPeerUnverifiedExceptionpublic Certificate[] getLocalCertificates()
@Deprecated public X509Certificate[] getPeerCertificateChain() throws SSLPeerUnverifiedException
javax.security.cert.X509Certificate type.
Use getPeerCertificates() instead.SSLPeerUnverifiedExceptionpublic X509Certificate[] getCertificateChain() throws SSLPeerUnverifiedException
SSLPeerUnverifiedExceptionpublic List<byte[]> getStatusResponses()
List will be returned.List of byte arrays, each consisting
of a DER-encoded OCSP response (see RFC 6960). If no responses have
been presented by the server or non-certificate based server
authentication is used then an empty List is returned.public Principal getPeerPrincipal() throws SSLPeerUnverifiedException
SSLPeerUnverifiedException - if the peer's identity has not
been verifiedpublic Principal getLocalPrincipal()
public long getTicketCreationTime()
public long getCreationTime()
public long getLastAccessedTime()
void setLastAccessedTime(long time)
public InetAddress getPeerAddress()
public String getPeerHost()
public int getPeerPort()
void setContext(SSLSessionContextImpl ctx)
public void invalidate()
public void putValue(String key, Object value)
public void removeValue(String key)
public String[] getValueNames()
protected void expandBufferSizes()
public int getPacketBufferSize()
public int getApplicationBufferSize()
void setNegotiatedMaxFragSize(int negotiatedMaxFragLen)
negotiatedMaxFragLen - the negotiated maximum fragment length, or -1 if
no such length has been negotiated.int getNegotiatedMaxFragSize()
-1 if
no such length has been negotiated.void setMaximumPacketSize(int maximumPacketSize)
int getMaximumPacketSize()
public String[] getLocalSupportedSignatureAlgorithms()
public Collection<SignatureScheme> getLocalSupportedSignatureSchemes()
public String[] getPeerSupportedSignatureAlgorithms()
public List<SNIServerName> getRequestedServerNames()
List containing all SNIServerNames
of the requested Server Name Indication (SNI) extension.Copyright © 2023. All rights reserved.