public class PrivDES extends PrivacyGeneric
| Modifier and Type | Field and Description |
|---|---|
static OID |
ID
Unique ID of this privacy protocol.
|
protected org.snmp4j.security.Salt |
salt |
cipherPool, initVectorLength, keyBytes, protocolClass, protocolId| Constructor and Description |
|---|
PrivDES() |
| Modifier and Type | Method and Description |
|---|---|
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.
|
OID |
getID()
Gets the OID uniquely identifying the privacy protocol.
|
int |
getMaxKeyLength()
Gets the maximum key size for this privacy protocol.
|
int |
getMinKeyLength()
Gets the minimum key size for this privacy protocol.
|
boolean |
isSupported()
Checks whether this security protocol is actually supported by this Java runtime environment.
|
doDecrypt, doFinal, doFinalWithPadding, doInitpublic static final OID ID
protected org.snmp4j.security.Salt salt
public byte[] encrypt(byte[] unencryptedData,
int offset,
int length,
byte[] encryptionKey,
long engineBoots,
long engineTime,
DecryptParams decryptParams)
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)
cryptedData - the data to decrypt.offset - the offset into cryptedData to start decryption.length - the length of the data to decrypt.decryptionKey - the decryption key.engineBoots - the engine boots counter.engineTime - the engine time value.decryptParams - contains the decryption parameters.null if decryption failed.public OID getID()
OID instance.public boolean isSupported()
SecurityProtocolisSupported in interface SecurityProtocolisSupported in class PrivacyGenerictrue if this security protocol is supported, false otherwise.public int getEncryptedLength(int scopedPDULength)
PrivacyProtocolscopedPDULength - the length of the (unencrypted) scoped PDU.public int getMinKeyLength()
PrivacyProtocolpublic int getDecryptParamsLength()
PrivacyProtocolpublic int getMaxKeyLength()
PrivacyProtocolpublic byte[] extendShortKey(byte[] shortKey,
OctetString password,
byte[] engineID,
AuthenticationProtocol authProtocol)
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 © 2020 SNMP4J.org. All rights reserved.