public class TlsServerProtocol extends TlsProtocol
| Modifier and Type | Field and Description |
|---|---|
protected CertificateRequest |
certificateRequest |
protected short |
clientCertificateType |
protected TlsKeyExchange |
keyExchange |
protected TlsHandshakeHash |
prepareFinishHash |
protected TlsCredentials |
serverCredentials |
protected TlsServer |
tlsServer |
ADS_MODE_0_N, ADS_MODE_0_N_FIRSTONLY, ADS_MODE_1_Nsub1, allowCertificateStatus, blocking, clientExtensions, connection_state, CS_CERTIFICATE_REQUEST, CS_CERTIFICATE_STATUS, CS_CERTIFICATE_VERIFY, CS_CLIENT_CERTIFICATE, CS_CLIENT_FINISHED, CS_CLIENT_HELLO, CS_CLIENT_KEY_EXCHANGE, CS_CLIENT_SUPPLEMENTAL_DATA, CS_END, CS_SERVER_CERTIFICATE, CS_SERVER_FINISHED, CS_SERVER_HELLO, CS_SERVER_HELLO_DONE, CS_SERVER_KEY_EXCHANGE, CS_SERVER_SESSION_TICKET, CS_SERVER_SUPPLEMENTAL_DATA, CS_START, expectSessionTicket, EXT_RenegotiationInfo, EXT_SessionTicket, inputBuffers, offeredCipherSuites, offeredCompressionMethods, outputBuffer, peerCertificate, receivedChangeCipherSpec, resumedSession, secure_renegotiation, secureRandom, securityParameters, serverExtensions, sessionParameters, tlsSession| Constructor and Description |
|---|
TlsServerProtocol(java.io.InputStream input,
java.io.OutputStream output,
java.security.SecureRandom secureRandom)
Constructor for blocking mode.
|
TlsServerProtocol(java.security.SecureRandom secureRandom)
Constructor for non-blocking mode.
When data is received, use TlsProtocol.offerInput(byte[]) to provide the received ciphertext,
then use TlsProtocol.readInput(byte[], int, int) to read the corresponding cleartext.Similarly, when data needs to be sent, use TlsProtocol.offerOutput(byte[], int, int) to provide
the cleartext, then use TlsProtocol.readOutput(byte[], int, int) to get the corresponding
ciphertext. |
| Modifier and Type | Method and Description |
|---|---|
void |
accept(TlsServer tlsServer)
Receives a TLS handshake in the role of server.
In blocking mode, this will not return until the handshake is complete. |
protected void |
cleanupHandshake() |
protected boolean |
expectCertificateVerifyMessage() |
protected TlsContext |
getContext() |
protected TlsPeer |
getPeer() |
protected void |
handleAlertWarningMessage(short alertDescription) |
protected void |
handleHandshakeMessage(short type,
java.io.ByteArrayInputStream buf) |
protected void |
notifyClientCertificate(Certificate clientCertificate) |
protected void |
receiveCertificateMessage(java.io.ByteArrayInputStream buf) |
protected void |
receiveCertificateVerifyMessage(java.io.ByteArrayInputStream buf) |
protected void |
receiveClientHelloMessage(java.io.ByteArrayInputStream buf) |
protected void |
receiveClientKeyExchangeMessage(java.io.ByteArrayInputStream buf) |
protected void |
sendCertificateRequestMessage(CertificateRequest certificateRequest) |
protected void |
sendCertificateStatusMessage(CertificateStatus certificateStatus) |
protected void |
sendNewSessionTicketMessage(NewSessionTicket newSessionTicket) |
protected void |
sendServerHelloDoneMessage() |
protected void |
sendServerHelloMessage() |
protected void |
sendServerKeyExchangeMessage(byte[] serverKeyExchange) |
applicationDataAvailable, applyMaxFragmentLengthExtension, assertEmpty, blockForHandshake, checkReceivedChangeCipherSpec, close, closeInput, completeHandshake, createRandomBlock, createRenegotiationInfo, createVerifyData, establishMasterSecret, flush, getAvailableInputBytes, getAvailableOutputBytes, getCurrentPRFHash, getInputStream, getOutputStream, getPRFAlgorithm, handleAlertMessage, handleChangeCipherSpecMessage, handleClose, handleException, handleFailure, invalidateSession, isClosed, offerInput, offerOutput, processFinishedMessage, processMaxFragmentLengthExtension, processRecord, raiseAlertFatal, raiseAlertWarning, readApplicationData, readExtensions, readInput, readOutput, readSupplementalDataMessage, refuseRenegotiation, safeCheckRecordHeader, safeReadRecord, safeWriteRecord, sendCertificateMessage, sendChangeCipherSpecMessage, sendFinishedMessage, sendSupplementalDataMessage, setAppDataSplitMode, writeData, writeExtensions, writeHandshakeMessage, writeSelectedExtensions, writeSupplementalDataprotected TlsServer tlsServer
protected TlsKeyExchange keyExchange
protected TlsCredentials serverCredentials
protected CertificateRequest certificateRequest
protected short clientCertificateType
protected TlsHandshakeHash prepareFinishHash
public TlsServerProtocol(java.io.InputStream input,
java.io.OutputStream output,
java.security.SecureRandom secureRandom)
input - The stream of data from the clientoutput - The stream of data to the clientsecureRandom - Random number generator for various cryptographic functionspublic TlsServerProtocol(java.security.SecureRandom secureRandom)
TlsProtocol.offerInput(byte[]) to provide the received ciphertext,
then use TlsProtocol.readInput(byte[], int, int) to read the corresponding cleartext.TlsProtocol.offerOutput(byte[], int, int) to provide
the cleartext, then use TlsProtocol.readOutput(byte[], int, int) to get the corresponding
ciphertext.secureRandom - Random number generator for various cryptographic functionspublic void accept(TlsServer tlsServer) throws java.io.IOException
TlsPeer.notifyHandshakeComplete() to
receive a callback when the handshake is complete.tlsServer - java.io.IOException - If in blocking mode and handshake was not successful.protected void cleanupHandshake()
cleanupHandshake in class TlsProtocolprotected TlsContext getContext()
getContext in class TlsProtocolprotected TlsPeer getPeer()
getPeer in class TlsProtocolprotected void handleHandshakeMessage(short type,
java.io.ByteArrayInputStream buf)
throws java.io.IOException
handleHandshakeMessage in class TlsProtocoljava.io.IOExceptionprotected void handleAlertWarningMessage(short alertDescription)
throws java.io.IOException
handleAlertWarningMessage in class TlsProtocoljava.io.IOExceptionprotected void notifyClientCertificate(Certificate clientCertificate) throws java.io.IOException
java.io.IOExceptionprotected void receiveCertificateMessage(java.io.ByteArrayInputStream buf)
throws java.io.IOException
java.io.IOExceptionprotected void receiveCertificateVerifyMessage(java.io.ByteArrayInputStream buf)
throws java.io.IOException
java.io.IOExceptionprotected void receiveClientHelloMessage(java.io.ByteArrayInputStream buf)
throws java.io.IOException
java.io.IOExceptionprotected void receiveClientKeyExchangeMessage(java.io.ByteArrayInputStream buf)
throws java.io.IOException
java.io.IOExceptionprotected void sendCertificateRequestMessage(CertificateRequest certificateRequest) throws java.io.IOException
java.io.IOExceptionprotected void sendCertificateStatusMessage(CertificateStatus certificateStatus) throws java.io.IOException
java.io.IOExceptionprotected void sendNewSessionTicketMessage(NewSessionTicket newSessionTicket) throws java.io.IOException
java.io.IOExceptionprotected void sendServerHelloMessage()
throws java.io.IOException
java.io.IOExceptionprotected void sendServerHelloDoneMessage()
throws java.io.IOException
java.io.IOExceptionprotected void sendServerKeyExchangeMessage(byte[] serverKeyExchange)
throws java.io.IOException
java.io.IOExceptionprotected boolean expectCertificateVerifyMessage()