Table of Contents

Class TlsProtocol

Namespace
Enterprises.Org.BouncyCastle.Crypto.Tls
Assembly
Enterprises.BouncyCastle.Crypto.dll
public abstract class TlsProtocol
Inheritance
TlsProtocol
Derived
Inherited Members

Constructors

TlsProtocol(SecureRandom)

public TlsProtocol(SecureRandom secureRandom)

Parameters

secureRandom SecureRandom

TlsProtocol(Stream, SecureRandom)

public TlsProtocol(Stream stream, SecureRandom secureRandom)

Parameters

stream Stream
secureRandom SecureRandom

TlsProtocol(Stream, Stream, SecureRandom)

public TlsProtocol(Stream input, Stream output, SecureRandom secureRandom)

Parameters

input Stream
output Stream
secureRandom SecureRandom

Fields

ADS_MODE_0_N

protected const short ADS_MODE_0_N = 1

Field Value

short

ADS_MODE_0_N_FIRSTONLY

protected const short ADS_MODE_0_N_FIRSTONLY = 2

Field Value

short

ADS_MODE_1_Nsub1

protected const short ADS_MODE_1_Nsub1 = 0

Field Value

short

CS_CERTIFICATE_REQUEST

protected const short CS_CERTIFICATE_REQUEST = 7

Field Value

short

CS_CERTIFICATE_STATUS

protected const short CS_CERTIFICATE_STATUS = 5

Field Value

short

CS_CERTIFICATE_VERIFY

protected const short CS_CERTIFICATE_VERIFY = 12

Field Value

short

CS_CLIENT_CERTIFICATE

protected const short CS_CLIENT_CERTIFICATE = 10

Field Value

short

CS_CLIENT_FINISHED

protected const short CS_CLIENT_FINISHED = 13

Field Value

short

CS_CLIENT_HELLO

protected const short CS_CLIENT_HELLO = 1

Field Value

short

CS_CLIENT_KEY_EXCHANGE

protected const short CS_CLIENT_KEY_EXCHANGE = 11

Field Value

short

CS_CLIENT_SUPPLEMENTAL_DATA

protected const short CS_CLIENT_SUPPLEMENTAL_DATA = 9

Field Value

short

CS_END

protected const short CS_END = 16

Field Value

short

CS_SERVER_CERTIFICATE

protected const short CS_SERVER_CERTIFICATE = 4

Field Value

short

CS_SERVER_FINISHED

protected const short CS_SERVER_FINISHED = 15

Field Value

short

CS_SERVER_HELLO

protected const short CS_SERVER_HELLO = 2

Field Value

short

CS_SERVER_HELLO_DONE

protected const short CS_SERVER_HELLO_DONE = 8

Field Value

short

CS_SERVER_KEY_EXCHANGE

protected const short CS_SERVER_KEY_EXCHANGE = 6

Field Value

short

CS_SERVER_SESSION_TICKET

protected const short CS_SERVER_SESSION_TICKET = 14

Field Value

short

CS_SERVER_SUPPLEMENTAL_DATA

protected const short CS_SERVER_SUPPLEMENTAL_DATA = 3

Field Value

short

CS_START

protected const short CS_START = 0

Field Value

short

mAllowCertificateStatus

protected bool mAllowCertificateStatus

Field Value

bool

mBlocking

protected bool mBlocking

Field Value

bool

mClientExtensions

protected IDictionary mClientExtensions

Field Value

IDictionary

mConnectionState

protected short mConnectionState

Field Value

short

mExpectSessionTicket

protected bool mExpectSessionTicket

Field Value

bool

mInputBuffers

protected ByteQueueStream mInputBuffers

Field Value

ByteQueueStream

mOfferedCipherSuites

protected int[] mOfferedCipherSuites

Field Value

int[]

mOfferedCompressionMethods

protected byte[] mOfferedCompressionMethods

Field Value

byte[]

mOutputBuffer

protected ByteQueueStream mOutputBuffer

Field Value

ByteQueueStream

mPeerCertificate

protected Certificate mPeerCertificate

Field Value

Certificate

mReceivedChangeCipherSpec

protected bool mReceivedChangeCipherSpec

Field Value

bool

mResumedSession

protected bool mResumedSession

Field Value

bool

mSecureRandom

protected SecureRandom mSecureRandom

Field Value

SecureRandom

mSecureRenegotiation

protected bool mSecureRenegotiation

Field Value

bool

mSecurityParameters

protected SecurityParameters mSecurityParameters

Field Value

SecurityParameters

mServerExtensions

protected IDictionary mServerExtensions

Field Value

IDictionary

mSessionParameters

protected SessionParameters mSessionParameters

Field Value

SessionParameters

mTlsSession

protected TlsSession mTlsSession

Field Value

TlsSession

Properties

Context

protected abstract TlsContext Context { get; }

Property Value

TlsContext

IsClosed

public virtual bool IsClosed { get; }

Property Value

bool

Peer

protected abstract TlsPeer Peer { get; }

Property Value

TlsPeer

Stream

public virtual Stream Stream { get; }

Property Value

Stream

Methods

ApplicationDataAvailable()

protected virtual int ApplicationDataAvailable()

Returns

int

ApplyMaxFragmentLengthExtension()

protected virtual void ApplyMaxFragmentLengthExtension()

AssertEmpty(MemoryStream)

protected static void AssertEmpty(MemoryStream buf)

Parameters

buf MemoryStream

BlockForHandshake()

protected virtual void BlockForHandshake()

CheckReceivedChangeCipherSpec(bool)

protected virtual void CheckReceivedChangeCipherSpec(bool expected)

Parameters

expected bool

CleanupHandshake()

protected virtual void CleanupHandshake()

Close()

public virtual void Close()

CloseInput()

public virtual void CloseInput()

CompleteHandshake()

protected virtual void CompleteHandshake()

CreateRandomBlock(bool, IRandomGenerator)

protected static byte[] CreateRandomBlock(bool useGmtUnixTime, IRandomGenerator randomGenerator)

Parameters

useGmtUnixTime bool
randomGenerator IRandomGenerator

Returns

byte[]

CreateRenegotiationInfo(byte[])

protected static byte[] CreateRenegotiationInfo(byte[] renegotiated_connection)

Parameters

renegotiated_connection byte[]

Returns

byte[]

CreateVerifyData(bool)

protected virtual byte[] CreateVerifyData(bool isServer)

Parameters

isServer bool

Returns

byte[]

EstablishMasterSecret(TlsContext, TlsKeyExchange)

protected static void EstablishMasterSecret(TlsContext context, TlsKeyExchange keyExchange)

Parameters

context TlsContext
keyExchange TlsKeyExchange

Flush()

protected virtual void Flush()

GetAvailableInputBytes()

public virtual int GetAvailableInputBytes()

Returns

int

GetAvailableOutputBytes()

public virtual int GetAvailableOutputBytes()

Returns

int

GetCurrentPrfHash(TlsContext, TlsHandshakeHash, byte[])

protected static byte[] GetCurrentPrfHash(TlsContext context, TlsHandshakeHash handshakeHash, byte[] sslSender)

Parameters

context TlsContext
handshakeHash TlsHandshakeHash
sslSender byte[]

Returns

byte[]

GetPrfAlgorithm(TlsContext, int)

protected static int GetPrfAlgorithm(TlsContext context, int ciphersuite)

Parameters

context TlsContext
ciphersuite int

Returns

int

HandleAlertMessage(byte, byte)

protected virtual void HandleAlertMessage(byte alertLevel, byte alertDescription)

Parameters

alertLevel byte
alertDescription byte

HandleAlertWarningMessage(byte)

protected virtual void HandleAlertWarningMessage(byte alertDescription)

Parameters

alertDescription byte

HandleChangeCipherSpecMessage()

protected virtual void HandleChangeCipherSpecMessage()

HandleClose(bool)

protected virtual void HandleClose(bool user_canceled)

Parameters

user_canceled bool

HandleException(byte, string, Exception)

protected virtual void HandleException(byte alertDescription, string message, Exception cause)

Parameters

alertDescription byte
message string
cause Exception

HandleFailure()

protected virtual void HandleFailure()

HandleHandshakeMessage(byte, MemoryStream)

protected abstract void HandleHandshakeMessage(byte type, MemoryStream buf)

Parameters

type byte
buf MemoryStream

InvalidateSession()

protected virtual void InvalidateSession()

OfferInput(byte[])

public virtual void OfferInput(byte[] input)

Parameters

input byte[]

OfferOutput(byte[], int, int)

public virtual void OfferOutput(byte[] buffer, int offset, int length)

Parameters

buffer byte[]
offset int
length int

ProcessFinishedMessage(MemoryStream)

protected virtual void ProcessFinishedMessage(MemoryStream buf)

Parameters

buf MemoryStream

ProcessMaxFragmentLengthExtension(IDictionary, IDictionary, byte)

protected virtual short ProcessMaxFragmentLengthExtension(IDictionary clientExtensions, IDictionary serverExtensions, byte alertDescription)

Parameters

clientExtensions IDictionary
serverExtensions IDictionary
alertDescription byte

Returns

short

ProcessRecord(byte, byte[], int, int)

protected void ProcessRecord(byte protocol, byte[] buf, int off, int len)

Parameters

protocol byte
buf byte[]
off int
len int

RaiseAlertFatal(byte, string, Exception)

protected virtual void RaiseAlertFatal(byte alertDescription, string message, Exception cause)

Parameters

alertDescription byte
message string
cause Exception

RaiseAlertWarning(byte, string)

protected virtual void RaiseAlertWarning(byte alertDescription, string message)

Parameters

alertDescription byte
message string

ReadApplicationData(byte[], int, int)

protected virtual int ReadApplicationData(byte[] buf, int offset, int len)

Parameters

buf byte[]
offset int
len int

Returns

int

ReadExtensions(MemoryStream)

protected static IDictionary ReadExtensions(MemoryStream input)

Parameters

input MemoryStream

Returns

IDictionary

ReadInput(byte[], int, int)

public virtual int ReadInput(byte[] buffer, int offset, int length)

Parameters

buffer byte[]
offset int
length int

Returns

int

ReadOutput(byte[], int, int)

public virtual int ReadOutput(byte[] buffer, int offset, int length)

Parameters

buffer byte[]
offset int
length int

Returns

int

ReadSupplementalDataMessage(MemoryStream)

protected static IList ReadSupplementalDataMessage(MemoryStream input)

Parameters

input MemoryStream

Returns

IList

RefuseRenegotiation()

protected virtual void RefuseRenegotiation()

SafeCheckRecordHeader(byte[])

protected virtual void SafeCheckRecordHeader(byte[] recordHeader)

Parameters

recordHeader byte[]

SafeReadRecord()

protected virtual void SafeReadRecord()

SafeWriteRecord(byte, byte[], int, int)

protected virtual void SafeWriteRecord(byte type, byte[] buf, int offset, int len)

Parameters

type byte
buf byte[]
offset int
len int

SendCertificateMessage(Certificate)

protected virtual void SendCertificateMessage(Certificate certificate)

Parameters

certificate Certificate

SendChangeCipherSpecMessage()

protected virtual void SendChangeCipherSpecMessage()

SendFinishedMessage()

protected virtual void SendFinishedMessage()

SendSupplementalDataMessage(IList)

protected virtual void SendSupplementalDataMessage(IList supplementalData)

Parameters

supplementalData IList

SetAppDataSplitMode(int)

protected virtual void SetAppDataSplitMode(int appDataSplitMode)

Parameters

appDataSplitMode int

WriteData(byte[], int, int)

protected virtual void WriteData(byte[] buf, int offset, int len)

Parameters

buf byte[]
offset int
len int

WriteExtensions(Stream, IDictionary)

protected static void WriteExtensions(Stream output, IDictionary extensions)

Parameters

output Stream
extensions IDictionary

WriteHandshakeMessage(byte[], int, int)

protected virtual void WriteHandshakeMessage(byte[] buf, int off, int len)

Parameters

buf byte[]
off int
len int

WriteSelectedExtensions(Stream, IDictionary, bool)

protected static void WriteSelectedExtensions(Stream output, IDictionary extensions, bool selectEmpty)

Parameters

output Stream
extensions IDictionary
selectEmpty bool

WriteSupplementalData(Stream, IList)

protected static void WriteSupplementalData(Stream output, IList supplementalData)

Parameters

output Stream
supplementalData IList