Package org.bouncycastle.tls.crypto.impl
Interface TlsSuiteMac
- All Known Implementing Classes:
TlsSuiteHMac
public interface TlsSuiteMac
Base interface for a generic TLS MAC implementation for use with a bulk cipher.
-
Method Summary
Modifier and TypeMethodDescriptionbyte[]calculateMac(long seqNo, short type, byte[] connectionID, byte[] message, int offset, int length) Calculate the MAC for some given data.byte[]calculateMacConstantTime(long seqNo, short type, byte[] connectionID, byte[] message, int offset, int length, int expectedLength, byte[] randomData) Constant time calculation of the MAC for some given data with a given expected length.intgetSize()Return the output length (in bytes) of this MAC.
-
Method Details
-
getSize
int getSize()Return the output length (in bytes) of this MAC.- Returns:
- The output length of this MAC.
-
calculateMac
byte[] calculateMac(long seqNo, short type, byte[] connectionID, byte[] message, int offset, int length) Calculate the MAC for some given data.- Parameters:
seqNo- The sequence number of the record.type- The content type of the message.message- A byte array containing the message.offset- The number of bytes to skip, before the message starts.length- The length of the message.- Returns:
- A new byte array containing the MAC value.
-
calculateMacConstantTime
byte[] calculateMacConstantTime(long seqNo, short type, byte[] connectionID, byte[] message, int offset, int length, int expectedLength, byte[] randomData) Constant time calculation of the MAC for some given data with a given expected length.- Parameters:
seqNo- The sequence number of the record.type- The content type of the message.message- A byte array containing the message.offset- The number of bytes to skip, before the message starts.length- The length of the message.expectedLength- The expected length of the full message.randomData- Random data for padding out the MAC calculation if required.- Returns:
- A new byte array containing the MAC value.
-