Top Fields Constructors Methods
org.bouncycastle.tls

public Class TlsClientProtocol

extends TlsProtocol
Class Inheritance
Known Direct Subclasses
org.bouncycastle.jsse.provider.ProvTlsClientProtocol
Imports
java.io.ByteArrayInputStream, .IOException, .InputStream, .OutputStream, java.util.Enumeration, .Hashtable, .Vector, org.bouncycastle.tls.crypto.TlsAgreement, .TlsSecret, .TlsStreamSigner, org.bouncycastle.util.Arrays, .Integers

Field Summary

Modifier and TypeField and Description
protected TlsAuthentication
protected CertificateRequest
protected CertificateStatus
protected Hashtable<K, V>
pack-priv OfferedPsks.BindersConfig
protected ClientHello
protected TlsKeyExchange
protected TlsClient
pack-priv TlsClientContextImpl
Inherited from org.bouncycastle.tls.TlsProtocol:
ADS_MODE_0_NADS_MODE_0_N_FIRSTONLYADS_MODE_1_Nsub1blockingclientExtensionsconnection_stateCS_CLIENT_CERTIFICATECS_CLIENT_CERTIFICATE_VERIFYCS_CLIENT_END_OF_EARLY_DATACS_CLIENT_FINISHEDCS_CLIENT_HELLOCS_CLIENT_HELLO_RETRYCS_CLIENT_KEY_EXCHANGECS_CLIENT_SUPPLEMENTAL_DATACS_ENDCS_SERVER_CERTIFICATECS_SERVER_CERTIFICATE_REQUESTCS_SERVER_CERTIFICATE_STATUSCS_SERVER_CERTIFICATE_VERIFYCS_SERVER_ENCRYPTED_EXTENSIONSCS_SERVER_FINISHEDCS_SERVER_HELLOCS_SERVER_HELLO_DONECS_SERVER_HELLO_RETRY_REQUESTCS_SERVER_KEY_EXCHANGECS_SERVER_SESSION_TICKETCS_SERVER_SUPPLEMENTAL_DATACS_STARTexpectSessionTicketEXT_RenegotiationInfoEXT_SessionTickethandshakeHashinputBuffersoutputBufferreceivedChangeCipherSpecrecordStreamrecordWriteLockretryCookieretryGroupselectedPSK13serverExtensionssessionMasterSecretsessionParameterstlsSession

Constructor Summary

AccessConstructor and Description
public
TlsClientProtocol()

Constructor for non-blocking mode.

public
TlsClientProtocol(InputStream
The stream of data from the server
input
,
OutputStream
The stream of data to the server
output
)

Constructor for blocking mode.

Method Summary

Modifier and TypeMethod and Description
protected void
protected void
public void
connect(TlsClient
The TlsClient to use for the handshake.
tlsClient
)

Initiates a TLS handshake in the role of client.

protected TlsContext
pack-priv AbstractTlsContext
protected TlsPeer
protected void
protected void
protected void
protected void
handleSupplementalData(Vector<E> serverSupplementalData)

protected void
protected void
process13ServerHello(ServerHello serverHello, boolean afterHelloRetryRequest)

protected void
process13ServerHelloCoda(ServerHello serverHello, boolean afterHelloRetryRequest)

protected void
protected void
receive13CertificateRequest(ByteArrayInputStream buf, boolean postHandshakeAuth)

protected void
protected void
protected void
protected void
protected void
protected void
protected void
protected ServerHello
protected void
protected void
protected void
protected void
protected void
protected void
protected void
Inherited from org.bouncycastle.tls.TlsProtocol:
applicationDataAvailableapplyMaxFragmentLengthExtensionassertEmptyblockForHandshakecancelSessioncheckReceivedChangeCipherSpecclosecloseConnectioncloseInputcompleteHandshakecreateRandomBlockcreateRenegotiationInfoestablishMasterSecretestablishSessionflushgetAppDataSplitModegetApplicationDataLimitgetAvailableInputBytesgetAvailableOutputBytesgetInputStreamgetOutputStreamgetRenegotiationPolicyhandleAlertMessagehandleAlertWarningMessagehandleChangeCipherSpecMessagehandleClosehandleExceptionhandleFailurehandleRenegotiationinvalidateSessionisApplicationDataReadyisClosedisConnectedisHandshakingisLegacyConnectionStateisResumableHandshakeisTLSv13ConnectionStateofferInputofferInputpreviewInputRecordpreviewOutputRecordpreviewOutputRecordprocess13FinishedMessageprocessFinishedMessageprocessMaxFragmentLengthExtensionprocessRecordraiseAlertFatalraiseAlertWarningreadApplicationDatareadExtensionsreadExtensionsDatareadExtensionsData13readExtensionsDataClientHelloreadInputreadInputreadOutputreadOutputreadSupplementalDataMessagereceive13KeyUpdaterefuseRenegotiationresumeHandshakesafePreviewRecordHeadersafeReadFullRecordsafeReadRecordsafeWriteRecordsend13CertificateMessagesend13CertificateVerifyMessagesend13FinishedMessagesend13KeyUpdatesendCertificateMessagesendChangeCipherSpecsendChangeCipherSpecMessagesendFinishedMessagesendSupplementalDataMessagesetAppDataSplitModesetResumableHandshakewriteApplicationDatawriteExtensionswriteExtensionswriteExtensionsDatawriteExtensionsDatawriteExtensionsDatawriteHandshakeMessagewritePreSharedKeyExtensionwriteSelectedExtensionswriteSupplementalData

Field Detail

authenticationback to summary
protected TlsAuthentication authentication
certificateRequestback to summary
protected CertificateRequest certificateRequest
certificateStatusback to summary
protected CertificateStatus certificateStatus
clientAgreementsback to summary
protected Hashtable<K, V> clientAgreements
clientBindersback to summary
pack-priv OfferedPsks.BindersConfig clientBinders
clientHelloback to summary
protected ClientHello clientHello
keyExchangeback to summary
protected TlsKeyExchange keyExchange
tlsClientback to summary
protected TlsClient tlsClient
tlsClientContextback to summary
pack-priv TlsClientContextImpl tlsClientContext

Constructor Detail

TlsClientProtocolback to summary
public TlsClientProtocol()

Constructor for non-blocking mode.

When data is received, use offerInput(byte[]) to provide the received ciphertext, then use readInput(byte[], int, int) to read the corresponding cleartext.

Similarly, when data needs to be sent, use writeApplicationData(byte[], int, int) to provide the cleartext, then use readOutput(byte[], int, int) to get the corresponding ciphertext.

TlsClientProtocolback to summary
public TlsClientProtocol(InputStream input, OutputStream output)

Constructor for blocking mode.

Parameters
input:InputStream

The stream of data from the server

output:OutputStream

The stream of data to the server

Method Detail

beginHandshakeback to summary
protected void beginHandshake(boolean renegotiation) throws IOException

Overrides org.bouncycastle.tls.TlsProtocol.beginHandshake.

cleanupHandshakeback to summary
protected void cleanupHandshake()

Overrides org.bouncycastle.tls.TlsProtocol.cleanupHandshake.

connectback to summary
public void connect(TlsClient tlsClient) throws IOException

Initiates a TLS handshake in the role of client.

In blocking mode, this will not return until the handshake is complete. In non-blocking mode, use TlsPeer#notifyHandshakeComplete() to receive a callback when the handshake is complete.

Parameters
tlsClient:TlsClient

The TlsClient to use for the handshake.

Exceptions
IOException:
If in blocking mode and handshake was not successful.
getContextback to summary
protected TlsContext getContext()

Implements abstract org.bouncycastle.tls.TlsProtocol.getContext.

getContextAdminback to summary
pack-priv AbstractTlsContext getContextAdmin()

Implements abstract org.bouncycastle.tls.TlsProtocol.getContextAdmin.

getPeerback to summary
protected TlsPeer getPeer()

Implements abstract org.bouncycastle.tls.TlsProtocol.getPeer.

handle13HandshakeMessageback to summary
protected void handle13HandshakeMessage(short type, HandshakeMessageInput buf) throws IOException
handleHandshakeMessageback to summary
protected void handleHandshakeMessage(short type, HandshakeMessageInput buf) throws IOException

Implements abstract org.bouncycastle.tls.TlsProtocol.handleHandshakeMessage.

handleServerCertificateback to summary
protected void handleServerCertificate() throws IOException
handleSupplementalDataback to summary
protected void handleSupplementalData(Vector<E> serverSupplementalData) throws IOException
process13HelloRetryRequestback to summary
protected void process13HelloRetryRequest(ServerHello helloRetryRequest) throws IOException
process13ServerHelloback to summary
protected void process13ServerHello(ServerHello serverHello, boolean afterHelloRetryRequest) throws IOException
process13ServerHelloCodaback to summary
protected void process13ServerHelloCoda(ServerHello serverHello, boolean afterHelloRetryRequest) throws IOException
processServerHelloback to summary
protected void processServerHello(ServerHello serverHello) throws IOException
receive13CertificateRequestback to summary
protected void receive13CertificateRequest(ByteArrayInputStream buf, boolean postHandshakeAuth) throws IOException
receive13EncryptedExtensionsback to summary
protected void receive13EncryptedExtensions(ByteArrayInputStream buf) throws IOException
receive13NewSessionTicketback to summary
protected void receive13NewSessionTicket(ByteArrayInputStream buf) throws IOException
receive13ServerCertificateback to summary
protected void receive13ServerCertificate(ByteArrayInputStream buf) throws IOException
receive13ServerCertificateVerifyback to summary
protected void receive13ServerCertificateVerify(ByteArrayInputStream buf) throws IOException
receive13ServerFinishedback to summary
protected void receive13ServerFinished(ByteArrayInputStream buf) throws IOException
receiveCertificateRequestback to summary
protected void receiveCertificateRequest(ByteArrayInputStream buf) throws IOException
receiveNewSessionTicketback to summary
protected void receiveNewSessionTicket(ByteArrayInputStream buf) throws IOException
receiveServerHelloMessageback to summary
protected ServerHello receiveServerHelloMessage(ByteArrayInputStream buf) throws IOException
send13ClientHelloRetryback to summary
protected void send13ClientHelloRetry() throws IOException
sendCertificateVerifyMessageback to summary
protected void sendCertificateVerifyMessage(DigitallySigned certificateVerify) throws IOException
sendClientHelloback to summary
protected void sendClientHello() throws IOException
sendClientHelloMessageback to summary
protected void sendClientHelloMessage() throws IOException
sendClientKeyExchangeback to summary
protected void sendClientKeyExchange() throws IOException
skip13CertificateRequestback to summary
protected void skip13CertificateRequest() throws IOException
skip13ServerCertificateback to summary
protected void skip13ServerCertificate() throws IOException