guarana.toolkit.task.streamdealers.ciphers
Class PBECipher

java.lang.Object
  extended by 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

Field Summary
static String AES_128
           
static String AES_192
           
static String AES_256
           
static String AES_256_CBC
           
static String BF
           
static String DES
           
static String DES_EDE3_CBC
           
static String DES3
           
static String RC2
           
static String RC4
           
 
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.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

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
Constructor Detail

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. *
Method Detail

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