public final class BasicBinaryEncryptor extends Object implements BinaryEncryptor
Utility class for easily performing normal-strength encryption of binaries (byte arrays).
This class internally holds a StandardPBEByteEncryptor
configured this way:
The required steps to use it are:
setPassword(String) or
setPasswordCharArray(char[])).encrypt(byte[]) or
decrypt(byte[]) operations.This class is thread-safe.
| Constructor and Description |
|---|
BasicBinaryEncryptor()
Creates a new instance of BasicBinaryEncryptor.
|
| Modifier and Type | Method and Description |
|---|---|
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[].
|
public BasicBinaryEncryptor()
public void setPassword(String password)
password - the password to be set.public void setPasswordCharArray(char[] password)
password - the password to be set.public byte[] encrypt(byte[] binary)
encrypt in interface BinaryEncryptorbinary - the byte array to be encrypted.StandardPBEByteEncryptor.encrypt(byte[])public byte[] decrypt(byte[] encryptedBinary)
decrypt in interface BinaryEncryptorencryptedBinary - the byte array to be decrypted.StandardPBEByteEncryptor.decrypt(byte[])Copyright © 2017 JBoss by Red Hat. All rights reserved.