|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.maverick.ssh.components.standalone.AbstractHmac
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 | |
AbstractHmac(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 AbstractHmac(java.lang.String name,
com.maverick.crypto.digests.HMac mac)
name - the name of the algorithm, for example "hmac-sha1"mac - a new instance of a digest.| Method Detail |
public java.lang.String getAlgorithm()
getAlgorithm in interface SshHmacpublic int getMacLength()
getMacLength in interface SshHmac
public void generate(long sequenceNo,
byte[] data,
int offset,
int len,
byte[] output,
int start)
generate in interface SshHmacsequenceNo - 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
init in interface SshHmackeydata - the key data
java.io.IOException
SshException
public boolean verify(long sequenceNo,
byte[] data,
int start,
int len,
byte[] mac,
int offset)
verify in interface SshHmacsequenceNo - 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
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||