TlsServerProtocol (Bouncy Castle Library 1.52 API Specification)
Date: 2015-03-01

org.bouncycastle.crypto.tls

## Class TlsServerProtocol

- java.lang.Object
- - org.bouncycastle.crypto.tls.TlsProtocol
  - - org.bouncycastle.crypto.tls.TlsServerProtocol

-     public class TlsServerProtocol
      extends TlsProtocol

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected CertificateRequest` | `certificateRequest`
    `protected short` | `clientCertificateType`
    `protected TlsKeyExchange` | `keyExchange`
    `protected TlsHandshakeHash` | `prepareFinishHash`
    `protected TlsCredentials` | `serverCredentials`
    `protected TlsServer` | `tlsServer`

    - ### Fields inherited from class org.bouncycastle.crypto.tls.TlsProtocol

      `allowCertificateStatus, 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, offeredCipherSuites, offeredCompressionMethods, peerCertificate, receivedChangeCipherSpec, resumedSession, secure_renegotiation, secureRandom, securityParameters, serverExtensions, sessionParameters, tlsSession`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TlsServerProtocol(java.io.InputStream input, java.io.OutputStream output, java.security.SecureRandom secureRandom)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `accept(TlsServer tlsServer)` Receives a TLS handshake in the role of server
    `protected void` | `cleanupHandshake()`
    `protected boolean` | `expectCertificateVerifyMessage()`
    `protected TlsContext` | `getContext()`
    `protected TlsPeer` | `getPeer()`
    `protected void` | `handleHandshakeMessage(short type, byte[] data)`
    `protected void` | `handleWarningMessage(short description)`
    `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)`

    - ### Methods inherited from class org.bouncycastle.crypto.tls.TlsProtocol

      `applicationDataAvailable, assertEmpty, close, completeHandshake, createRandomBlock, createRenegotiationInfo, createVerifyData, establishMasterSecret, failWithError, flush, getCurrentPRFHash, getInputStream, getOutputStream, getPRFAlgorithm, handleChangeCipherSpecMessage, handleClose, invalidateSession, isClosed, processFinishedMessage, processMaxFragmentLengthExtension, processRecord, raiseAlert, raiseWarning, readApplicationData, readExtensions, readSupplementalDataMessage, safeReadRecord, safeWriteRecord, sendCertificateMessage, sendChangeCipherSpecMessage, sendFinishedMessage, sendSupplementalDataMessage, writeData, writeExtensions, writeHandshakeMessage, writeSupplementalData`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### tlsServer

          protected TlsServer tlsServer

    - #### keyExchange

          protected TlsKeyExchange keyExchange

    - #### serverCredentials

          protected TlsCredentials serverCredentials

    - #### certificateRequest

          protected CertificateRequest certificateRequest

    - #### clientCertificateType

          protected short clientCertificateType

    - #### prepareFinishHash

          protected TlsHandshakeHash prepareFinishHash

  - ### Constructor Detail

    - #### TlsServerProtocol

          public TlsServerProtocol(java.io.InputStream input,
                           java.io.OutputStream output,
                           java.security.SecureRandom secureRandom)

  - ### Method Detail

    - #### accept

          public void accept(TlsServer tlsServer)
                      throws java.io.IOException

      Receives a TLS handshake in the role of server
      Parameters:
        `tlsServer` -
      Throws:
        `java.io.IOException` - If handshake was not successful.

    - #### cleanupHandshake

          protected void cleanupHandshake()

      Overrides:
        `cleanupHandshake` in class `TlsProtocol`

    - #### getContext

          protected TlsContext getContext()

      Specified by:
        `getContext` in class `TlsProtocol`

    - #### getPeer

          protected TlsPeer getPeer()

      Specified by:
        `getPeer` in class `TlsProtocol`

    - #### handleHandshakeMessage

          protected void handleHandshakeMessage(short type,
                                    byte[] data)
                                         throws java.io.IOException

      Specified by:
        `handleHandshakeMessage` in class `TlsProtocol`
      Throws:
        `java.io.IOException`

    - #### handleWarningMessage

          protected void handleWarningMessage(short description)
                                       throws java.io.IOException

      Overrides:
        `handleWarningMessage` in class `TlsProtocol`
      Throws:
        `java.io.IOException`

    - #### notifyClientCertificate

          protected void notifyClientCertificate(Certificate clientCertificate)
                                          throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### receiveCertificateMessage

          protected void receiveCertificateMessage(java.io.ByteArrayInputStream buf)
                                            throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### receiveCertificateVerifyMessage

          protected void receiveCertificateVerifyMessage(java.io.ByteArrayInputStream buf)
                                                  throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### receiveClientHelloMessage

          protected void receiveClientHelloMessage(java.io.ByteArrayInputStream buf)
                                            throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### receiveClientKeyExchangeMessage

          protected void receiveClientKeyExchangeMessage(java.io.ByteArrayInputStream buf)
                                                  throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### sendCertificateRequestMessage

          protected void sendCertificateRequestMessage(CertificateRequest certificateRequest)
                                                throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### sendCertificateStatusMessage

          protected void sendCertificateStatusMessage(CertificateStatus certificateStatus)
                                               throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### sendNewSessionTicketMessage

          protected void sendNewSessionTicketMessage(NewSessionTicket newSessionTicket)
                                              throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### sendServerHelloMessage

          protected void sendServerHelloMessage()
                                         throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### sendServerHelloDoneMessage

          protected void sendServerHelloDoneMessage()
                                             throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### sendServerKeyExchangeMessage

          protected void sendServerKeyExchangeMessage(byte[] serverKeyExchange)
                                               throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### expectCertificateVerifyMessage

          protected boolean expectCertificateVerifyMessage()