public final class TlsSuiteHMac extends java.lang.Object implements TlsSuiteMac
Constructor and Description |
---|
TlsSuiteHMac(TlsCryptoParameters cryptoParams,
TlsHMAC mac)
Generate a new instance of a TlsMac.
|
Modifier and Type | Method and Description |
---|---|
byte[] |
calculateMac(long seqNo,
short type,
byte[] connectionID,
byte[] msg,
int msgOff,
int msgLen)
Calculate the MAC for some given data.
|
byte[] |
calculateMacConstantTime(long seqNo,
short type,
byte[] connectionID,
byte[] msg,
int msgOff,
int msgLen,
int fullLength,
byte[] dummyData)
Constant time calculation of the MAC for some given data with a given expected length.
|
int |
getSize()
Return the output length (in bytes) of this MAC.
|
public TlsSuiteHMac(TlsCryptoParameters cryptoParams, TlsHMAC mac)
cryptoParams
- the TLS client context specific crypto parameters.mac
- The MAC to use.public int getSize()
TlsSuiteMac
getSize
in interface TlsSuiteMac
public byte[] calculateMac(long seqNo, short type, byte[] connectionID, byte[] msg, int msgOff, int msgLen)
TlsSuiteMac
calculateMac
in interface TlsSuiteMac
seqNo
- The sequence number of the record.type
- The content type of the message.msg
- A byte array containing the message.msgOff
- The number of bytes to skip, before the message starts.msgLen
- The length of the message.public byte[] calculateMacConstantTime(long seqNo, short type, byte[] connectionID, byte[] msg, int msgOff, int msgLen, int fullLength, byte[] dummyData)
TlsSuiteMac
calculateMacConstantTime
in interface TlsSuiteMac
seqNo
- The sequence number of the record.type
- The content type of the message.msg
- A byte array containing the message.msgOff
- The number of bytes to skip, before the message starts.msgLen
- The length of the message.fullLength
- The expected length of the full message.dummyData
- Random data for padding out the MAC calculation if required.