public class EncryptedProperties extends Properties
Properties
class that can handle encrypted property values in the
form of "ENC(<encoded text>)". Non-encrypted values do not have the
"ENC()"magic mark.
defaults
Constructor and Description |
---|
EncryptedProperties(String password)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
String |
getProperty(String key)
This also decrypts any property value that has been encrypted.
|
boolean |
isEncrypted(String key)
Check if the value with the given key is encrypted or not.
|
static void |
main(String[] argv)
A simple driver for changing the master key used for encryption (and the
corresponding properties files that have encryption).
|
Object |
setEncryptedProperty(String key,
String value)
Force set a property value to be encrypted.
|
Object |
setProperty(String key,
String value)
This also encrypts the value of any property key that was original
encrypted.
|
getProperty, list, list, load, load, loadFromXML, propertyNames, save, store, store, storeToXML, storeToXML, stringPropertyNames
clear, clone, compute, computeIfAbsent, computeIfPresent, contains, containsKey, containsValue, elements, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keys, keySet, merge, put, putAll, putIfAbsent, rehash, remove, remove, replace, replace, replaceAll, size, toString, values
public EncryptedProperties(String password) throws EncryptionException
password
- password to use for encryption/decryptionEncryptionException
- something is wrong, Houston!public String getProperty(String key)
getProperty
in class Properties
public Object setProperty(String key, String value)
setProperty
in class Properties
public Object setEncryptedProperty(String key, String value)
key
- property keyvalue
- property valuepublic boolean isEncrypted(String key)
key
- key with value to checkpublic static void main(String[] argv) throws FileNotFoundException, IOException
argv
- command arguments FileNotFoundException
- file location not foundIOException
- file IO exceptionCopyright © 2016. All Rights Reserved.