Table of Contents

Class TlsServerProtocol

Namespace
Org.BouncyCastle.Tls
Assembly
BouncyCastle.Cryptography.dll
public class TlsServerProtocol : TlsProtocol, TlsCloseable
Inheritance
TlsServerProtocol
Implements
Inherited Members

Constructors

TlsServerProtocol()

Constructor for non-blocking mode.

public TlsServerProtocol()

Remarks

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.

TlsServerProtocol(Stream)

Constructor for blocking mode.

public TlsServerProtocol(Stream stream)

Parameters

stream Stream

The Stream of data to/from the server.

TlsServerProtocol(Stream, Stream)

Constructor for blocking mode.

public TlsServerProtocol(Stream input, Stream output)

Parameters

input Stream

The Stream of data from the server.

output Stream

The Stream of data to the server.

Fields

m_certificateRequest

protected CertificateRequest m_certificateRequest

Field Value

CertificateRequest

m_keyExchange

protected TlsKeyExchange m_keyExchange

Field Value

TlsKeyExchange

m_offeredCipherSuites

protected int[] m_offeredCipherSuites

Field Value

int[]

m_tlsServer

protected TlsServer m_tlsServer

Field Value

TlsServer

Properties

Context

protected override TlsContext Context { get; }

Property Value

TlsContext

Peer

protected override TlsPeer Peer { get; }

Property Value

TlsPeer

Methods

Accept(TlsServer)

Receives a TLS handshake in the role of server.

public void Accept(TlsServer tlsServer)

Parameters

tlsServer TlsServer

The TlsServer to use for the handshake.

Remarks

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

Exceptions

IOException

If in blocking mode and handshake was not successful.

CleanupHandshake()

protected override void CleanupHandshake()

ExpectCertificateVerifyMessage()

protected virtual bool ExpectCertificateVerifyMessage()

Returns

bool

Generate13HelloRetryRequest(ClientHello)

protected virtual ServerHello Generate13HelloRetryRequest(ClientHello clientHello)

Parameters

clientHello ClientHello

Returns

ServerHello

Exceptions

IOException

Generate13ServerHello(ClientHello, HandshakeMessageInput, bool)

protected virtual ServerHello Generate13ServerHello(ClientHello clientHello, HandshakeMessageInput clientHelloMessage, bool afterHelloRetryRequest)

Parameters

clientHello ClientHello
clientHelloMessage HandshakeMessageInput
afterHelloRetryRequest bool

Returns

ServerHello

Exceptions

IOException

GenerateServerHello(ClientHello, HandshakeMessageInput)

protected virtual ServerHello GenerateServerHello(ClientHello clientHello, HandshakeMessageInput clientHelloMessage)

Parameters

clientHello ClientHello
clientHelloMessage HandshakeMessageInput

Returns

ServerHello

Exceptions

IOException

Handle13HandshakeMessage(short, HandshakeMessageInput)

protected virtual void Handle13HandshakeMessage(short type, HandshakeMessageInput buf)

Parameters

type short
buf HandshakeMessageInput

Exceptions

IOException

HandleAlertWarningMessage(short)

protected override void HandleAlertWarningMessage(short alertDescription)

Parameters

alertDescription short

Exceptions

IOException

HandleHandshakeMessage(short, HandshakeMessageInput)

protected override void HandleHandshakeMessage(short type, HandshakeMessageInput buf)

Parameters

type short
buf HandshakeMessageInput

Exceptions

IOException

NotifyClientCertificate(Certificate)

protected virtual void NotifyClientCertificate(Certificate clientCertificate)

Parameters

clientCertificate Certificate

Exceptions

IOException

Receive13ClientCertificate(MemoryStream)

protected virtual void Receive13ClientCertificate(MemoryStream buf)

Parameters

buf MemoryStream

Exceptions

IOException

Receive13ClientCertificateVerify(MemoryStream)

protected void Receive13ClientCertificateVerify(MemoryStream buf)

Parameters

buf MemoryStream

Exceptions

IOException

Receive13ClientFinished(MemoryStream)

protected virtual void Receive13ClientFinished(MemoryStream buf)

Parameters

buf MemoryStream

Exceptions

IOException

ReceiveCertificateMessage(MemoryStream)

protected virtual void ReceiveCertificateMessage(MemoryStream buf)

Parameters

buf MemoryStream

Exceptions

IOException

ReceiveCertificateVerifyMessage(MemoryStream)

protected virtual void ReceiveCertificateVerifyMessage(MemoryStream buf)

Parameters

buf MemoryStream

Exceptions

IOException

ReceiveClientHelloMessage(MemoryStream)

protected virtual ClientHello ReceiveClientHelloMessage(MemoryStream buf)

Parameters

buf MemoryStream

Returns

ClientHello

Exceptions

IOException

ReceiveClientKeyExchangeMessage(MemoryStream)

protected virtual void ReceiveClientKeyExchangeMessage(MemoryStream buf)

Parameters

buf MemoryStream

Exceptions

IOException

Send13EncryptedExtensionsMessage(IDictionary<int, byte[]>)

protected virtual void Send13EncryptedExtensionsMessage(IDictionary<int, byte[]> serverExtensions)

Parameters

serverExtensions IDictionary<int, byte[]>

Exceptions

IOException

Send13ServerHelloCoda(ServerHello, bool)

protected virtual void Send13ServerHelloCoda(ServerHello serverHello, bool afterHelloRetryRequest)

Parameters

serverHello ServerHello
afterHelloRetryRequest bool

Exceptions

IOException

SendCertificateRequestMessage(CertificateRequest)

protected virtual void SendCertificateRequestMessage(CertificateRequest certificateRequest)

Parameters

certificateRequest CertificateRequest

Exceptions

IOException

SendCertificateStatusMessage(CertificateStatus)

protected virtual void SendCertificateStatusMessage(CertificateStatus certificateStatus)

Parameters

certificateStatus CertificateStatus

Exceptions

IOException

SendHelloRequestMessage()

protected virtual void SendHelloRequestMessage()

Exceptions

IOException

SendNewSessionTicketMessage(NewSessionTicket)

protected virtual void SendNewSessionTicketMessage(NewSessionTicket newSessionTicket)

Parameters

newSessionTicket NewSessionTicket

Exceptions

IOException

SendServerHelloDoneMessage()

protected virtual void SendServerHelloDoneMessage()

Exceptions

IOException

SendServerHelloMessage(ServerHello)

protected virtual void SendServerHelloMessage(ServerHello serverHello)

Parameters

serverHello ServerHello

Exceptions

IOException

SendServerKeyExchangeMessage(byte[])

protected virtual void SendServerKeyExchangeMessage(byte[] serverKeyExchange)

Parameters

serverKeyExchange byte[]

Exceptions

IOException

Skip13ClientCertificate()

protected virtual void Skip13ClientCertificate()

Exceptions

IOException

Skip13ClientCertificateVerify()

protected virtual void Skip13ClientCertificateVerify()

Exceptions

IOException