com.sun.management.snmp.usm
Class SnmpUsmDesAlgorithm

java.lang.Object
  extended by com.sun.management.snmp.usm.SnmpUsmDesAlgorithm
All Implemented Interfaces:
SnmpUsmAlgorithm, SnmpUsmPrivAlgorithm

public class SnmpUsmDesAlgorithm
extends Object
implements SnmpUsmPrivAlgorithm

This is an implementation of Des encryption algorithm. It is based on JCE. If you use this algorithm, make sure that JCE jar files are accessible.

Since:
Java DMK 5.1

Field Summary
static String DES_PRIV
          Algorithm name as defined in rfc 2574, "usmDESPrivProtocol".
 
Constructor Summary
SnmpUsmDesAlgorithm(SnmpEngine engine)
          Constructor.
SnmpUsmDesAlgorithm(SnmpEngine engine, String properties_encrypt, String properties_decrypt)
          Constructor.
 
Method Summary
 byte[] decrypt(byte[] key, com.sun.management.internal.snmp.SnmpEncryptionPair pair)
          Decrypts the passed encrypted data using the provided IV parameter.
 com.sun.management.internal.snmp.SnmpEncryptionPair encrypt(byte[] key, byte[] data, int dataLength)
          Encrypts the passed data with the provided key.
 String getAlgorithm()
          Gets the unique algorithm name.
 int getDeltaSize()
          Gets the delta size.
 int getKeySize()
          The privacy algorithm key size.
 String getOid()
          Gets the algorithm OID as defined in RFC 2574.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.sun.management.snmp.usm.SnmpUsmAlgorithm
getAlgorithm
 

Field Detail

DES_PRIV

public static final String DES_PRIV
Algorithm name as defined in rfc 2574, "usmDESPrivProtocol".

See Also:
Constant Field Values
Constructor Detail

SnmpUsmDesAlgorithm

public SnmpUsmDesAlgorithm(SnmpEngine engine)
                    throws SnmpUsmException
Constructor.

Parameters:
engine - The local snmp engine.
Throws:
SnmpUsmException

SnmpUsmDesAlgorithm

public SnmpUsmDesAlgorithm(SnmpEngine engine,
                           String properties_encrypt,
                           String properties_decrypt)
                    throws SnmpUsmException
Constructor.

Parameters:
engine - The local SNMP engine.
properties_encrypt - The String used to instantiate the proper JCE Cipher encryption object.
properties_decrypt - The String used to instantiate the proper JCE Cipher decryption object.
Throws:
SnmpUsmException
Method Detail

getKeySize

public int getKeySize()
The privacy algorithm key size.

Specified by:
getKeySize in interface SnmpUsmPrivAlgorithm
Returns:
The key size.

getDeltaSize

public int getDeltaSize()
Gets the delta size. The returned value is 16.

Specified by:
getDeltaSize in interface SnmpUsmAlgorithm
Specified by:
getDeltaSize in interface SnmpUsmPrivAlgorithm
Returns:
The delta size.

getOid

public String getOid()
Gets the algorithm OID as defined in RFC 2574.

Specified by:
getOid in interface SnmpUsmAlgorithm
Returns:
The OID 1.3.6.1.6.3.10.1.2.2

encrypt

public com.sun.management.internal.snmp.SnmpEncryptionPair encrypt(byte[] key,
                                                                   byte[] data,
                                                                   int dataLength)
                                                            throws SnmpUsmException
Encrypts the passed data with the provided key.

Specified by:
encrypt in interface SnmpUsmPrivAlgorithm
Parameters:
key - The key to use.
data - The data to encrypt.
dataLength - The data length.
Returns:
The encrypted data + IV parameter.
Throws:
SnmpUsmException

decrypt

public byte[] decrypt(byte[] key,
                      com.sun.management.internal.snmp.SnmpEncryptionPair pair)
               throws SnmpUsmException
Decrypts the passed encrypted data using the provided IV parameter.

Specified by:
decrypt in interface SnmpUsmPrivAlgorithm
Parameters:
key - The Des key.
pair - The data + IV parameter.
Returns:
the decrypted data.
Throws:
SnmpUsmException

getAlgorithm

public String getAlgorithm()
Description copied from interface: SnmpUsmAlgorithm
Gets the unique algorithm name.

Specified by:
getAlgorithm in interface SnmpUsmAlgorithm
Returns:
Algorithm name.

Open Source build 02
opendmk-1.0-b02 2007.10.01_19:17:46_MEST

Copyright 1998-2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.