com.maverick.ssh.components.jce
Class AbstractHmac

java.lang.Object
  extended by com.maverick.ssh.components.jce.AbstractHmac
All Implemented Interfaces:
SshHmac
Direct Known Subclasses:
HmacMD5, HmacMD596, HmacSha1, HmacSha196, HmacSha256, HmacSha512

public abstract class AbstractHmac
extends java.lang.Object
implements SshHmac

An abstract class that implements the SshHmac interface to provide support for JCE based message authentication.

Author:
Lee David Painter

Field Summary
protected  java.lang.String jceAlgorithm
           
protected  javax.crypto.Mac mac
           
protected  int macLength
           
protected  int macSize
           
 
Constructor Summary
AbstractHmac(java.lang.String jceAlgorithm, int macLength)
           
AbstractHmac(java.lang.String jceAlgorithm, int macSize, int outputLength)
           
 
Method Summary
 byte[] doFinal()
           
 void generate(long sequenceNo, byte[] data, int offset, int len, byte[] output, int start)
           
abstract  java.lang.String getAlgorithm()
           
 int getMacLength()
           
 java.lang.String getProvider()
           
 void init(byte[] keydata)
           
 void update(byte[] b)
           
 boolean verify(long sequenceNo, byte[] data, int start, int len, byte[] mac, int offset)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mac

protected javax.crypto.Mac mac

macSize

protected int macSize

macLength

protected int macLength

jceAlgorithm

protected java.lang.String jceAlgorithm
Constructor Detail

AbstractHmac

public AbstractHmac(java.lang.String jceAlgorithm,
                    int macLength)

AbstractHmac

public AbstractHmac(java.lang.String jceAlgorithm,
                    int macSize,
                    int outputLength)
Method Detail

generate

public void generate(long sequenceNo,
                     byte[] data,
                     int offset,
                     int len,
                     byte[] output,
                     int start)
Specified by:
generate in interface SshHmac

update

public void update(byte[] b)
Specified by:
update in interface SshHmac

doFinal

public byte[] doFinal()
Specified by:
doFinal in interface SshHmac

getAlgorithm

public abstract java.lang.String getAlgorithm()
Specified by:
getAlgorithm in interface SshHmac

getProvider

public java.lang.String getProvider()

getMacLength

public int getMacLength()
Specified by:
getMacLength in interface SshHmac

init

public void init(byte[] keydata)
          throws SshException
Specified by:
init in interface SshHmac
Throws:
SshException

verify

public boolean verify(long sequenceNo,
                      byte[] data,
                      int start,
                      int len,
                      byte[] mac,
                      int offset)
Specified by:
verify in interface SshHmac


Copyright © 2003-2008 SSHTools LTD. All Rights Reserved.