Skip navigation links

Oracle Fusion Middleware Crypto FIPS Java API Reference for Oracle Security Developer Tools
11g Release 1 (11.1.1)

E10696-05


oracle.security.crypto.core
Class MAC

java.lang.Object
  extended by oracle.security.crypto.core.MessageDigest
      extended by oracle.security.crypto.core.MAC

All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
HMAC

public abstract class MAC
extends MessageDigest

An abstract class for Message Authentication Code.

See Also:
HMAC

Nested Class Summary

 

Nested classes/interfaces inherited from class oracle.security.crypto.core.MessageDigest
MessageDigest.MDState

 

Field Summary

 

Fields inherited from class oracle.security.crypto.core.MessageDigest
algID, digestBits, digestValid

 

Constructor Summary
protected MAC()
          Empty constructor.

 

Method Summary
 byte[] computeMAC()
          Computes the MAC based on the data entered with the update() methods.
 byte[] computeMAC(byte[] document)
          Computes the MAC based on the specified parameter.
abstract  void erase()
          Erases the sensitive data.
static MAC getInstance(AlgorithmIdentifier algID, SymmetricKey key)
          Creates a new initialized MAC instance with the specified parameters.
abstract  void initialize(AlgorithmIdentifier algID, SymmetricKey key)
          Initializes this MAC with the specified parameter.
 boolean verifyMAC(byte[] macBytes)
          Verifies the MAC based on the data entered with the update() methods and the parameter.
 boolean verifyMAC(byte[] document, byte[] macBytes)
          Verifies the MAC based on the specified parameters.

 

Methods inherited from class oracle.security.crypto.core.MessageDigest
algName, blockSize, clone, computeCurrent, computeDigest, computeDigest, getAlgID, getDigestBits, getDigestLength, getInstance, getState, init, isEqual, isValid, setAlgID, setState, toString, update, update, update, update, update, update, update, update, update, update, update, update, update, updateASCII

 

Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

 

Constructor Detail

MAC

protected MAC()
Empty constructor.

Method Detail

getInstance

public static MAC getInstance(AlgorithmIdentifier algID,
                              SymmetricKey key)
                       throws AlgorithmIdentifierException
Creates a new initialized MAC instance with the specified parameters.
Parameters:
algID - The MAC algorithm identifier representing the MAC instance to create (can be AlgID.hmacMD5, AlgID.hmacSHA...).
key - The key to use in this MAC. The key bytes will be cloned when initialized.
Returns:
The initialized MAC instance.
Throws:
AlgorithmIdentifierException

initialize

public abstract void initialize(AlgorithmIdentifier algID,
                                SymmetricKey key)
                         throws AlgorithmIdentifierException
Initializes this MAC with the specified parameter.
Parameters:
algID - The MAC algorithm.
key - The key to use in this MAC. The key bytes will be cloned when initialized.
Throws:
AlgorithmIdentifierException

computeMAC

public byte[] computeMAC()
Computes the MAC based on the data entered with the update() methods.
Returns:
A byte array containing the MAC value.

computeMAC

public byte[] computeMAC(byte[] document)
Computes the MAC based on the specified parameter. This method will call init(), then update(), then computes the MAC.
Parameters:
document - The document to digest to calculate the MAC.
Returns:
A byte array containing the MAC value.

verifyMAC

public boolean verifyMAC(byte[] macBytes)
Verifies the MAC based on the data entered with the update() methods and the parameter.
Parameters:
macBytes - The MAC value to compare to the result of the MAC computation.
Returns:
true if the computed MAC is identical to the parameter, false otherwise.

verifyMAC

public boolean verifyMAC(byte[] document,
                         byte[] macBytes)
Verifies the MAC based on the specified parameters. This method will call init(), then update(), then computes the MAC and compares it with the macBytes.
Parameters:
document - The document to digest to calculate the MAC.
macBytes - The MAC value to compare to the result of the MAC computation.
Returns:
true if the computed MAC is identical to the parameter, false otherwise.

erase

public abstract void erase()
Erases the sensitive data.

Skip navigation links

Oracle Fusion Middleware Crypto FIPS Java API Reference for Oracle Security Developer Tools
11g Release 1 (11.1.1)

E10696-05


Copyright © 2005, 2013, Oracle. All rights reserved.