|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectes.vocali.util.AESCrypt
public class AESCrypt
This class provides methods to encrypt and decrypt files using aescrypt file format, version 1 or 2.
Requires Java 6 and Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files.
Thread-safety and sharing: this class is not thread-safe.
AESCrypt objects can be used as Commands (create, use once and dispose),
or reused to perform multiple operations (not concurrently though).
Constructor Summary | |
---|---|
AESCrypt(boolean debug,
java.lang.String password)
Builds an object to encrypt or decrypt files with the given password. |
|
AESCrypt(java.lang.String password)
Builds an object to encrypt or decrypt files with the given password. |
Method Summary | |
---|---|
void |
decrypt(long inSize,
java.io.InputStream in,
java.io.OutputStream out)
The input stream is decrypted and saved to the output stream. |
void |
decrypt(java.lang.String fromPath,
java.lang.String toPath)
The file at fromPath is decrypted and saved at toPath location. |
void |
encrypt(int version,
java.io.InputStream in,
java.io.OutputStream out)
The input stream is encrypted and saved to the output stream. |
void |
encrypt(int version,
java.lang.String fromPath,
java.lang.String toPath)
The file at fromPath is encrypted and saved at toPath location. |
static void |
main(java.lang.String[] args)
|
void |
setPassword(java.lang.String password)
Changes the password this object uses to encrypt and decrypt. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AESCrypt(java.lang.String password) throws java.security.GeneralSecurityException, java.io.UnsupportedEncodingException
java.security.GeneralSecurityException
- if the platform does not support the required cryptographic methods.
java.io.UnsupportedEncodingException
- if UTF-16 encoding is not supported.public AESCrypt(boolean debug, java.lang.String password) throws java.security.GeneralSecurityException, java.io.UnsupportedEncodingException
java.security.GeneralSecurityException
- if the platform does not support the required cryptographic methods.
java.io.UnsupportedEncodingException
- if UTF-16 encoding is not supported.Method Detail |
---|
public void setPassword(java.lang.String password) throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingException
- if UTF-16 encoding is not supported.public void encrypt(int version, java.lang.String fromPath, java.lang.String toPath) throws java.io.IOException, java.security.GeneralSecurityException
version can be either 1 or 2.
java.io.IOException
- when there are I/O errors.
java.security.GeneralSecurityException
- if the platform does not support the required cryptographic methods.public void encrypt(int version, java.io.InputStream in, java.io.OutputStream out) throws java.io.IOException, java.security.GeneralSecurityException
version can be either 1 or 2.
None of the streams are closed.
java.io.IOException
- when there are I/O errors.
java.security.GeneralSecurityException
- if the platform does not support the required cryptographic methods.public void decrypt(java.lang.String fromPath, java.lang.String toPath) throws java.io.IOException, java.security.GeneralSecurityException
The input file can be encrypted using version 1 or 2 of aescrypt.
java.io.IOException
- when there are I/O errors.
java.security.GeneralSecurityException
- if the platform does not support the required cryptographic methods.public void decrypt(long inSize, java.io.InputStream in, java.io.OutputStream out) throws java.io.IOException, java.security.GeneralSecurityException
The input file size is needed in advance.
The input stream can be encrypted using version 1 or 2 of aescrypt.
None of the streams are closed.
java.io.IOException
- when there are I/O errors.
java.security.GeneralSecurityException
- if the platform does not support the required cryptographic methods.public static void main(java.lang.String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |