Authentication
API v8.1 SP2

com.rsa.ace.techservice.cipher
Class AgentSHA1MAC

java.lang.Object
  extended by com.rsa.ace.techservice.cipher.AgentSHA1MAC

public class AgentSHA1MAC
extends java.lang.Object

Agent SHA1 Message Authentication Code generator. Uses a JSAFE Message Digest object to generate a MAC for agent packets.


Method Summary
 byte[] generateMAC(byte[] macInput, int macInputLength)
          Message Authentication Code generator.
 void setHMACKey(byte[] keyData)
          Sets the HMAC key.
 boolean verifyMAC(byte[] inputToVerify, int inputLength, byte[] macToVerify, int macStartingByte, int macBytesToCompare)
          Message Authentication Code verifier.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setHMACKey

public void setHMACKey(byte[] keyData)
                throws AgentCipherException
Sets the HMAC key. This concatenates the key with the 'salt' value and then uses SHA-1 to generate a pair of padding values.

Parameters:
keyData - The key data to be used in pad-value generation.
Throws:
AgentCipherException - If the key is too large or for crypto exceptions.

generateMAC

public byte[] generateMAC(byte[] macInput,
                          int macInputLength)
                   throws AgentCipherException
Message Authentication Code generator. Uses the underlying JSAFE Message Digest object. The inner pad and data are digested first. Then the outer pad data and the first digest are re-digtested.

Parameters:
macInput - The array to be MACd.
macInputLength - The length of the data array to be MACd.
Throws:
AgentCipherException - If crypto layer exceptions are thrown.

verifyMAC

public boolean verifyMAC(byte[] inputToVerify,
                         int inputLength,
                         byte[] macToVerify,
                         int macStartingByte,
                         int macBytesToCompare)
                  throws AgentCipherException
Message Authentication Code verifier. The input to MAC is passed off to the "generateMAC" method and a portion of the result is compared to the MAC to verify. To minimize array copying, a starting offset is provided so the comparison can occur directly out of the array. The input to be verified and the MAC to verify arrays may be the same, with the lengths and starting byte offset controlling the access.

Parameters:
inputToVerify - The array to be MACd and verified.
inputLength - The length of the data array to be MACd.
macToVerify - The array containing the previously generated MAC.
macStartingByte - The array offset at which the MAC starts.
macBytesToCompare - The number of bytes to be used in the comparison.
Throws:
AgentCipherException - If parameter sizes don't make sense..

Authentication
API v8.1 SP2

Copyright © 1999 - 2011 EMC Corporation. All Rights Reserved.