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 classThe session wrapper implementation. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static voidcheckRemaining(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 booleanReturns whether this session should only ever be used for resumption once.(package private) abstract booleanisValid()private static void(package private) static NativeSslSessionnewInstance(AbstractSessionContext context, byte[] data, String host, int port) Creates a newNativeSslSessioninstance from the provided serialized bytes, which were generated bytoBytes().(package private) static NativeSslSessionnewInstance(NativeRef.SSL_SESSION ref, ConscryptSession session) Creates a new instance.(package private) abstract voidofferToResume(NativeSsl ssl) (package private) abstract byte[]toBytes()Converts the given session to bytes.(package private) abstract SSLSessionConverts 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 theConscryptSessioninstead (i.e. the SSL object).- Throws:
SSLPeerUnverifiedException
-
getOcspResponse
-
newInstance
static NativeSslSession newInstance(AbstractSessionContext context, byte[] data, String host, int port) Creates a newNativeSslSessioninstance 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 theSSLSessionAPI. -
log
-
checkRemaining
- Throws:
IOException
-