Top Description Methods
org.bouncycastle.tls

public Interface TlsContext

Known Direct Subinterfaces
org.bouncycastle.tls.TlsServerContext, org.bouncycastle.tls.TlsClientContext
Known Direct Implementers
org.bouncycastle.tls.AbstractTlsContext
Imports
org.bouncycastle.tls.crypto.TlsCrypto, .TlsNonceGenerator

Base interface for a TLS context implementation.

Method Summary

Modifier and TypeMethod and Description
public byte[]

Returns:

A copy of the channel binding data as a byte[], or null if the binding could not be determined.
exportChannelBinding
(int
A ChannelBinding constant specifying the channel binding to export.
channelBinding
)

Export the value of the specified channel binding.

public byte[]

Returns:

a pseudorandom bit string of 'length' bytes generated from the (exporter_)master_secret.
exportEarlyKeyingMaterial
(String
indicates which application will use the exported keys.
asciiLabel
,
byte[]
allows the application using the exporter to mix its own data with the TLS PRF for the exporter output.
context_value
,
int
the number of bytes to generate.
length
)

Export (early data) keying material according to RFC 5705: "Keying Material Exporters for TLS", as updated for TLS 1.3 (RFC 8446).

public byte[]

Returns:

a pseudorandom bit string of 'length' bytes generated from the (exporter_)master_secret.
exportKeyingMaterial
(String
indicates which application will use the exported keys.
asciiLabel
,
byte[]
allows the application using the exporter to mix its own data with the TLS PRF for the exporter output.
context_value
,
int
the number of bytes to generate.
length
)

Export keying material according to RFC 5705: "Keying Material Exporters for TLS", as updated for TLS 1.3 (RFC 8446) when negotiated.

public ProtocolVersion[]
public ProtocolVersion
public TlsCrypto
public TlsNonceGenerator
public TlsSession

Returns:

A TlsSession representing the resumable session used by this connection, or null if no resumable session available.
getResumableSession
()

Used to get the resumable session, if any, used by this connection.

public ProtocolVersion
public SecurityParameters
public SecurityParameters
public SecurityParameters
public ProtocolVersion
public TlsSession

Returns:

A TlsSession representing the session used by this connection.
getSession
()

Used to get the session information for this connection.

public Object
public boolean

Returns:

true for a server based context, false for a client based one.
isServer
()

Return true if this context is for a server, false otherwise.

public void
setUserObject(Object userObject)

Method Detail

exportChannelBindingback to summary
public byte[] exportChannelBinding(int channelBinding)

Export the value of the specified channel binding. Only available after the handshake has successfully completed.

Parameters
channelBinding:int

A ChannelBinding constant specifying the channel binding to export.

Returns:byte[]

A copy of the channel binding data as a byte[], or null if the binding could not be determined.

exportEarlyKeyingMaterialback to summary
public byte[] exportEarlyKeyingMaterial(String asciiLabel, byte[] context_value, int length)

Export (early data) keying material according to RFC 5705: "Keying Material Exporters for TLS", as updated for TLS 1.3 (RFC 8446).

Note

for use in settings where an exporter is needed for 0-RTT data.

Parameters
asciiLabel:String

indicates which application will use the exported keys.

context_value:byte[]

allows the application using the exporter to mix its own data with the TLS PRF for the exporter output.

length:int

the number of bytes to generate.

Returns:byte[]

a pseudorandom bit string of 'length' bytes generated from the (exporter_)master_secret.

exportKeyingMaterialback to summary
public byte[] exportKeyingMaterial(String asciiLabel, byte[] context_value, int length)

Export keying material according to RFC 5705: "Keying Material Exporters for TLS", as updated for TLS 1.3 (RFC 8446) when negotiated.

Parameters
asciiLabel:String

indicates which application will use the exported keys.

context_value:byte[]

allows the application using the exporter to mix its own data with the TLS PRF for the exporter output.

length:int

the number of bytes to generate.

Returns:byte[]

a pseudorandom bit string of 'length' bytes generated from the (exporter_)master_secret.

getClientSupportedVersionsback to summary
public ProtocolVersion[] getClientSupportedVersions()
getClientVersionback to summary
public ProtocolVersion getClientVersion()
getCryptoback to summary
public TlsCrypto getCrypto()
getNonceGeneratorback to summary
public TlsNonceGenerator getNonceGenerator()
getResumableSessionback to summary
public TlsSession getResumableSession()

Used to get the resumable session, if any, used by this connection. Only available after the handshake has successfully completed.

Returns:TlsSession

A TlsSession representing the resumable session used by this connection, or null if no resumable session available.

See Also
TlsPeer#notifyHandshakeComplete()
getRSAPreMasterSecretVersionback to summary
public ProtocolVersion getRSAPreMasterSecretVersion()
getSecurityParametersback to summary
public SecurityParameters getSecurityParameters()
getSecurityParametersConnectionback to summary
public SecurityParameters getSecurityParametersConnection()
getSecurityParametersHandshakeback to summary
public SecurityParameters getSecurityParametersHandshake()
getServerVersionback to summary
public ProtocolVersion getServerVersion()
getSessionback to summary
public TlsSession getSession()

Used to get the session information for this connection. Only available after the handshake has successfully completed. Use TlsSession#isResumable() to find out if the session is resumable.

Returns:TlsSession

A TlsSession representing the session used by this connection.

See Also
TlsPeer#notifyHandshakeComplete()
getUserObjectback to summary
public Object getUserObject()
isServerback to summary
public boolean isServer()

Return true if this context is for a server, false otherwise.

Returns:boolean

true for a server based context, false for a client based one.

setUserObjectback to summary
public void setUserObject(Object userObject)