|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jfw.util.Encryption
public final class Encryption
You can use this class for encrypt and decrypt data.
Field Summary | |
---|---|
static int |
TO_DECRYPT
Used in the constructor to set the object in decryption mode. |
static int |
TO_ENCRYPT
Used in the constructor to set the object in encryption mode. |
Constructor Summary | |
---|---|
Encryption(java.lang.String key4Encryption,
int type)
Create a new object. |
|
Encryption(java.lang.String key4Encryption,
int type,
java.lang.String encType)
Create a new object. |
Method Summary | |
---|---|
byte[] |
get(byte[] source)
Encrypt or decrypt an array of bytes. |
javax.crypto.CipherInputStream |
getInputStream(java.io.InputStream in)
Returning an encrypted input stream. |
javax.crypto.CipherOutputStream |
getOutputStream(java.io.OutputStream out)
Returning an encrypted output stream. |
int |
getType()
The mode (encryption or decryption) set in constructor. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int TO_ENCRYPT
public static final int TO_DECRYPT
Constructor Detail |
---|
public Encryption(java.lang.String key4Encryption, int type, java.lang.String encType) throws JFWGenericException
key4Encryption
- the encryption key to use. Must be an ASCII string.
You can use the method Secure.encode(java.lang.String)
to create an ASCII string.type
- possible values are TO_ENCRYPT
or TO_DECRYPT
.encType
- the encryption algorithm to use.
JFWGenericException
public Encryption(java.lang.String key4Encryption, int type) throws JFWGenericException
key4Encryption
- the encryption key to use. Must be an ASCII string.
You can use the method Secure.encode(java.lang.String)
to create an ASCII string.type
- possible values are TO_ENCRYPT
or TO_DECRYPT
.
JFWGenericException
Method Detail |
---|
public byte[] get(byte[] source) throws JFWGenericException
JFWGenericException
public int getType()
type
.public javax.crypto.CipherOutputStream getOutputStream(java.io.OutputStream out)
out
- the output stream to use for create the encrypted stream.
public javax.crypto.CipherInputStream getInputStream(java.io.InputStream in)
in
- the input stream to use for create the encrypted stream.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |