public class Alice
extends java.lang.Object
| Constructor and Description |
|---|
Alice(AliceContext context)
Initializes a new
Alice object for encryption and
decryption.
|
| Modifier and Type | Method and Description |
|---|---|
byte[] |
decrypt(byte[] input,
char[] password)
Decrypts a byte array using the supplied password
|
void |
decrypt(java.io.File input,
java.io.File output,
char[] password)
Decrypts an input file using the supplied password
|
void |
decrypt(java.io.InputStream input,
java.io.OutputStream output,
char[] password)
Decrypts an input stream using the supplied password
|
byte[] |
encrypt(byte[] input,
char[] password)
Encrypts a byte array using the supplied password
|
void |
encrypt(java.io.File input,
java.io.File output,
char[] password)
Encrypts the input file using the supplied password
|
void |
encrypt(java.io.InputStream input,
java.io.OutputStream output,
char[] password)
Encrypts the input stream using the supplied password
|
static byte[] |
generateKey(AliceContext.Algorithm algorithm,
AliceContext.KeyLength keyLength)
Generates an AES, DES, or 3DES key
|
public Alice(AliceContext context)
Alice object for encryption and
decryption. See
AliceContext for an
explanation of options.
context - an AliceContextpublic static byte[] generateKey(AliceContext.Algorithm algorithm, AliceContext.KeyLength keyLength) throws java.security.GeneralSecurityException
algorithm - the key will be used withkeyLength - length of keyjava.security.GeneralSecurityException - if either initialization
or generation fails
public byte[] encrypt(byte[] input,
char[] password)
throws java.security.GeneralSecurityException,
java.io.IOException
input - the byte array inputpassword - the passwordjava.security.GeneralSecurityException - if initialization or
encryption fails
java.io.IOException - if there's a problem constructing the result
public void encrypt(java.io.File input,
java.io.File output,
char[] password)
throws java.security.GeneralSecurityException,
java.io.IOException
input - the input fileoutput - the output filepassword - the passwordjava.security.GeneralSecurityException - if initialization or
encryption fails
java.io.IOException - if there's a failure to read/write from/to
the input/output file
public void encrypt(java.io.InputStream input,
java.io.OutputStream output,
char[] password)
throws java.security.GeneralSecurityException,
java.io.IOException
input - the input fileoutput - the output filepassword - the passwordjava.security.GeneralSecurityException - if initialization or
encryption fails
java.io.IOException - if there's a failure to read/write from/to
the input/output stream
public byte[] decrypt(byte[] input,
char[] password)
throws java.security.GeneralSecurityException
input - the byte array inputpassword - the passwordjava.security.GeneralSecurityException - if initialization,
decryption, or the MAC comparison fails
public void decrypt(java.io.File input,
java.io.File output,
char[] password)
throws java.security.GeneralSecurityException,
java.io.IOException
input - the input fileoutput - the output filepassword - the passwordjava.security.GeneralSecurityException - if initialization or
decryption fails
java.io.IOException - if there's a failure to read/write from/to
the input/output file
public void decrypt(java.io.InputStream input,
java.io.OutputStream output,
char[] password)
throws java.security.GeneralSecurityException,
java.io.IOException
input - the input fileoutput - the output filepassword - the passwordjava.security.GeneralSecurityException - if initialization or
decryption fails
java.io.IOException - if there's a failure to read/write from/to
the input/output stream