org.jasypt.util.binary
Class StrongBinaryEncryptor

Object
  extended by org.jasypt.util.binary.StrongBinaryEncryptor
All Implemented Interfaces:
BinaryEncryptor

public final class StrongBinaryEncryptor
extends Object
implements BinaryEncryptor

Utility class for easily performing high-strength encryption of binaries (byte arrays).

This class internally holds a StandardPBEByteEncryptor configured this way:

The required steps to use it are:

  1. Create an instance (using new).
  2. Set a password (using setPassword(String) or setPasswordCharArray(char[])).
  3. Perform the desired encrypt(byte[]) or decrypt(byte[]) operations.

This class is thread-safe.

Since:
1.2
Author:
Daniel Fernández

Constructor Summary
StrongBinaryEncryptor()
          Creates a new instance of StrongBinaryEncryptor.
 
Method Summary
 byte[] decrypt(byte[] encryptedBinary)
          Decrypts a byte array.
 byte[] encrypt(byte[] binary)
          Encrypts a byte array
 void setPassword(String password)
          Sets a password.
 void setPasswordCharArray(char[] password)
          Sets a password, as a char[].
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StrongBinaryEncryptor

public StrongBinaryEncryptor()
Creates a new instance of StrongBinaryEncryptor.

Method Detail

setPassword

public void setPassword(String password)
Sets a password.

Parameters:
password - the password to be set.

setPasswordCharArray

public void setPasswordCharArray(char[] password)
Sets a password, as a char[].

Parameters:
password - the password to be set.
Since:
1.8

encrypt

public byte[] encrypt(byte[] binary)
Encrypts a byte array

Specified by:
encrypt in interface BinaryEncryptor
Parameters:
binary - the byte array to be encrypted.
See Also:
StandardPBEByteEncryptor.encrypt(byte[])

decrypt

public byte[] decrypt(byte[] encryptedBinary)
Decrypts a byte array.

Specified by:
decrypt in interface BinaryEncryptor
Parameters:
encryptedBinary - the byte array to be decrypted.
See Also:
StandardPBEByteEncryptor.decrypt(byte[])


Copyright © 2011 The JASYPT team. All Rights Reserved.