com.mindbright.util
public class EncryptedProperties extends java.util.Properties
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
CIPHER_KEY
Property holding the name of the encryption algorithm used
|
static java.lang.String |
CONTENTS_KEY
Property holding the encrypted content
|
static java.lang.String |
HASH_KEY
Property holding a hash of the encrypted data
|
static java.lang.String |
PROPS_HEADER
Property identifying the file
|
static java.lang.String |
SIZE_KEY
Property holding the size of the encrypted content
|
| Constructor and Description |
|---|
EncryptedProperties()
Create a new instance of EncryptedProperties without any
default values.
|
EncryptedProperties(java.util.Properties defaultProperties)
Create a new instance of EncryptedProperties with the given
default values.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
isNormalPropsFile()
Checks if the underlying properties file was encrypted or not
|
void |
load(java.io.InputStream in,
java.lang.String password)
Load and decrypt properties
|
java.lang.Object |
remove(java.lang.Object key) |
void |
save(java.io.OutputStream out,
java.lang.String header,
java.lang.String password,
java.lang.String cipherName)
Save the properties to an encrypted file.
|
getProperty, getProperty, list, list, load, load, loadFromXML, propertyNames, save, setProperty, store, store, storeToXML, storeToXML, stringPropertyNamespublic static final java.lang.String HASH_KEY
public static final java.lang.String CIPHER_KEY
public static final java.lang.String CONTENTS_KEY
public static final java.lang.String SIZE_KEY
public static final java.lang.String PROPS_HEADER
public EncryptedProperties()
public EncryptedProperties(java.util.Properties defaultProperties)
public boolean isNormalPropsFile()
public void save(java.io.OutputStream out,
java.lang.String header,
java.lang.String password,
java.lang.String cipherName)
throws java.io.IOException
out - strean to save toheader - header string which is saved before propertiespassword - encryption keycipherName - name of cipher to use. Currentl the valued
algorithms are: Blowfish, DES, DES3 and IDEA.java.io.IOExceptionpublic void load(java.io.InputStream in,
java.lang.String password)
throws java.io.IOException,
SSHAccessDeniedException
in - stream to load properties frompassword - decryptiopn keyjava.io.IOExceptionSSHAccessDeniedExceptionpublic java.lang.Object remove(java.lang.Object key)
remove in interface java.util.Map<java.lang.Object,java.lang.Object>remove in class java.util.Hashtable<java.lang.Object,java.lang.Object>