|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object es.rediris.crypt.AESTool
public class AESTool
AESTool is a helper class for encrypting/decrypting messages using AES algorithm in ECB
mode. Also, it uses PKCS5 padding when makes its operations with messages.
Keys are 128-bit, 192-bit or 256-bit blocks, and you have to associate a name for their.
So, when you encrypt/decrypt you have to specify which key (through its name) you want to
use.
Constructor Summary | |
---|---|
AESTool()
Generate an AESTool object |
Method Summary | |
---|---|
boolean |
addKey(String name,
byte[] key)
Add a valid key setting its name. |
void |
clearKeys()
Delete all added keys |
String |
decode(String nameKey,
String data)
Decrypt a message using the specified key |
boolean |
delKey(String name)
Delete a previously added key |
String |
encode(String nameKey,
String data)
Encrypt a message using the specified key. |
byte[] |
getKey(String name)
|
String[] |
getNameKeys()
Get an array with the name of all added keys |
boolean |
hasKey(String nameKey)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AESTool()
Method Detail |
---|
public boolean addKey(String name, byte[] key)
name
- The name of the keykey
- The array of bytes defining the key
public boolean delKey(String name)
name
- The name of the key
public void clearKeys()
public String[] getNameKeys()
public byte[] getKey(String name)
public String encode(String nameKey, String data)
nameKey
- The name of the key you want to usedata
- The message you want to encrypt
public String decode(String nameKey, String data)
nameKey
- The name of the key you want to usedata
- The ciphered message in base 64
public boolean hasKey(String nameKey)
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |