Package org.conscrypt
Class NativeSslSession
java.lang.Object
org.conscrypt.NativeSslSession
- Direct Known Subclasses:
NativeSslSession.Impl
A utility wrapper that abstracts operations on the underlying native SSL_SESSION instance.
This is abstract only to support mocking for tests.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final class
The session wrapper implementation. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static void
checkRemaining
(ByteBuffer buf, int length) (package private) abstract String
(package private) abstract byte[]
getId()
private static byte[]
getOcspResponse
(ConscryptSession session) (package private) abstract String
(package private) abstract byte[]
Returns the OCSP stapled response.(package private) abstract int
(package private) abstract byte[]
Returns the signed certificate timestamp (SCT) received from the peer.(package private) abstract String
(package private) abstract boolean
Returns whether this session should only ever be used for resumption once.(package private) abstract boolean
isValid()
private static void
(package private) static NativeSslSession
newInstance
(AbstractSessionContext context, byte[] data, String host, int port) Creates a newNativeSslSession
instance from the provided serialized bytes, which were generated bytoBytes()
.(package private) static NativeSslSession
newInstance
(NativeRef.SSL_SESSION ref, ConscryptSession session) Creates a new instance.(package private) abstract void
offerToResume
(NativeSsl ssl) (package private) abstract byte[]
toBytes()
Converts the given session to bytes.(package private) abstract SSLSession
Converts this object to aSSLSession
.
-
Field Details
-
logger
-
-
Constructor Details
-
NativeSslSession
NativeSslSession()
-
-
Method Details
-
newInstance
static NativeSslSession newInstance(NativeRef.SSL_SESSION ref, ConscryptSession session) throws SSLPeerUnverifiedException Creates a new instance. Since BoringSSL does not provide an API to get access to all session information via the SSL_SESSION, we get some values (e.g. peer certs) from theConscryptSession
instead (i.e. the SSL object).- Throws:
SSLPeerUnverifiedException
-
getOcspResponse
-
newInstance
static NativeSslSession newInstance(AbstractSessionContext context, byte[] data, String host, int port) Creates a newNativeSslSession
instance from the provided serialized bytes, which were generated bytoBytes()
.- Returns:
- The new instance if successful. If unable to parse the bytes for any reason, returns
null
.
-
getId
abstract byte[] getId() -
isValid
abstract boolean isValid() -
isSingleUse
abstract boolean isSingleUse()Returns whether this session should only ever be used for resumption once. -
offerToResume
- Throws:
SSLException
-
getCipherSuite
-
getProtocol
-
getPeerHost
-
getPeerPort
abstract int getPeerPort() -
getPeerOcspStapledResponse
abstract byte[] getPeerOcspStapledResponse()Returns the OCSP stapled response. The returned array is not copied; the caller must either not modify the returned array or make a copy.- See Also:
-
getPeerSignedCertificateTimestamp
abstract byte[] getPeerSignedCertificateTimestamp()Returns the signed certificate timestamp (SCT) received from the peer. The returned array is not copied; the caller must either not modify the returned array or make a copy.- See Also:
-
toBytes
abstract byte[] toBytes()Converts the given session to bytes.- Returns:
- session data as bytes or null if the session can't be converted
-
toSSLSession
Converts this object to aSSLSession
. The returned session will support only a subset of theSSLSession
API. -
log
-
checkRemaining
- Throws:
IOException
-