Package org.bouncycastle.tls
Interface TlsContext
-
- All Known Subinterfaces:
TlsClientContext
,TlsServerContext
public interface TlsContext
Base interface for a TLS context implementation.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description byte[]
exportChannelBinding(int channelBinding)
Export the value of the specified channel binding.byte[]
exportEarlyKeyingMaterial(java.lang.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).byte[]
exportKeyingMaterial(java.lang.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.ProtocolVersion[]
getClientSupportedVersions()
ProtocolVersion
getClientVersion()
TlsCrypto
getCrypto()
TlsNonceGenerator
getNonceGenerator()
TlsSession
getResumableSession()
Used to get the resumable session, if any, used by this connection.SecurityParameters
getSecurityParameters()
SecurityParameters
getSecurityParametersConnection()
SecurityParameters
getSecurityParametersHandshake()
ProtocolVersion
getServerVersion()
TlsSession
getSession()
Used to get the session information for this connection.java.lang.Object
getUserObject()
boolean
isServer()
Return true if this context is for a server, false otherwise.void
setUserObject(java.lang.Object userObject)
-
-
-
Method Detail
-
getCrypto
TlsCrypto getCrypto()
-
getNonceGenerator
TlsNonceGenerator getNonceGenerator()
-
getSecurityParameters
SecurityParameters getSecurityParameters()
-
getSecurityParametersConnection
SecurityParameters getSecurityParametersConnection()
-
getSecurityParametersHandshake
SecurityParameters getSecurityParametersHandshake()
-
isServer
boolean isServer()
Return true if this context is for a server, false otherwise.- Returns:
- true for a server based context, false for a client based one.
-
getClientSupportedVersions
ProtocolVersion[] getClientSupportedVersions()
-
getClientVersion
ProtocolVersion getClientVersion()
-
getServerVersion
ProtocolVersion getServerVersion()
-
getResumableSession
TlsSession getResumableSession()
Used to get the resumable session, if any, used by this connection. Only available after the handshake has successfully completed.- Returns:
- A
TlsSession
representing the resumable session used by this connection, or null if no resumable session available. - See Also:
TlsPeer.notifyHandshakeComplete()
-
getSession
TlsSession getSession()
Used to get the session information for this connection. Only available after the handshake has successfully completed. UseTlsSession.isResumable()
to find out if the session is resumable.- Returns:
- A
TlsSession
representing the session used by this connection. - See Also:
TlsPeer.notifyHandshakeComplete()
-
getUserObject
java.lang.Object getUserObject()
-
setUserObject
void setUserObject(java.lang.Object userObject)
-
exportChannelBinding
byte[] exportChannelBinding(int channelBinding)
Export the value of the specified channel binding. Only available after the handshake has successfully completed.- Parameters:
channelBinding
- AChannelBinding
constant specifying the channel binding to export.- Returns:
- A copy of the channel binding data as a
byte[]
, or null if the binding could not be determined.
-
exportEarlyKeyingMaterial
byte[] exportEarlyKeyingMaterial(java.lang.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
- indicates which application will use the exported keys.context_value
- allows the application using the exporter to mix its own data with the TLS PRF for the exporter output.length
- the number of bytes to generate- Returns:
- a pseudorandom bit string of 'length' bytes generated from the (exporter_)master_secret.
-
exportKeyingMaterial
byte[] exportKeyingMaterial(java.lang.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
- indicates which application will use the exported keys.context_value
- allows the application using the exporter to mix its own data with the TLS PRF for the exporter output.length
- the number of bytes to generate- Returns:
- a pseudorandom bit string of 'length' bytes generated from the (exporter_)master_secret.
-
-