- java.lang.Object
-
- org.snmp4j.security.PrivacyGeneric
-
- All Implemented Interfaces:
java.io.Serializable,PrivacyProtocol,SecurityProtocol
public abstract class PrivacyGeneric extends java.lang.Object implements PrivacyProtocol
The PrivacyGeneric abstract class implements common functionality of privacy protocols.- Since:
- 2.5.0
- Author:
- Frank Fock
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected CipherPoolcipherPoolprotected intinitVectorLengthprotected intkeyBytesprotected java.lang.StringprotocolClassprotected java.lang.StringprotocolIdprotected Saltsalt
-
Constructor Summary
Constructors Constructor Description PrivacyGeneric()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected byte[]doDecrypt(byte[] cryptedData, int offset, int length, byte[] decryptionKey, byte[] iv)protected byte[]doFinal(byte[] unencryptedData, int offset, int length, javax.crypto.Cipher alg)protected byte[]doFinalWithPadding(byte[] unencryptedData, int offset, int length, javax.crypto.Cipher alg)protected javax.crypto.CipherdoInit(byte[] encryptionKey, byte[] initVect)booleanisSupported()Checks whether this security protocol is actually supported by this Java runtime environment.-
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
decrypt, encrypt, extendShortKey, getDecryptParamsLength, getEncryptedLength, getID, getMaxKeyLength, getMinKeyLength
-
-
-
-
Field Detail
-
protocolId
protected java.lang.String protocolId
-
protocolClass
protected java.lang.String protocolClass
-
keyBytes
protected int keyBytes
-
salt
protected Salt salt
-
cipherPool
protected CipherPool cipherPool
-
initVectorLength
protected int initVectorLength
-
-
Method Detail
-
doInit
protected javax.crypto.Cipher doInit(byte[] encryptionKey, byte[] initVect) throws javax.crypto.NoSuchPaddingException, java.security.NoSuchAlgorithmException, java.security.InvalidKeyException, java.security.InvalidAlgorithmParameterException- Throws:
javax.crypto.NoSuchPaddingExceptionjava.security.NoSuchAlgorithmExceptionjava.security.InvalidKeyExceptionjava.security.InvalidAlgorithmParameterException
-
doFinal
protected byte[] doFinal(byte[] unencryptedData, int offset, int length, javax.crypto.Cipher alg) throws javax.crypto.BadPaddingException, javax.crypto.IllegalBlockSizeException, javax.crypto.ShortBufferException- Throws:
javax.crypto.BadPaddingExceptionjavax.crypto.IllegalBlockSizeExceptionjavax.crypto.ShortBufferException
-
doFinalWithPadding
protected byte[] doFinalWithPadding(byte[] unencryptedData, int offset, int length, javax.crypto.Cipher alg) throws javax.crypto.IllegalBlockSizeException, javax.crypto.BadPaddingException, javax.crypto.ShortBufferException- Throws:
javax.crypto.IllegalBlockSizeExceptionjavax.crypto.BadPaddingExceptionjavax.crypto.ShortBufferException
-
doDecrypt
protected byte[] doDecrypt(byte[] cryptedData, int offset, int length, byte[] decryptionKey, byte[] iv)
-
isSupported
public boolean isSupported()
Description copied from interface:SecurityProtocolChecks whether this security protocol is actually supported by this Java runtime environment.- Specified by:
isSupportedin interfaceSecurityProtocol- Returns:
trueif this security protocol is supported,falseotherwise.
-
-