de.flexiprovider.core.mac
Class HMacKey

java.lang.Object
  |
  +--de.flexiprovider.core.mac.HMacKey
All Implemented Interfaces:
java.security.Key, Key, SecretKey, javax.crypto.SecretKey, java.io.Serializable

public class HMacKey
extends java.lang.Object
implements SecretKey

A simple class representing a key for Hmac. The Key is derived by a Key Derivation Function using a hash function (SHA1 or MD5). This class is provided for PKCS#12. A PFX PDU may be password-integrity-protected. The key for HmacSHA1 computation shall be derived by a Key Derivation Function PBKDF1 as described in PKCS #5.

Author:
Michele Boivin
See Also:
Serialized Form

Fields inherited from interface java.security.Key
serialVersionUID
 
Constructor Summary
protected HMacKey(byte[] keyBytes)
          Construct a new Hmac key from the specified key bytes.
 
Method Summary
 boolean equals(java.lang.Object other)
           
 java.lang.String getAlgorithm()
          Return the name of the algorithm the key is used with.
 byte[] getEncoded()
           
 java.lang.String getFormat()
           
 int hashCode()
           
 
Methods inherited from class java.lang.Object
, clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HMacKey

protected HMacKey(byte[] keyBytes)
Construct a new Hmac key from the specified key bytes.
Parameters:
keyBytes - a byte array containing a key
Method Detail

getAlgorithm

public java.lang.String getAlgorithm()
Return the name of the algorithm the key is used with.
Specified by:
getAlgorithm in interface java.security.Key
Returns:
"Hmac"

getEncoded

public byte[] getEncoded()
Specified by:
getEncoded in interface java.security.Key
Returns:
a copy of the key bytes

getFormat

public java.lang.String getFormat()
Specified by:
getFormat in interface java.security.Key
Returns:
the key format

equals

public boolean equals(java.lang.Object other)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object