public class SymmetricKey
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
class |
SymmetricKey.Encryptor
An Encryptor class used for incrementally encrypting data.
|
| Modifier and Type | Field and Description |
|---|---|
static int |
KEY_SIZE |
| Constructor and Description |
|---|
SymmetricKey()
Create an instance with a secure random generated key.
|
SymmetricKey(byte[] key)
Create an instance with a raw key.
|
| Modifier and Type | Method and Description |
|---|---|
SymmetricKey.Encryptor |
createEncryptor()
Create an Encryptor object.
|
byte[] |
decryptData(byte[] data)
Decrypt the encrypted byte array data.
|
java.io.InputStream |
decryptStream(java.io.InputStream input)
Decrypt the input stream.
|
byte[] |
encryptData(byte[] data)
Encrypt the byte array data
|
java.lang.String |
getHexData()
Get the hex representation of the key data.
|
byte[] |
getKey()
Get the raw key data derived from a password or the raw key given to
SymmetricKey(byte[] key) constructor.
|
java.lang.String |
toString()
String representation of the object
|
public static final int KEY_SIZE
public SymmetricKey()
throws SymmetricKeyException
SymmetricKeyExceptionpublic SymmetricKey(byte[] key)
throws SymmetricKeyException
key - SymmetricKeyExceptionpublic byte[] getKey()
public java.lang.String getHexData()
public java.lang.String toString()
toString in class java.lang.Objectpublic byte[] encryptData(byte[] data)
throws SymmetricKeyException
data - Input dataSymmetricKeyExceptionpublic byte[] decryptData(byte[] data)
throws SymmetricKeyException
data - Encrypted dataSymmetricKeyExceptionpublic java.io.InputStream decryptStream(java.io.InputStream input)
throws SymmetricKeyException
input - InputStream of the data to be decryptedSymmetricKeyExceptionpublic SymmetricKey.Encryptor createEncryptor() throws SymmetricKeyException
SymmetricKeyException