Package org.conscrypt
Class ExternalSession
- java.lang.Object
-
- org.conscrypt.ExternalSession
-
- All Implemented Interfaces:
javax.net.ssl.SSLSession,ConscryptSession
final class ExternalSession extends java.lang.Object implements ConscryptSession
An externalized view of the underlyingSSLSessionused within a socket/engine. This class provides the caller with a consistent session handle which will continue to be usable regardless of internal changes to the connection. It does this by delegating calls to the current internal session, which is provided by the sessionProvider(i.e. the socket or engine that owns the session). This allows the provider to switch implementations (for instance, using a JNI implementation to access live values while the connection is open and a set of final values when the connection is closed), even if the caller stores a reference to the session object.This class implements the
SSLSessionvalue API itself, rather than delegating to the provided session, to ensure the caller has a consistent value map, regardless of which internal session is currently being used by the socket/engine. This class will never call the value API methods on the underlying sessions, so they need not be implemented.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static interfaceExternalSession.ProviderThe provider of the current delegate session.
-
Field Summary
Fields Modifier and Type Field Description private ExternalSession.Providerproviderprivate java.util.HashMap<java.lang.String,java.lang.Object>values
-
Constructor Summary
Constructors Constructor Description ExternalSession(ExternalSession.Provider provider)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetApplicationBufferSize()java.lang.StringgetApplicationProtocol()java.lang.StringgetCipherSuite()longgetCreationTime()byte[]getId()longgetLastAccessedTime()java.security.cert.Certificate[]getLocalCertificates()java.security.PrincipalgetLocalPrincipal()intgetPacketBufferSize()javax.security.cert.X509Certificate[]getPeerCertificateChain()java.security.cert.X509Certificate[]getPeerCertificates()java.lang.StringgetPeerHost()intgetPeerPort()java.security.PrincipalgetPeerPrincipal()byte[]getPeerSignedCertificateTimestamp()Returns the signed certificate timestamp (SCT) received from the peer.java.lang.StringgetProtocol()java.lang.StringgetRequestedServerName()javax.net.ssl.SSLSessionContextgetSessionContext()java.util.List<byte[]>getStatusResponses()Returns the OCSP stapled response.java.lang.ObjectgetValue(java.lang.String name)java.lang.String[]getValueNames()voidinvalidate()booleanisValid()voidputValue(java.lang.String name, java.lang.Object value)(package private) voidputValue(javax.net.ssl.SSLSession session, java.lang.String name, java.lang.Object value)voidremoveValue(java.lang.String name)(package private) voidremoveValue(javax.net.ssl.SSLSession session, java.lang.String name)
-
-
-
Field Detail
-
values
private final java.util.HashMap<java.lang.String,java.lang.Object> values
-
provider
private final ExternalSession.Provider provider
-
-
Constructor Detail
-
ExternalSession
public ExternalSession(ExternalSession.Provider provider)
-
-
Method Detail
-
getRequestedServerName
public java.lang.String getRequestedServerName()
- Specified by:
getRequestedServerNamein interfaceConscryptSession
-
getStatusResponses
public java.util.List<byte[]> getStatusResponses()
Description copied from interface:ConscryptSessionReturns the OCSP stapled response. Returns a copy of the internal arrays. The method signature matches Java 9.- Specified by:
getStatusResponsesin interfaceConscryptSession- See Also:
- RFC 6066, RFC 6961
-
getPeerSignedCertificateTimestamp
public byte[] getPeerSignedCertificateTimestamp()
Description copied from interface:ConscryptSessionReturns the signed certificate timestamp (SCT) received from the peer. Returns a copy of the internal array.- Specified by:
getPeerSignedCertificateTimestampin interfaceConscryptSession- See Also:
- RFC 6962
-
getId
public byte[] getId()
- Specified by:
getIdin interfacejavax.net.ssl.SSLSession
-
getSessionContext
public javax.net.ssl.SSLSessionContext getSessionContext()
- Specified by:
getSessionContextin interfacejavax.net.ssl.SSLSession
-
getCreationTime
public long getCreationTime()
- Specified by:
getCreationTimein interfacejavax.net.ssl.SSLSession
-
getLastAccessedTime
public long getLastAccessedTime()
- Specified by:
getLastAccessedTimein interfacejavax.net.ssl.SSLSession
-
invalidate
public void invalidate()
- Specified by:
invalidatein interfacejavax.net.ssl.SSLSession
-
isValid
public boolean isValid()
- Specified by:
isValidin interfacejavax.net.ssl.SSLSession
-
getPeerCertificates
public java.security.cert.X509Certificate[] getPeerCertificates() throws javax.net.ssl.SSLPeerUnverifiedException- Specified by:
getPeerCertificatesin interfaceConscryptSession- Specified by:
getPeerCertificatesin interfacejavax.net.ssl.SSLSession- Throws:
javax.net.ssl.SSLPeerUnverifiedException
-
getLocalCertificates
public java.security.cert.Certificate[] getLocalCertificates()
- Specified by:
getLocalCertificatesin interfacejavax.net.ssl.SSLSession
-
getPeerCertificateChain
public javax.security.cert.X509Certificate[] getPeerCertificateChain() throws javax.net.ssl.SSLPeerUnverifiedException- Specified by:
getPeerCertificateChainin interfacejavax.net.ssl.SSLSession- Throws:
javax.net.ssl.SSLPeerUnverifiedException
-
getPeerPrincipal
public java.security.Principal getPeerPrincipal() throws javax.net.ssl.SSLPeerUnverifiedException- Specified by:
getPeerPrincipalin interfacejavax.net.ssl.SSLSession- Throws:
javax.net.ssl.SSLPeerUnverifiedException
-
getLocalPrincipal
public java.security.Principal getLocalPrincipal()
- Specified by:
getLocalPrincipalin interfacejavax.net.ssl.SSLSession
-
getCipherSuite
public java.lang.String getCipherSuite()
- Specified by:
getCipherSuitein interfacejavax.net.ssl.SSLSession
-
getProtocol
public java.lang.String getProtocol()
- Specified by:
getProtocolin interfacejavax.net.ssl.SSLSession
-
getPeerHost
public java.lang.String getPeerHost()
- Specified by:
getPeerHostin interfacejavax.net.ssl.SSLSession
-
getPeerPort
public int getPeerPort()
- Specified by:
getPeerPortin interfacejavax.net.ssl.SSLSession
-
getPacketBufferSize
public int getPacketBufferSize()
- Specified by:
getPacketBufferSizein interfacejavax.net.ssl.SSLSession
-
getApplicationBufferSize
public int getApplicationBufferSize()
- Specified by:
getApplicationBufferSizein interfacejavax.net.ssl.SSLSession
-
getApplicationProtocol
public java.lang.String getApplicationProtocol()
- Specified by:
getApplicationProtocolin interfaceConscryptSession
-
getValue
public java.lang.Object getValue(java.lang.String name)
- Specified by:
getValuein interfacejavax.net.ssl.SSLSession
-
getValueNames
public java.lang.String[] getValueNames()
- Specified by:
getValueNamesin interfacejavax.net.ssl.SSLSession
-
putValue
public void putValue(java.lang.String name, java.lang.Object value)- Specified by:
putValuein interfacejavax.net.ssl.SSLSession
-
putValue
void putValue(javax.net.ssl.SSLSession session, java.lang.String name, java.lang.Object value)
-
removeValue
public void removeValue(java.lang.String name)
- Specified by:
removeValuein interfacejavax.net.ssl.SSLSession
-
removeValue
void removeValue(javax.net.ssl.SSLSession session, java.lang.String name)
-
-