Class TlsSuiteHmac
- Namespace
- Org.BouncyCastle.Tls.Crypto.Impl
- Assembly
- BouncyCastle.Cryptography.dll
A generic TLS MAC implementation, acting as an HMAC based on some underlying Digest.
public class TlsSuiteHmac : TlsSuiteMac
- Inheritance
-
TlsSuiteHmac
- Implements
- Inherited Members
Constructors
TlsSuiteHmac(TlsCryptoParameters, TlsHmac)
Generate a new instance of a TlsMac.
public TlsSuiteHmac(TlsCryptoParameters cryptoParams, TlsHmac mac)
Parameters
cryptoParamsTlsCryptoParametersthe TLS client context specific crypto parameters.
macTlsHmacThe MAC to use.
Fields
m_cryptoParams
protected readonly TlsCryptoParameters m_cryptoParams
Field Value
m_digestBlockSize
protected readonly int m_digestBlockSize
Field Value
m_digestOverhead
protected readonly int m_digestOverhead
Field Value
m_mac
protected readonly TlsHmac m_mac
Field Value
m_macSize
protected readonly int m_macSize
Field Value
Properties
Size
Return the output length (in bytes) of this MAC.
public virtual int Size { get; }
Property Value
- int
The output length of this MAC.
Methods
CalculateMac(long, short, byte[], byte[], int, int)
public virtual byte[] CalculateMac(long seqNo, short type, byte[] connectionID, byte[] msg, int msgOff, int msgLen)
Parameters
Returns
- byte[]
CalculateMac(long, short, byte[], int, int)
Calculate the MAC for some given data.
public virtual byte[] CalculateMac(long seqNo, short type, byte[] msg, int msgOff, int msgLen)
Parameters
seqNolongThe sequence number of the record.
typeshortThe content type of the message.
msgbyte[]msgOffintmsgLenint
Returns
- byte[]
A new byte array containing the MAC value.
CalculateMac(long, short, ReadOnlySpan<byte>)
public virtual byte[] CalculateMac(long seqNo, short type, ReadOnlySpan<byte> message)
Parameters
seqNolongtypeshortmessageReadOnlySpan<byte>
Returns
- byte[]
CalculateMac(long, short, ReadOnlySpan<byte>, ReadOnlySpan<byte>)
public virtual byte[] CalculateMac(long seqNo, short type, ReadOnlySpan<byte> connectionID, ReadOnlySpan<byte> message)
Parameters
seqNolongtypeshortconnectionIDReadOnlySpan<byte>messageReadOnlySpan<byte>
Returns
- byte[]
CalculateMacConstantTime(long, short, byte[], byte[], int, int, int, byte[])
public virtual byte[] CalculateMacConstantTime(long seqNo, short type, byte[] connectionID, byte[] msg, int msgOff, int msgLen, int fullLength, byte[] dummyData)
Parameters
seqNolongtypeshortconnectionIDbyte[]msgbyte[]msgOffintmsgLenintfullLengthintdummyDatabyte[]
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.
public virtual byte[] CalculateMacConstantTime(long seqNo, short type, byte[] msg, int msgOff, int msgLen, int fullLength, byte[] dummyData)
Parameters
seqNolongThe sequence number of the record.
typeshortThe content type of the message.
msgbyte[]msgOffintmsgLenintfullLengthintdummyDatabyte[]
Returns
- byte[]
A new byte array containing the MAC value.
GetDigestBlockCount(int)
protected virtual int GetDigestBlockCount(int inputLength)
Parameters
inputLengthint
Returns
GetHeaderLength(byte[])
protected virtual int GetHeaderLength(byte[] connectionID)
Parameters
connectionIDbyte[]
Returns
GetMacSize(TlsCryptoParameters, TlsMac)
protected static int GetMacSize(TlsCryptoParameters cryptoParams, TlsMac mac)
Parameters
cryptoParamsTlsCryptoParametersmacTlsMac
Returns
Truncate(byte[])
protected virtual byte[] Truncate(byte[] bs)
Parameters
bsbyte[]
Returns
- byte[]