com.adventnet.snmp.snmp2.usm
Class USMSecurity

java.lang.Object
  extended by com.adventnet.snmp.snmp2.usm.USMSecurity
Direct Known Subclasses:
USMSecurityCryptix31, USMSecurityCryptix32, USMSecurityJCE

abstract class USMSecurity
extends java.lang.Object


Constructor Summary
USMSecurity()
           
 
Method Summary
(package private) abstract  byte[] decrypt(byte[] data, int offset, byte[] key, byte[] privParams, int privProtocol, int engineBoots, int engineTime)
          This method is used for decrypting the data from the offset position till data's end.
(package private) abstract  int encrypt(byte[] data, int offset, byte[] key, byte[] privParms, int privProtocol, int engineBoots, int engineTime)
          This method is used for encrypting the data from the offset position till data's end.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

USMSecurity

USMSecurity()
Method Detail

encrypt

abstract int encrypt(byte[] data,
                     int offset,
                     byte[] key,
                     byte[] privParms,
                     int privProtocol,
                     int engineBoots,
                     int engineTime)
              throws SnmpException
This method is used for encrypting the data from the offset position till data's end. The encrypted data will be filled in data. As per the standard draft-blumenthal-aes-usm-08.txt, the engine boots and engine time values should be used for calculating the salt. Hence both these values are passed as an argument.

Parameters:
data - the byte array which contains the data to be encrypted.
offset - the position from which data should be encrypted.
key - the privKey which is calculated from the privPassword.
privParams - the privParams which is present in the SNMPv3 auth-priv data.
privProtocol - the privacy protocol for this user. supported privacy protocols are CBC-DES and CFB-AES-128.
engineBoots - the engineBoots value associated with the snmp engine.
engineTime - the engineTime value associated with the snmp engine.
Returns:
The location from where this encrypted data has been filled inside data.
Throws:
SnmpException

decrypt

abstract byte[] decrypt(byte[] data,
                        int offset,
                        byte[] key,
                        byte[] privParams,
                        int privProtocol,
                        int engineBoots,
                        int engineTime)
This method is used for decrypting the data from the offset position till data's end. As per the standard draft-blumenthal-aes-usm-08.txt, the engine boots and engine time values should be used for calculating the salt. Hence both these values are passed as an argument.

Parameters:
data - the byte array which contains the data to be decrypted.
offset - the position from which data should be decrypted.
key - the privKey which is calculated from the privPassword.
privParams - the privParams which is present in the SNMPv3 auth-priv data.
privProtocol - the privacy protocol for this user. supported privacy protocols are CBC-DES and CFB-AES-128.
engineBoots - the engineBoots value associated with the snmp engine.
engineTime - the engineTime value associated with the snmp engine.
Returns:
the decrypted data as a byte array. This method will return null if any decryption error occurs.