guarana.toolkit.task.streamdealers.ciphers
Class PBECipher
java.lang.Object
guarana.toolkit.task.streamdealers.ciphers.PBECipher
- All Implemented Interfaces:
- ICipher
public class PBECipher
- extends Object
- implements ICipher
A password based encryption cipher implementation. See class constants for available kinds.
- Since:
- Guaranį SDK 1.0.0
- Author:
- Rafael Z. Frantz
Constructor Summary |
PBECipher(String password,
String cipherType)
Constructs a new Password Based Encryption Cipher. |
Method Summary |
byte[] |
decrypt(byte[] data)
Decrypts data using a password and an OpenSSL compatible cipher name passed in the constructor. |
byte[] |
encrypt(byte[] data)
Encrypts data using a password and an OpenSSL compatible cipher name passed in the constructor. |
DES
public static final String DES
- See Also:
- Constant Field Values
DES3
public static final String DES3
- See Also:
- Constant Field Values
DES_EDE3_CBC
public static final String DES_EDE3_CBC
- See Also:
- Constant Field Values
AES_128
public static final String AES_128
- See Also:
- Constant Field Values
AES_192
public static final String AES_192
- See Also:
- Constant Field Values
AES_256
public static final String AES_256
- See Also:
- Constant Field Values
AES_256_CBC
public static final String AES_256_CBC
- See Also:
- Constant Field Values
RC2
public static final String RC2
- See Also:
- Constant Field Values
RC4
public static final String RC4
- See Also:
- Constant Field Values
BF
public static final String BF
- See Also:
- Constant Field Values
PBECipher
public PBECipher(String password,
String cipherType)
- Constructs a new Password Based Encryption Cipher.
- Parameters:
password
- The password use for this PBE cipher.cipherType
- The OpenSSL compatible cipher to use. Possible values are expressed as constants in this class. *
encrypt
public byte[] encrypt(byte[] data)
throws CipherException
- Encrypts data using a password and an OpenSSL compatible cipher name passed in the constructor.
- Specified by:
encrypt
in interface ICipher
- Parameters:
data
- The byte array to encrypt.
- Returns:
- A byte[] with the encrypted bytes in base64.
- Throws:
CipherException
- if this method cannot encrypt the data.- See Also:
ICipher.encrypt(byte[])
decrypt
public byte[] decrypt(byte[] data)
throws CipherException
- Decrypts data using a password and an OpenSSL compatible cipher name passed in the constructor.
- Specified by:
decrypt
in interface ICipher
- Parameters:
data
- The byte array to decrypt.
- Returns:
- A byte[] with the decrypted bytes in base64.
- Throws:
CipherException
- if this method cannot decrypt the data.- See Also:
ICipher.decrypt(byte[])
Guaranį DSL Home