| 
SNMP Stack 4_12 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--uk.co.westhawk.snmp.util.SnmpUtilities
This class contains utilities for key and authentication encoding. See RFC 2574.
| Constructor Summary | |
SnmpUtilities()
 | 
|
| Method Summary | |
static boolean | 
areBytesEqual(byte[] array1,
              byte[] array2)
Compaires two byte arrays and returns if they are equal.  | 
static byte[] | 
decrypt(byte[] encryptedText,
        byte[] salt,
        byte[] secretPrivacyKey)
Decryptes bytes using DES.  | 
static void | 
dumpBytes(java.lang.String headerStr,
          byte[] bytes)
Dumps (prints) the byte array.  | 
static byte[] | 
encrypt(byte[] plain,
        byte[] secretPrivacyKey,
        byte[] salt)
Encrypts bytes using DES.  | 
static byte[] | 
getDESKey(byte[] secretPrivacyKey)
Returns the DES key.  | 
static byte[] | 
getFingerPrintMD5(byte[] key,
                  byte[] message)
Returns the 12 byte MD5 fingerprint.  | 
static byte[] | 
getFingerPrintSHA1(byte[] key,
                   byte[] message)
Returns the 12 byte SHA1 fingerprint.  | 
static byte[] | 
getInitialValue(byte[] secretPrivacyKey,
                byte[] salt)
Returns the DES initial value.  | 
static byte[] | 
getLocalizedKeyMD5(byte[] passwKey,
                   java.lang.String engineId)
Converts the user's password and the SNMP Engine Id to the localized key using the MD5 protocol.  | 
static byte[] | 
getLocalizedKeySHA1(byte[] passwKey,
                    java.lang.String engineId)
Converts the user's password and the SNMP Engine Id to the localized key using the SHA protocol.  | 
static byte[] | 
getSaltDES(int snmpEngineBoots)
Returns the DES salt.  | 
static java.lang.String | 
getSnmpVersionString(int version)
Returns the String representation of the SNMP version number.  | 
static byte[] | 
passwordToKeyMD5(java.lang.String password)
Converts the user's password to an authentication key using the MD5 protocol.  | 
static byte[] | 
passwordToKeySHA1(java.lang.String password)
Converts the user's password to an authentication key using the SHA1 protocol.  | 
static byte[] | 
toBytes(java.lang.String hexStr)
Converts a hexadecimal ASCII string to a byte array.  | 
static java.lang.String | 
toHex(int val)
Converts one int to a hexadecimal ASCII string.  | 
static java.lang.String | 
toHexString(byte[] bytes)
Converts a byte array to a hexadecimal ASCII string.  | 
| Methods inherited from class java.lang.Object | 
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Constructor Detail | 
public SnmpUtilities()
| Method Detail | 
public static java.lang.String getSnmpVersionString(int version)
version - The version numberpublic static byte[] toBytes(java.lang.String hexStr)
toHexString.hexStr - The string representing a hexadecimal numbertoHexString(byte[])
public static void dumpBytes(java.lang.String headerStr,
                             byte[] bytes)
headerStr - String that will be printed as headerbytes - Bytes to be dumped as hex.public static java.lang.String toHexString(byte[] bytes)
toBytes.bytes - The byte arraytoBytes(String)public static java.lang.String toHex(int val)
val - The integer
public static boolean areBytesEqual(byte[] array1,
                                    byte[] array2)
array1 - the first byte arrayarray2 - the second byte array
public static byte[] getLocalizedKeyMD5(byte[] passwKey,
                                        java.lang.String engineId)
passwKey - The password keyengineId - The SNMP engine IdSnmpContextv3.setUserAuthenticationPassword(String), 
passwordToKeyMD5(String)
public static byte[] getLocalizedKeySHA1(byte[] passwKey,
                                         java.lang.String engineId)
password - The printable user passwordengineId - The SNMP engine IdSnmpContextv3.setUserAuthenticationPassword(String)public static byte[] passwordToKeySHA1(java.lang.String password)
password - The printable user passwordSnmpContextv3.setUserAuthenticationPassword(String), 
getLocalizedKeyMD5(byte[], java.lang.String)public static byte[] passwordToKeyMD5(java.lang.String password)
password - The printable user passwordSnmpContextv3.setUserAuthenticationPassword(String), 
getLocalizedKeyMD5(byte[], java.lang.String)
public static final byte[] getFingerPrintMD5(byte[] key,
                                             byte[] message)
key - The keymessage - The messagegetFingerPrintSHA1(byte[], byte[])
public static final byte[] getFingerPrintSHA1(byte[] key,
                                              byte[] message)
key - The keymessage - The messagegetFingerPrintMD5(byte[], byte[])public static final byte[] getSaltDES(int snmpEngineBoots)
See "A Practical Guide to SNMPv3 and Network Management" section 6.8 Privacy, p 194.
snmpEngineBoots - The (estimated) boots of the authoritative engine
public static final byte[] getDESKey(byte[] secretPrivacyKey)
                              throws PduException
secretPrivacyKey - The secret privacy key
public static final byte[] getInitialValue(byte[] secretPrivacyKey,
                                           byte[] salt)
                                    throws PduException
secretPrivacyKey - The secret privacy keysalt - The salt
public static final byte[] encrypt(byte[] plain,
                                   byte[] secretPrivacyKey,
                                   byte[] salt)
                            throws EncodingException
plain - The plain bytessecretPrivacyKey - The secret privacy keysalt - The salt
public static final byte[] decrypt(byte[] encryptedText,
                                   byte[] salt,
                                   byte[] secretPrivacyKey)
                            throws DecodingException
encryptedText - The encrypted textsalt - The saltsecretPrivacyKey - The secret privacy key
  | 
SNMP Stack 4_12 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||