- java.lang.Object
-
- com.appslandia.common.base.InitializeObject
-
- com.appslandia.common.crypto.PbeObject
-
- com.appslandia.common.crypto.PbeEncryptor
-
- All Implemented Interfaces:
InitializeSupport,Encryptor
public class PbeEncryptor extends PbeObject implements Encryptor
- Author:
- Loc Ha
-
-
Field Summary
-
Fields inherited from class com.appslandia.common.crypto.PbeObject
iterationCount, keySize, password, saltSize, secretKeyGenerator
-
-
Constructor Summary
Constructors Constructor Description PbeEncryptor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected AlgorithmParameterSpecbuildIvParameter(byte[] iv)PbeEncryptorcopy()byte[]decrypt(byte[] message)byte[]decrypt(byte[] message, byte[] salt)byte[]encrypt(byte[] message)byte[]encrypt(byte[] message, Out<byte[]> salt)intgetIvSize()protected voidinit()protected booleanrequiresIV(String mode)PbeEncryptorsetGcmTagSize(int gcmTagSize)PbeEncryptorsetIterationCount(int iterationCount)PbeEncryptorsetKeySize(int keySize)PbeEncryptorsetPassword(char[] password)PbeEncryptorsetPassword(String passwordOrEnv)PbeEncryptorsetProvider(String provider)PbeEncryptorsetSaltSize(int saltSize)PbeEncryptorsetSecretKeyGenerator(SecretKeyGenerator secretKeyGenerator)PbeEncryptorsetTransformation(String transformation)-
Methods inherited from class com.appslandia.common.crypto.PbeObject
buildSecretKey, destroy
-
Methods inherited from class com.appslandia.common.base.InitializeObject
assertNotInitialized, initialize
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.appslandia.common.base.InitializeSupport
destroy, initialize
-
-
-
-
Method Detail
-
requiresIV
protected boolean requiresIV(String mode)
-
buildIvParameter
protected AlgorithmParameterSpec buildIvParameter(byte[] iv)
-
encrypt
public byte[] encrypt(byte[] message) throws CryptoException- Specified by:
encryptin interfaceEncryptor- Throws:
CryptoException
-
decrypt
public byte[] decrypt(byte[] message) throws CryptoException- Specified by:
decryptin interfaceEncryptor- Throws:
CryptoException
-
encrypt
public byte[] encrypt(byte[] message, Out<byte[]> salt) throws CryptoException- Specified by:
encryptin interfaceEncryptor- Throws:
CryptoException
-
decrypt
public byte[] decrypt(byte[] message, byte[] salt) throws CryptoException- Specified by:
decryptin interfaceEncryptor- Throws:
CryptoException
-
getIvSize
public int getIvSize()
-
setTransformation
public PbeEncryptor setTransformation(String transformation)
-
setProvider
public PbeEncryptor setProvider(String provider)
-
setSaltSize
public PbeEncryptor setSaltSize(int saltSize)
- Overrides:
setSaltSizein classPbeObject
-
setIterationCount
public PbeEncryptor setIterationCount(int iterationCount)
- Overrides:
setIterationCountin classPbeObject
-
setKeySize
public PbeEncryptor setKeySize(int keySize)
- Overrides:
setKeySizein classPbeObject
-
setPassword
public PbeEncryptor setPassword(char[] password)
- Overrides:
setPasswordin classPbeObject
-
setPassword
public PbeEncryptor setPassword(String passwordOrEnv)
- Overrides:
setPasswordin classPbeObject
-
setSecretKeyGenerator
public PbeEncryptor setSecretKeyGenerator(SecretKeyGenerator secretKeyGenerator)
- Overrides:
setSecretKeyGeneratorin classPbeObject
-
setGcmTagSize
public PbeEncryptor setGcmTagSize(int gcmTagSize)
-
copy
public PbeEncryptor copy()
-
-