|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.maverick.ssh2.SshHmac
Data integrity is provided by the SSH Transport Protocol by including with each packet a message authentication code (MAC) that is computed from a shared secret, packet sequence number, and the contents of the packet. This class implements a wrapper around the digests so additional implementations need only concern themselves with the actual digest implementation.
Constructor Summary | |
SshHmac(java.lang.String name,
com.maverick.crypto.digests.HMac mac)
Construct an uninitialized MAC |
Method Summary | |
void |
generate(long sequenceNo,
byte[] data,
int offset,
int len,
byte[] output,
int start)
Generate a MAC from the data supplied. |
java.lang.String |
getAlgorithm()
Get the algorithm name |
int |
getMacLength()
Get the length of the MAC. |
void |
init(byte[] keydata)
Initialize the MAC |
boolean |
verify(long sequenceNo,
byte[] data,
int start,
int len,
byte[] mac,
int offset)
Verify a MAC. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public SshHmac(java.lang.String name, com.maverick.crypto.digests.HMac mac)
name
- the name of the algorithm, for example "hmac-sha1"Method Detail |
public java.lang.String getAlgorithm()
public int getMacLength()
public void generate(long sequenceNo, byte[] data, int offset, int len, byte[] output, int start)
sequenceNo
- the sequence no of the transport protocol messagedata
- the data to generate a MAC fromoffset
- the offset in the data to startlen
- the length of data to process
public void init(byte[] keydata) throws SshException
keydata
- the key data
java.io.IOException
SshException
public boolean verify(long sequenceNo, byte[] data, int start, int len, byte[] mac, int offset) throws SshException
sequenceNo
- the sequence no of the transport protocol messagedata
- the data including the mac to verifystart
- the start of the datalen
- the length of the data
true
if the MAC is corrent, otherwise false
java.io.IOException
SshException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |