|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.Dictionary<K,V> java.util.Hashtable<Object,Object> java.util.Properties org.owasp.esapi.reference.crypto.ReferenceEncryptedProperties
public class ReferenceEncryptedProperties
Reference implementation of the EncryptedProperties
interface. This
implementation wraps a normal properties file, and creates surrogates for the
getProperty
and setProperty
methods that perform encryption
and decryption based on Encryptor
.
This implementation differs from DefaultEncryptedProperties
in that
it actually extends from java.util.Properties
for applications that need an
instance of that class. In order to do so, the getProperty
and
setProperty
methods were modified to throw EncryptionRuntimeException
instead of EncryptionException
.
EncryptedProperties
,
DefaultEncryptedProperties
,
Serialized FormField Summary |
---|
Fields inherited from class java.util.Properties |
---|
defaults |
Constructor Summary | |
---|---|
ReferenceEncryptedProperties()
Instantiates a new encrypted properties. |
|
ReferenceEncryptedProperties(Properties defaults)
|
Method Summary | |
---|---|
Enumeration |
elements()
This method has been overridden to throw an UnsupportedOperationException |
Set |
entrySet()
This method has been overridden to throw an UnsupportedOperationException |
String |
getProperty(String key)
Gets the property value from the encrypted store, decrypts it, and returns the plaintext value to the caller. |
String |
getProperty(String key,
String defaultValue)
|
void |
list(PrintStream out)
This method has been overridden to throw an UnsupportedOperationException |
void |
list(PrintWriter out)
This method has been overridden to throw an UnsupportedOperationException |
void |
load(InputStream in)
Reads a property list (key and element pairs) from the input stream. |
void |
load(Reader in)
For JDK 1.5 compatibility, this method has been overridden convert the Reader into an InputStream and call the superclass constructor. |
Object |
put(Object key,
Object value)
This method has been overridden to only accept Strings for key and value, and to encrypt those Strings before storing them. |
String |
setProperty(String key,
String value)
Encrypts the plaintext property value and stores the ciphertext value in the encrypted store. |
String |
toString()
This method has been overridden to not print out the keys and values stored in this properties file. |
Collection |
values()
This method has been overridden to throw an UnsupportedOperationException |
Methods inherited from class java.util.Properties |
---|
loadFromXML, propertyNames, save, store, store, storeToXML, storeToXML, stringPropertyNames |
Methods inherited from class java.util.Hashtable |
---|
clear, clone, contains, containsKey, containsValue, equals, get, hashCode, isEmpty, keys, keySet, putAll, rehash, remove, size |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.owasp.esapi.EncryptedProperties |
---|
keySet, store |
Constructor Detail |
---|
public ReferenceEncryptedProperties()
public ReferenceEncryptedProperties(Properties defaults)
Method Detail |
---|
public String getProperty(String key) throws EncryptionRuntimeException
getProperty
in interface EncryptedProperties
getProperty
in class Properties
key
- the name of the property to get
EncryptionRuntimeException
- Thrown if decryption fails.public String getProperty(String key, String defaultValue) throws EncryptionRuntimeException
getProperty
in class Properties
EncryptionRuntimeException
- Thrown if decryption fails.public String setProperty(String key, String value) throws EncryptionRuntimeException
setProperty
in interface EncryptedProperties
setProperty
in class Properties
key
- the name of the property to setvalue
- the value of the property to set
null
if it did not have one.
EncryptionRuntimeException
- Thrown if encryption fails.public void load(InputStream in) throws IOException
load
in interface EncryptedProperties
load
in class Properties
in
- the input stream that contains the properties file
IOException
- Thrown if input stream invalid or does not
correspond to Java properties file format.public void load(Reader in) throws IOException
load
in class Properties
IOException
- Thrown if Reader
input stream invalid or does not
correspond to Java properties file format.public void list(PrintStream out)
UnsupportedOperationException
list
in class Properties
public void list(PrintWriter out)
UnsupportedOperationException
list
in class Properties
public Collection values()
UnsupportedOperationException
values
in interface Map<Object,Object>
values
in class Hashtable<Object,Object>
public Set entrySet()
UnsupportedOperationException
entrySet
in interface Map<Object,Object>
entrySet
in class Hashtable<Object,Object>
public Enumeration elements()
UnsupportedOperationException
elements
in class Hashtable<Object,Object>
public Object put(Object key, Object value)
setProperty
to add values to the Properties map. If an outside class does erroneously call this method
with non-String parameters an IllegalArgumentException
will be thrown.
put
in interface Map<Object,Object>
put
in class Hashtable<Object,Object>
key
- A String key to addvalue
- A String value to add
null
if the key did not exist.public String toString()
toString
in class Hashtable<Object,Object>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |