Table of Contents

Interface TlsSuiteMac

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

Base interface for a generic TLS MAC implementation for use with a bulk cipher.

public interface TlsSuiteMac

Properties

Size

Return the output length (in bytes) of this MAC.

int Size { get; }

Property Value

int

The output length of this MAC.

Methods

CalculateMac(long, short, byte[], int, int)

Calculate the MAC for some given data.

byte[] CalculateMac(long seqNo, short type, byte[] message, int offset, int length)

Parameters

seqNo long

The sequence number of the record.

type short

The content type of the message.

message byte[]

A byte array containing the message.

offset int

The number of bytes to skip, before the message starts.

length int

The length of the message.

Returns

byte[]

A new byte array containing the MAC value.

CalculateMac(long, short, ReadOnlySpan<byte>)

byte[] CalculateMac(long seqNo, short type, ReadOnlySpan<byte> message)

Parameters

seqNo long
type short
message ReadOnlySpan<byte>

Returns

byte[]

CalculateMacConstantTime(long, short, byte[], int, int, int, byte[])

Constant time calculation of the MAC for some given data with a given expected length.

byte[] CalculateMacConstantTime(long seqNo, short type, byte[] message, int offset, int length, int expectedLength, byte[] randomData)

Parameters

seqNo long

The sequence number of the record.

type short

The content type of the message.

message byte[]

A byte array containing the message.

offset int

The number of bytes to skip, before the message starts.

length int

The length of the message.

expectedLength int

The expected length of the full message.

randomData byte[]

Random data for padding out the MAC calculation if required.

Returns

byte[]

A new byte array containing the MAC value.