Top Description Methods
org.bouncycastle.tls

public Interface TlsClient

extends TlsPeer
Known Direct Implementers
org.bouncycastle.tls.AbstractTlsClient
Imports
java.io.IOException, java.util.Hashtable, .Vector

Interface describing a TLS client endpoint.

Method Summary

Modifier and TypeMethod and Description
public TlsAuthentication
public Hashtable<K, V>
public Vector<E>
public TlsDHGroupVerifier
public Vector<E>

Returns:

a Vector of named group values, possibly empty or null.
getEarlyKeyShareGroups
()

If this client is offering TLS 1.3 or higher, this method may be called to determine for which groups a key share should be included in the initial ClientHello.

public Vector<E>

Returns:

a Vector of TlsPSKExternal instances, or null if none should be offered.
getExternalPSKs
()

Return the external PSKs to offer in the ClientHello.

public TlsPSKIdentity
public TlsSession

Returns:

A TlsSession representing the resumable session to be used for this connection, or null to use a new session.
getSessionToResume
()

Return the session this client wants to resume, if any.

public TlsSRPConfigVerifier
public TlsSRPIdentity
public void
public boolean
public void
notifyNewSessionTicket(NewSessionTicket
The ticket.
newSessionTicket
)

RFC 5077 3.3.

public void
notifySelectedCipherSuite(int selectedCipherSuite)

public void
public void
public void
notifySessionID(byte[] sessionID)

Notifies the client of the session_id sent in the ServerHello.

public void
notifySessionToResume(TlsSession
The TlsSession representing the resumable session to be offered for this connection, or null if there is none.
session
)

Notifies the client of the session that will be offered in ClientHello for resumption, if any.

public void
processServerExtensions(Hashtable<K, V>
(Integer -> byte[])
serverExtensions
)

The TlsClientProtocol implementation validates that any server extensions received correspond to client extensions sent.

public void
processServerSupplementalData(Vector<E> serverSupplementalData)

public boolean
Inherited from org.bouncycastle.tls.TlsPeer:
allowLegacyResumptioncancelgetCipherSuitesgetCryptogetHandshakeResendTimeMillisgetHandshakeTimeoutMillisgetHeartbeatgetHeartbeatPolicygetKeyExchangeFactorygetMaxCertificateChainLengthgetMaxHandshakeMessageSizegetProtocolVersionsgetPskKeyExchangeModesgetRenegotiationPolicynotifyAlertRaisednotifyAlertReceivednotifyCloseHandlenotifyConnectionClosednotifyHandshakeBeginningnotifyHandshakeCompletenotifySecureRenegotiationrequiresCloseNotifyrequiresExtendedMasterSecretshouldCheckSigAlgOfPeerCertsshouldUseExtendedMasterSecretshouldUseExtendedPaddingshouldUseGMTUnixTime

Method Detail

getAuthenticationback to summary
public TlsAuthentication getAuthentication() throws IOException
getClientExtensionsback to summary
public Hashtable<K, V> getClientExtensions() throws IOException
getClientSupplementalDataback to summary
public Vector<E> getClientSupplementalData() throws IOException
getDHGroupVerifierback to summary
public TlsDHGroupVerifier getDHGroupVerifier() throws IOException
getEarlyKeyShareGroupsback to summary
public Vector<E> getEarlyKeyShareGroups()

If this client is offering TLS 1.3 or higher, this method may be called to determine for which groups a key share should be included in the initial ClientHello. Groups that were not included in the supported_groups extension (by getClientExtensions() will be ignored. The protocol will then add a suitable key_share extension to the ClientHello extensions.

Returns:Vector<E>

a Vector of named group values, possibly empty or null.

getExternalPSKsback to summary
public Vector<E> getExternalPSKs()

Return the external PSKs to offer in the ClientHello. Note that this will only be called when TLS 1.3 or higher is amongst the offered protocol versions.

Returns:Vector<E>

a Vector of TlsPSKExternal instances, or null if none should be offered.

getPSKIdentityback to summary
public TlsPSKIdentity getPSKIdentity() throws IOException
getSessionToResumeback to summary
public TlsSession getSessionToResume()

Return the session this client wants to resume, if any. Note that the peer's certificate chain for the session (if any) may need to be periodically revalidated.

Returns:TlsSession

A TlsSession representing the resumable session to be used for this connection, or null to use a new session.

See Also
SessionParameters#getPeerCertificate()
getSRPConfigVerifierback to summary
public TlsSRPConfigVerifier getSRPConfigVerifier() throws IOException
getSRPIdentityback to summary
public TlsSRPIdentity getSRPIdentity() throws IOException
initback to summary
public void init(TlsClientContext context)
isFallbackback to summary
public boolean isFallback()
notifyNewSessionTicketback to summary
public void notifyNewSessionTicket(NewSessionTicket newSessionTicket) throws IOException

RFC 5077 3.3. NewSessionTicket Handshake Message

This method will be called (only) when a NewSessionTicket handshake message is received. The ticket is opaque to the client and clients MUST NOT examine the ticket under the assumption that it complies with e.g. RFC 5077 4. Recommended Ticket Construction.

Parameters
newSessionTicket:NewSessionTicket

The ticket.

notifySelectedCipherSuiteback to summary
public void notifySelectedCipherSuite(int selectedCipherSuite)
notifySelectedPSKback to summary
public void notifySelectedPSK(TlsPSK selectedPSK) throws IOException
notifyServerVersionback to summary
public void notifyServerVersion(ProtocolVersion selectedVersion) throws IOException
notifySessionIDback to summary
public void notifySessionID(byte[] sessionID)

Notifies the client of the session_id sent in the ServerHello.

See Also
TlsContext#getSession()
notifySessionToResumeback to summary
public void notifySessionToResume(TlsSession session)

Notifies the client of the session that will be offered in ClientHello for resumption, if any. This will be either the session returned from getSessionToResume() or null if that session was unusable.

Note

the actual negotiated session_id is notified by notifySessionID(byte[]).

Parameters
session:TlsSession

The TlsSession representing the resumable session to be offered for this connection, or null if there is none.

See Also
notifySessionID(byte[])
processServerExtensionsback to summary
public void processServerExtensions(Hashtable<K, V> serverExtensions) throws IOException

The TlsClientProtocol implementation validates that any server extensions received correspond to client extensions sent. If further processing of the server extensions is needed, it can be done in this callback.

Note

This is not called for session resumption handshakes.

Parameters
serverExtensions:Hashtable<K, V>

(Integer -> byte[])

processServerSupplementalDataback to summary
public void processServerSupplementalData(Vector<E> serverSupplementalData) throws IOException
shouldUseCompatibilityModeback to summary
public boolean shouldUseCompatibilityMode()