Table of Contents

Interface TlsCipher

Namespace
Org.BouncyCastle.Tls.Crypto
Assembly
BouncyCastle.Cryptography.dll

Base interface for a TLS bulk cipher.

public interface TlsCipher

Properties

UsesOpaqueRecordType

bool UsesOpaqueRecordType { get; }

Property Value

bool

Methods

DecodeCiphertext(long, short, ProtocolVersion, byte[], int, int)

Decode the passed in ciphertext using the current bulk cipher.

TlsDecodeResult DecodeCiphertext(long seqNo, short recordType, ProtocolVersion recordVersion, byte[] ciphertext, int offset, int len)

Parameters

seqNo long

sequence number of the message represented by ciphertext.

recordType short

content type used in the record for this message.

recordVersion ProtocolVersion

ProtocolVersion used for the record.

ciphertext byte[]

array holding input ciphertext to the cipher.

offset int

offset into input array the ciphertext starts at.

len int

length of the ciphertext in the array.

Returns

TlsDecodeResult

A TlsDecodeResult containing the result of decoding.

Exceptions

IOException

EncodePlaintext(long, short, ProtocolVersion, int, byte[], int, int)

Encode the passed in plaintext using the current bulk cipher.

TlsEncodeResult EncodePlaintext(long seqNo, short contentType, ProtocolVersion recordVersion, int headerAllocation, byte[] plaintext, int offset, int len)

Parameters

seqNo long

sequence number of the message represented by plaintext.

contentType short

content type of the message represented by plaintext.

recordVersion ProtocolVersion

ProtocolVersion used for the record.

headerAllocation int

extra bytes to allocate at start of returned byte array.

plaintext byte[]

array holding input plaintext to the cipher.

offset int

offset into input array the plaintext starts at.

len int

length of the plaintext in the array.

Returns

TlsEncodeResult

A TlsEncodeResult containing the result of encoding (after 'headerAllocation' unused bytes).

Exceptions

IOException

EncodePlaintext(long, short, ProtocolVersion, int, ReadOnlySpan<byte>)

TlsEncodeResult EncodePlaintext(long seqNo, short contentType, ProtocolVersion recordVersion, int headerAllocation, ReadOnlySpan<byte> plaintext)

Parameters

seqNo long
contentType short
recordVersion ProtocolVersion
headerAllocation int
plaintext ReadOnlySpan<byte>

Returns

TlsEncodeResult

GetCiphertextDecodeLimit(int)

Return the maximum input size for a ciphertext given a maximum output size for the plaintext of plaintextLimit bytes.

int GetCiphertextDecodeLimit(int plaintextLimit)

Parameters

plaintextLimit int

the maximum output size for the plaintext.

Returns

int

the maximum input size of the ciphertext for plaintextlimit bytes of output.

GetCiphertextEncodeLimit(int, int)

Return the maximum output size for a ciphertext given an actual input plaintext size of plaintextLength bytes and a maximum input plaintext size of plaintextLimit bytes.

int GetCiphertextEncodeLimit(int plaintextLength, int plaintextLimit)

Parameters

plaintextLength int

the actual input size for the plaintext.

plaintextLimit int

the maximum input size for the plaintext.

Returns

int

the maximum output size of the ciphertext for plaintextlimit bytes of input.

GetPlaintextLimit(int)

Return the maximum size for the plaintext given ciphertextlimit bytes of ciphertext.

int GetPlaintextLimit(int ciphertextLimit)

Parameters

ciphertextLimit int

the maximum number of bytes of ciphertext.

Returns

int

the maximum size of the plaintext for ciphertextlimit bytes of input.

RekeyDecoder()

void RekeyDecoder()

Exceptions

IOException

RekeyEncoder()

void RekeyEncoder()

Exceptions

IOException