com.sshtools.j2ssh.transport.hmac
Class HmacSha

java.lang.Object
  |
  +--com.sshtools.j2ssh.transport.hmac.HmacSha
All Implemented Interfaces:
SshHmac

public class HmacSha
extends java.lang.Object
implements SshHmac

Implements the SHA Hash Message authentication algorithm

Version:
1.0
Author:
Lee David Painter ( lee@sshtools.com )

Constructor Summary
HmacSha()
          Constructor for the HmacSha object
 
Method Summary
 byte[] generate(long sequenceNo, byte[] data, int offset, int len)
          Generates the mac
 int getMacLength()
          Gets the mac length
 void init(byte[] keydata)
          Initates the message authentication with the supplied key data
 boolean verify(long sequenceNo, byte[] data)
          Verifies the mac received
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HmacSha

public HmacSha()
Constructor for the HmacSha object

Method Detail

init

public void init(byte[] keydata)
          throws AlgorithmInitializationException
Initates the message authentication with the supplied key data

Specified by:
init in interface SshHmac
Parameters:
keydata - Key data produced during key exchange
Throws:
AlgorithmInitializationException - Thrown if the mac cannot be initialized

generate

public byte[] generate(long sequenceNo,
                       byte[] data,
                       int offset,
                       int len)
Generates the mac

Specified by:
generate in interface SshHmac
Parameters:
sequenceNo - The sequence no of the message
data - The message data
offset - Description of the Parameter
len - Description of the Parameter
Returns:
The mac

verify

public boolean verify(long sequenceNo,
                      byte[] data)
Verifies the mac received

Specified by:
verify in interface SshHmac
Parameters:
sequenceNo - The sequence no of the message
data - The message data
Returns:
The result of the verification

getMacLength

public int getMacLength()
Gets the mac length

Specified by:
getMacLength in interface SshHmac
Returns:
The mac length


Copyright © 2002 Sshtools.com. All Rights Reserved.