public class TlsMac
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected TlsClientContext |
context |
protected Mac |
mac |
protected byte[] |
secret |
protected long |
seqNo |
Constructor and Description |
---|
TlsMac(TlsClientContext context,
Digest digest,
byte[] key_block,
int offset,
int len)
Generate a new instance of an TlsMac.
|
Modifier and Type | Method and Description |
---|---|
byte[] |
calculateMac(short type,
byte[] message,
int offset,
int len)
Calculate the mac for some given data.
|
byte[] |
getMACSecret() |
long |
getSequenceNumber() |
int |
getSize() |
void |
incSequenceNumber()
Increment the current write sequence number
|
protected TlsClientContext context
protected long seqNo
protected byte[] secret
protected Mac mac
public TlsMac(TlsClientContext context, Digest digest, byte[] key_block, int offset, int len)
context
- the TLS client contextdigest
- The digest to use.key_block
- A byte-array where the key for this mac is located.offset
- The number of bytes to skip, before the key starts in the buffer.len
- The length of the key.public byte[] getMACSecret()
public long getSequenceNumber()
public void incSequenceNumber()
public int getSize()
public byte[] calculateMac(short type, byte[] message, int offset, int len)
type
- The message type of the message.message
- A byte-buffer containing the message.offset
- The number of bytes to skip, before the message starts.len
- The length of the message.