|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.snmp4j.security.PrivAES
public abstract class PrivAES
Base class for PrivAES128, PrivAES192 and PrivAES256. This class uses AES in CFB mode to encrypt the data. The protocol is defined in draft-blumenthal-aes-usm-08.txt.
| Field Summary | |
|---|---|
protected org.snmp4j.security.Salt |
salt
|
| Constructor Summary | |
|---|---|
PrivAES(int keyBytes)
Constructor. |
|
| Method Summary | |
|---|---|
static java.lang.String |
asHex(byte[] buf)
Turns array of bytes into string |
byte[] |
decrypt(byte[] cryptedData,
int offset,
int length,
byte[] decryptionKey,
long engineBoots,
long engineTime,
DecryptParams decryptParams)
Decrypts a message using a given decryption key, engine boots count, and engine ID. |
byte[] |
encrypt(byte[] unencryptedData,
int offset,
int length,
byte[] encryptionKey,
long engineBoots,
long engineTime,
DecryptParams decryptParams)
Encrypts a message using a given encryption key, engine boots count, and engine ID. |
byte[] |
extendShortKey(byte[] shortKey,
OctetString password,
byte[] engineID,
AuthenticationProtocol authProtocol)
Extend a localized key that is too short. |
int |
getDecryptParamsLength()
Gets the length of the decryption parameters used by this security protocol. |
int |
getEncryptedLength(int scopedPDULength)
Gets the length of a scoped PDU when encrypted with this security protocol. |
int |
getMaxKeyLength()
Gets the maximum key size for this privacy protcol. |
int |
getMinKeyLength()
Gets the minimum key size for this privacy protcol. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.snmp4j.security.PrivacyProtocol |
|---|
getID |
| Field Detail |
|---|
protected org.snmp4j.security.Salt salt
| Constructor Detail |
|---|
public PrivAES(int keyBytes)
keyBytes - Length of key, must be 16, 24 or 32.
java.lang.IllegalArgumentException - if keyBytes is illegal| Method Detail |
|---|
public byte[] encrypt(byte[] unencryptedData,
int offset,
int length,
byte[] encryptionKey,
long engineBoots,
long engineTime,
DecryptParams decryptParams)
PrivacyProtocol
encrypt in interface PrivacyProtocolunencryptedData - the unencrypted data. This byte array may contain leading and trailing
bytes that will not be encrypted.offset - the offset into the unencryptedData where to start
encryption.length - the length of the substring starting at offset to encrypt.encryptionKey - the key to be used for encryption.engineBoots - the engine boots counter to use.engineTime - the engine time to use.decryptParams - returns the decryption parameters needed to decrypt the data that
has been encrypted by this method.
unencryptedData.
public byte[] decrypt(byte[] cryptedData,
int offset,
int length,
byte[] decryptionKey,
long engineBoots,
long engineTime,
DecryptParams decryptParams)
PrivacyProtocol
decrypt in interface PrivacyProtocolcryptedData - the crypted data. This byte array may contain leading and trailing
bytes that will not be decrypted.offset - the offset into the cryptedData where to start
encryption.length - the length of the substring starting at offset to decrypt.decryptionKey - the key to be used for decryption.engineBoots - the engine boots counter to use.engineTime - the engine time to use.decryptParams - contains the decryption parameters.
null if decryption failed.public int getEncryptedLength(int scopedPDULength)
PrivacyProtocol
getEncryptedLength in interface PrivacyProtocolscopedPDULength - the length of the (unencrypted) scoped PDU.
public static java.lang.String asHex(byte[] buf)
buf - Array of bytes to convert to hex string
public int getMinKeyLength()
PrivacyProtocol
getMinKeyLength in interface PrivacyProtocolpublic int getMaxKeyLength()
PrivacyProtocol
getMaxKeyLength in interface PrivacyProtocolpublic int getDecryptParamsLength()
PrivacyProtocol
getDecryptParamsLength in interface PrivacyProtocol
public byte[] extendShortKey(byte[] shortKey,
OctetString password,
byte[] engineID,
AuthenticationProtocol authProtocol)
PrivacyProtocol
extendShortKey in interface PrivacyProtocolshortKey - the short key that was generated using
AuthenticationProtocol.passwordToKey(org.snmp4j.smi.OctetString, byte[]) function.password - the password to use for key extension.engineID - the SNMP engine ID of the authoritative engine.authProtocol - the authentication protocol that should be used.
shortKey if no extension is needed.
|
Copyright 2003-2009 Frank Fock and Jochen Katz (SNMP4J.org) | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||