Authentication
API v8.1 SP2

com.rsa.ace.techservice.cipher
Class AgentRC5SHA1Cipher

java.lang.Object
  extended by com.rsa.ace.techservice.cipher.AbstractAgentCipherProvider
      extended by com.rsa.ace.techservice.cipher.AgentRC5SHA1Cipher
All Implemented Interfaces:
AgentCipherProvider

public class AgentRC5SHA1Cipher
extends AbstractAgentCipherProvider
implements AgentCipherProvider

Agent Cipher Provider for 128-bit RC-5 with a 64-bit SHA1 HMAC. This class is intended to be re-used. It could be maintained in an Agent cache for agents that have the NodeSecret defined. The 'setKey' method is provided for agents that go thru the process of being assigned a node-secret. The encrypt/decrypt methods here are not able to use the base class methods in the manner intended due to the errors in original 'C' agent API.


Method Summary
 int decryptPacket(byte[] agentEncryption, int headerOffset, byte[] cleartext)
          Decrypts encrypted data starting at the offset provided.
 int encryptPacket(byte[] cleartext, int cleartextLength, int encryptionOffset, byte[] agentEncryption)
          This encrypts the bytes passed starting at the offset provided.
 byte getCipherID()
          This returns the cipher ID of this provider.
 int getMaxEncryptedSize(int inputSize)
          This function provides the maximium amount of expansion encryption adds to a packet.
 void setIV(byte[] ivData)
          Sets the Initialization Vector (IV).
 void setKey(byte[] keyData)
          Sets the encrpytion key.
 
Methods inherited from class com.rsa.ace.techservice.cipher.AbstractAgentCipherProvider
getMajorVersion, getMinorVersion, setBufferArray, setMajorVersion, setMinorVersion
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setKey

public void setKey(byte[] keyData)
            throws AgentCipherException
Sets the encrpytion key. This method can be called to alter the key used for this cipher. (For example, when an agent gets a node-secret.)

Specified by:
setKey in interface AgentCipherProvider
Parameters:
keyData - The key to be used.
Throws:
AgentCipherException - Is thrown for data errors like null key or invalid length.

setIV

public void setIV(byte[] ivData)
           throws AgentCipherException
Sets the Initialization Vector (IV). Normal operation allows the AgentRandom object to provide a new random initialization vector. A caller supplied IV must be provided before each encryption (i.e., a caller supplied IV is only used once for the next encryption; it does not persist). In general, this method is only called externally for debugging purposes.

Parameters:
ivData - The Initialization Vector to be used. Must be exactly IV_SIZE bytes.
Throws:
AgentCipherException - If the IV length is not valid.

decryptPacket

public int decryptPacket(byte[] agentEncryption,
                         int headerOffset,
                         byte[] cleartext)
                  throws AgentCipherException
Decrypts encrypted data starting at the offset provided.

Specified by:
decryptPacket in interface AgentCipherProvider
Parameters:
agentEncryption - The data to be decrypted.
headerOffset - The offset at which the agent packet (header) starts.
cleartext - The cleartext buffer filled upon return.
Returns:
The length of the decrypted data.
Throws:
AgentCipherException - If crypto errors occur or parameters are invalid.

encryptPacket

public int encryptPacket(byte[] cleartext,
                         int cleartextLength,
                         int encryptionOffset,
                         byte[] agentEncryption)
                  throws AgentCipherException
This encrypts the bytes passed starting at the offset provided.

Specified by:
encryptPacket in interface AgentCipherProvider
Parameters:
cleartext - The cleartext buffer to be encrypted.
cleartextLength - The length of the cleartext buffer to be encrypted.
encryptionOffset - The offset at which the data should be encrypted.
agentEncryption - The returned encrypted data.
Returns:
The length of the encrypted result.
Throws:
AgentCipherException - If crypto errors occur or parameters are invalid.

getCipherID

public byte getCipherID()
This returns the cipher ID of this provider.

Specified by:
getCipherID in interface AgentCipherProvider
Returns:
The cipher ID.

getMaxEncryptedSize

public int getMaxEncryptedSize(int inputSize)
This function provides the maximium amount of expansion encryption adds to a packet. The RC5 SHA1 uses the parent class and add an IV, a trailing MAC and extra for RC5 block expansion.

Specified by:
getMaxEncryptedSize in interface AgentCipherProvider
Overrides:
getMaxEncryptedSize in class AbstractAgentCipherProvider
Parameters:
inputSize - The size of the cleartext input.
Returns:
The number of extra bytes required for the given input packet size.

Authentication
API v8.1 SP2

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