Top Description Inners Fields Constructors Methods
org.conscrypt

pack-priv abstract Class NativeSslSession

extends Object
Class Inheritance
Known Direct Subclasses
org.conscrypt.NativeSslSession.Impl
Static Imports
org.conscrypt.SSLUtils.SessionType.OPEN_SSL_WITH_OCSP, .SSLUtils.SessionType.OPEN_SSL_WITH_TLS_SCT, .SSLUtils.SessionType.isSupportedType

A utility wrapper that abstracts operations on the underlying native SSL_SESSION instance. This is abstract only to support mocking for tests.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
NativeSslSession.Impl

The session wrapper implementation.

Field Summary

Modifier and TypeField and Description
private static final Logger

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
private static void
checkRemaining(ByteBuffer buf, int length)

pack-priv abstract String
pack-priv abstract byte[]
private static byte[]
pack-priv abstract String
pack-priv abstract byte[]
getPeerOcspStapledResponse()

Returns the OCSP stapled response.

pack-priv abstract int
pack-priv abstract byte[]
getPeerSignedCertificateTimestamp()

Returns the signed certificate timestamp (SCT) received from the peer.

pack-priv abstract String
pack-priv abstract boolean
isSingleUse()

Returns whether this session should only ever be used for resumption once.

pack-priv abstract boolean
private static void
pack-priv static NativeSslSession
newInstance(NativeRef.SSL_SESSION ref, ConscryptSession session)

Creates a new instance.

pack-priv static NativeSslSession

Returns:

The new instance if successful. If unable to parse the bytes for any reason, returns null.
newInstance
(AbstractSessionContext context, byte[] data, String host, int port)

Creates a new NativeSslSession instance from the provided serialized bytes, which were generated by toBytes().

pack-priv abstract void
pack-priv abstract byte[]

Returns:

session data as bytes or null if the session can't be converted
toBytes
()

Converts the given session to bytes.

pack-priv abstract SSLSession
toSSLSession()

Converts this object to a SSLSession.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

loggerback to summary
private static final Logger logger

Constructor Detail

NativeSslSessionback to summary
pack-priv NativeSslSession()

Method Detail

checkRemainingback to summary
private static void checkRemaining(ByteBuffer buf, int length) throws IOException
getCipherSuiteback to summary
pack-priv abstract String getCipherSuite()
getIdback to summary
pack-priv abstract byte[] getId()
getOcspResponseback to summary
private static byte[] getOcspResponse(ConscryptSession session)
getPeerHostback to summary
pack-priv abstract String getPeerHost()
getPeerOcspStapledResponseback to summary
pack-priv 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
RFC 6066, RFC 6961
getPeerPortback to summary
pack-priv abstract int getPeerPort()
getPeerSignedCertificateTimestampback to summary
pack-priv 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
RFC 6962
getProtocolback to summary
pack-priv abstract String getProtocol()
isSingleUseback to summary
pack-priv abstract boolean isSingleUse()

Returns whether this session should only ever be used for resumption once.

isValidback to summary
pack-priv abstract boolean isValid()
logback to summary
private static void log(Throwable t)
newInstanceback to summary
pack-priv 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 the ConscryptSession instead (i.e. the SSL object).

newInstanceback to summary
pack-priv static NativeSslSession newInstance(AbstractSessionContext context, byte[] data, String host, int port)

Creates a new NativeSslSession instance from the provided serialized bytes, which were generated by toBytes().

Returns:NativeSslSession

The new instance if successful. If unable to parse the bytes for any reason, returns null.

offerToResumeback to summary
pack-priv abstract void offerToResume(NativeSsl ssl) throws SSLException
toBytesback to summary
pack-priv abstract byte[] toBytes()

Converts the given session to bytes.

Returns:byte[]

session data as bytes or null if the session can't be converted

toSSLSessionback to summary
pack-priv abstract SSLSession toSSLSession()

Converts this object to a SSLSession. The returned session will support only a subset of the SSLSession API.

org.conscrypt back to summary

private final Class NativeSslSession.Impl

extends NativeSslSession
Class Inheritance

The session wrapper implementation.

Field Summary

Modifier and TypeField and Description
private final String
private final AbstractSessionContext
private final String
private final X509Certificate[]
private final byte[]
private final byte[]
private final int
private final String
private final NativeRef.SSL_SESSION

Constructor Summary

AccessConstructor and Description
private
Impl(AbstractSessionContext context, NativeRef.SSL_SESSION ref, String host, int port, X509Certificate[] peerCertificates, byte[] peerOcspStapledResponse, byte[] peerSignedCertificateTimestamp)

Method Summary

Modifier and TypeMethod and Description
pack-priv String
private long
pack-priv byte[]
pack-priv String
pack-priv byte[]
getPeerOcspStapledResponse()

Implements abstract org.conscrypt.NativeSslSession.getPeerOcspStapledResponse.

Returns the OCSP stapled response.
pack-priv int
pack-priv byte[]
getPeerSignedCertificateTimestamp()

Implements abstract org.conscrypt.NativeSslSession.getPeerSignedCertificateTimestamp.

Returns the signed certificate timestamp (SCT) received from the peer.
pack-priv String
pack-priv boolean
isSingleUse()

Implements abstract org.conscrypt.NativeSslSession.isSingleUse.

Returns whether this session should only ever be used for resumption once.
pack-priv boolean
pack-priv void
pack-priv byte[]
toBytes()

Implements abstract org.conscrypt.NativeSslSession.toBytes.

Converts the given session to bytes.
pack-priv SSLSession
toSSLSession()

Implements abstract org.conscrypt.NativeSslSession.toSSLSession.

Converts this object to a SSLSession.
Inherited from org.conscrypt.NativeSslSession:
newInstancenewInstance

Field Detail

cipherSuiteback to summary
private final String cipherSuite
contextback to summary
private final AbstractSessionContext context
hostback to summary
private final String host
peerCertificatesback to summary
private final X509Certificate[] peerCertificates
peerOcspStapledResponseback to summary
private final byte[] peerOcspStapledResponse
peerSignedCertificateTimestampback to summary
private final byte[] peerSignedCertificateTimestamp
portback to summary
private final int port
protocolback to summary
private final String protocol
refback to summary
private final NativeRef.SSL_SESSION ref

Constructor Detail

Implback to summary
private Impl(AbstractSessionContext context, NativeRef.SSL_SESSION ref, String host, int port, X509Certificate[] peerCertificates, byte[] peerOcspStapledResponse, byte[] peerSignedCertificateTimestamp)

Method Detail

getCipherSuiteback to summary
pack-priv String getCipherSuite()

Implements abstract org.conscrypt.NativeSslSession.getCipherSuite.

Annotations
@Override
getCreationTimeback to summary
private long getCreationTime()
getIdback to summary
pack-priv byte[] getId()

Implements abstract org.conscrypt.NativeSslSession.getId.

Annotations
@Override
getPeerHostback to summary
pack-priv String getPeerHost()

Implements abstract org.conscrypt.NativeSslSession.getPeerHost.

Annotations
@Override
getPeerOcspStapledResponseback to summary
pack-priv byte[] getPeerOcspStapledResponse()

Implements abstract org.conscrypt.NativeSslSession.getPeerOcspStapledResponse.

Doc from org.conscrypt.NativeSslSession.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.

Annotations
@Override
getPeerPortback to summary
pack-priv int getPeerPort()

Implements abstract org.conscrypt.NativeSslSession.getPeerPort.

Annotations
@Override
getPeerSignedCertificateTimestampback to summary
pack-priv byte[] getPeerSignedCertificateTimestamp()

Implements abstract org.conscrypt.NativeSslSession.getPeerSignedCertificateTimestamp.

Doc from org.conscrypt.NativeSslSession.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.

Annotations
@Override
getProtocolback to summary
pack-priv String getProtocol()

Implements abstract org.conscrypt.NativeSslSession.getProtocol.

Annotations
@Override
isSingleUseback to summary
pack-priv boolean isSingleUse()

Implements abstract org.conscrypt.NativeSslSession.isSingleUse.

Doc from org.conscrypt.NativeSslSession.isSingleUse.

Returns whether this session should only ever be used for resumption once.

Annotations
@Override
isValidback to summary
pack-priv boolean isValid()

Implements abstract org.conscrypt.NativeSslSession.isValid.

Annotations
@Override
offerToResumeback to summary
pack-priv void offerToResume(NativeSsl ssl) throws SSLException

Implements abstract org.conscrypt.NativeSslSession.offerToResume.

Annotations
@Override
toBytesback to summary
pack-priv byte[] toBytes()

Implements abstract org.conscrypt.NativeSslSession.toBytes.

Doc from org.conscrypt.NativeSslSession.toBytes.

Converts the given session to bytes.

Returns:byte[]

session data as bytes or null if the session can't be converted

Annotations
@Override
toSSLSessionback to summary
pack-priv SSLSession toSSLSession()

Implements abstract org.conscrypt.NativeSslSession.toSSLSession.

Doc from org.conscrypt.NativeSslSession.toSSLSession.

Converts this object to a SSLSession. The returned session will support only a subset of the SSLSession API.

Annotations
@Override