public class SecureContainer extends Object implements Serializable
A SecureContainer has to be completly Serializable
as it is stored as an object. It contains a hashmap
that encrypts any key-value pairs before they are added. You can extend this class to pass additional data to be
stored, however there is no guarantee it is stored safely in that case.
Constructor and Description |
---|
SecureContainer()
Creates a new secure container
|
Modifier and Type | Method and Description |
---|---|
HashMap<String,String> |
getClearTextData()
Gets the clear text data array
|
HashMap<byte[],byte[]> |
getCryptData()
Gets the crypt data array
|
String |
secureGet(String key)
Retrieves and decrypts
key and value and returns the decrypted value |
void |
securePut(String key,
String value)
Encrypts and adds
key and value to the stored data map |
void |
setClearTextData(HashMap<String,String> clearTextData)
Sets the clear text data
|
void |
setCryptData(HashMap<byte[],byte[]> cryptData)
Sets the crypt data array
|
public SecureContainer()
public void securePut(String key, String value)
key
and value
to the stored data mapkey
- the key to savevalue
- the value to save the key withpublic String secureGet(String key)
key
and value
and returns the decrypted valuekey
- the key to retrieve value
withpublic HashMap<String,String> getClearTextData()
public void setClearTextData(HashMap<String,String> clearTextData)
clearTextData
- the clear text data to setpublic HashMap<byte[],byte[]> getCryptData()
public void setCryptData(HashMap<byte[],byte[]> cryptData)
cryptData
- the crypt data array to setCopyright © 2016. All rights reserved.