Top Fields Constructors Methods
org.bouncycastle.tls

public Class TlsServerProtocol

extends TlsProtocol
Class Inheritance
Known Direct Subclasses
org.bouncycastle.jsse.provider.ProvTlsServerProtocol
Imports
java.io.ByteArrayInputStream, .ByteArrayOutputStream, .IOException, .InputStream, .OutputStream, java.util.Hashtable, .Vector, org.bouncycastle.tls.crypto.TlsAgreement, .TlsCrypto, .TlsDHConfig, .TlsECConfig, .TlsKemConfig, .TlsSecret, org.bouncycastle.util.Arrays

Field Summary

Modifier and TypeField and Description
protected CertificateRequest
protected TlsKeyExchange
protected int[]
protected TlsServer
pack-priv TlsServerContextImpl
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
TlsServerProtocol()

Constructor for non-blocking mode.

public
TlsServerProtocol(InputStream
The stream of data from the client
input
,
OutputStream
The stream of data to the client
output
)

Constructor for blocking mode.

Method Summary

Modifier and TypeMethod and Description
public void
accept(TlsServer tlsServer)

Receives a TLS handshake in the role of server.

protected void
protected boolean
protected ServerHello
protected ServerHello
generate13ServerHello(ClientHello clientHello, HandshakeMessageInput clientHelloMessage, boolean afterHelloRetryRequest)

protected ServerHello
generateServerHello(ClientHello clientHello, HandshakeMessageInput clientHelloMessage)

protected TlsContext
pack-priv AbstractTlsContext
protected TlsPeer
protected void
protected void
protected void
protected void
protected void
protected void
protected void
protected void
protected void
protected ClientHello
protected void
protected void
protected void
send13ServerHelloCoda(ServerHello serverHello, boolean afterHelloRetryRequest)

protected void
protected void
protected void
protected void
protected void
protected void
protected void
sendServerKeyExchangeMessage(byte[] serverKeyExchange)

protected void
protected void
Inherited from org.bouncycastle.tls.TlsProtocol:
applicationDataAvailableapplyMaxFragmentLengthExtensionassertEmptybeginHandshakeblockForHandshakecancelSessioncheckReceivedChangeCipherSpecclosecloseConnectioncloseInputcompleteHandshakecreateRandomBlockcreateRenegotiationInfoestablishMasterSecretestablishSessionflushgetAppDataSplitModegetApplicationDataLimitgetAvailableInputBytesgetAvailableOutputBytesgetInputStreamgetOutputStreamgetRenegotiationPolicyhandleAlertMessagehandleChangeCipherSpecMessagehandleClosehandleExceptionhandleFailurehandleRenegotiationinvalidateSessionisApplicationDataReadyisClosedisConnectedisHandshakingisLegacyConnectionStateisResumableHandshakeisTLSv13ConnectionStateofferInputofferInputpreviewInputRecordpreviewOutputRecordpreviewOutputRecordprocess13FinishedMessageprocessFinishedMessageprocessMaxFragmentLengthExtensionprocessRecordraiseAlertFatalraiseAlertWarningreadApplicationDatareadExtensionsreadExtensionsDatareadExtensionsData13readExtensionsDataClientHelloreadInputreadInputreadOutputreadOutputreadSupplementalDataMessagereceive13KeyUpdaterefuseRenegotiationresumeHandshakesafePreviewRecordHeadersafeReadFullRecordsafeReadRecordsafeWriteRecordsend13CertificateMessagesend13CertificateVerifyMessagesend13FinishedMessagesend13KeyUpdatesendCertificateMessagesendChangeCipherSpecsendChangeCipherSpecMessagesendFinishedMessagesendSupplementalDataMessagesetAppDataSplitModesetResumableHandshakewriteApplicationDatawriteExtensionswriteExtensionswriteExtensionsDatawriteExtensionsDatawriteExtensionsDatawriteHandshakeMessagewritePreSharedKeyExtensionwriteSelectedExtensionswriteSupplementalData

Field Detail

certificateRequestback to summary
protected CertificateRequest certificateRequest
keyExchangeback to summary
protected TlsKeyExchange keyExchange
offeredCipherSuitesback to summary
protected int[] offeredCipherSuites
tlsServerback to summary
protected TlsServer tlsServer
tlsServerContextback to summary
pack-priv TlsServerContextImpl tlsServerContext

Constructor Detail

TlsServerProtocolback to summary
public TlsServerProtocol()

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.

TlsServerProtocolback to summary
public TlsServerProtocol(InputStream input, OutputStream output)

Constructor for blocking mode.

Parameters
input:InputStream

The stream of data from the client

output:OutputStream

The stream of data to the client

Method Detail

acceptback to summary
public void accept(TlsServer tlsServer) throws IOException

Receives a TLS handshake in the role of server.

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.

Exceptions
IOException:
If in blocking mode and handshake was not successful.
cleanupHandshakeback to summary
protected void cleanupHandshake()

Overrides org.bouncycastle.tls.TlsProtocol.cleanupHandshake.

expectCertificateVerifyMessageback to summary
protected boolean expectCertificateVerifyMessage()
generate13HelloRetryRequestback to summary
protected ServerHello generate13HelloRetryRequest(ClientHello clientHello) throws IOException
generate13ServerHelloback to summary
protected ServerHello generate13ServerHello(ClientHello clientHello, HandshakeMessageInput clientHelloMessage, boolean afterHelloRetryRequest) throws IOException
generateServerHelloback to summary
protected ServerHello generateServerHello(ClientHello clientHello, HandshakeMessageInput clientHelloMessage) throws IOException
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
handleAlertWarningMessageback to summary
protected void handleAlertWarningMessage(short alertDescription) throws IOException

Overrides org.bouncycastle.tls.TlsProtocol.handleAlertWarningMessage.

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

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

notifyClientCertificateback to summary
protected void notifyClientCertificate(Certificate clientCertificate) throws IOException
receive13ClientCertificateback to summary
protected void receive13ClientCertificate(ByteArrayInputStream buf) throws IOException
receive13ClientCertificateVerifyback to summary
protected void receive13ClientCertificateVerify(ByteArrayInputStream buf) throws IOException
receive13ClientFinishedback to summary
protected void receive13ClientFinished(ByteArrayInputStream buf) throws IOException
receiveCertificateMessageback to summary
protected void receiveCertificateMessage(ByteArrayInputStream buf) throws IOException
receiveCertificateVerifyMessageback to summary
protected void receiveCertificateVerifyMessage(ByteArrayInputStream buf) throws IOException
receiveClientHelloMessageback to summary
protected ClientHello receiveClientHelloMessage(ByteArrayInputStream buf) throws IOException
receiveClientKeyExchangeMessageback to summary
protected void receiveClientKeyExchangeMessage(ByteArrayInputStream buf) throws IOException
send13EncryptedExtensionsMessageback to summary
protected void send13EncryptedExtensionsMessage(Hashtable<K, V> serverExtensions) throws IOException
send13ServerHelloCodaback to summary
protected void send13ServerHelloCoda(ServerHello serverHello, boolean afterHelloRetryRequest) throws IOException
sendCertificateRequestMessageback to summary
protected void sendCertificateRequestMessage(CertificateRequest certificateRequest) throws IOException
sendCertificateStatusMessageback to summary
protected void sendCertificateStatusMessage(CertificateStatus certificateStatus) throws IOException
sendHelloRequestMessageback to summary
protected void sendHelloRequestMessage() throws IOException
sendNewSessionTicketMessageback to summary
protected void sendNewSessionTicketMessage(NewSessionTicket newSessionTicket) throws IOException
sendServerHelloDoneMessageback to summary
protected void sendServerHelloDoneMessage() throws IOException
sendServerHelloMessageback to summary
protected void sendServerHelloMessage(ServerHello serverHello) throws IOException
sendServerKeyExchangeMessageback to summary
protected void sendServerKeyExchangeMessage(byte[] serverKeyExchange) throws IOException
skip13ClientCertificateback to summary
protected void skip13ClientCertificate() throws IOException
skip13ClientCertificateVerifyback to summary
protected void skip13ClientCertificateVerify() throws IOException