|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.waveset.util.AbstractXmlObject
com.waveset.util.EncryptedData
The EncryptedData class is to be used by any object containing data which should be private or encrypted to prevent it from being stored or transmitted in clear text. This includes object attributes such as passwords and answers.
Field Summary | |
static java.lang.String |
code_id
|
static java.lang.String |
XML_ELEMENT
The name of the XML element that wraps this object. |
Fields inherited from class com.waveset.util.AbstractXmlObject |
_trace |
Constructor Summary | |
EncryptedData()
Constructs an empty EncryptedData object. |
|
EncryptedData(boolean useDefault,
java.lang.String data)
|
|
EncryptedData(org.w3c.dom.Element e)
XML constructor required by the XmlObject interface. |
|
EncryptedData(java.lang.String data)
Constructs a EncryptedData object with data. |
|
EncryptedData(java.lang.String cipher,
java.lang.String data)
|
Method Summary | |
void |
clear()
|
byte[] |
decrypt()
|
char[] |
decryptToCharArray()
|
java.lang.String |
decryptToString()
|
boolean |
equals(EncryptedData data)
Temporary so I don't have to rebuild the world. |
boolean |
equals(java.lang.Object other)
Compare two EncryptedData objects by first decrypting the data to bytes since the data very well could have been encrypted by different keys. |
void |
fromString(java.lang.String estring)
Loads an EncryptedData object with data. |
byte[] |
getData()
|
java.lang.String |
getElementName()
Return the desired XML element name, required by the XmlObject interface. |
int |
getPadLen()
|
int |
length()
|
void |
setData(byte[] data)
|
static void |
setKey(byte[] key)
Only ServerKeyStore should call this. |
static void |
setKeyEncryptionKey(byte[] keyEncryptionKey)
Set the current key-encryption key. |
void |
setPadLen(int padlen)
|
java.lang.String |
toString()
|
void |
toXml(java.lang.StringBuffer b,
int indent)
Generate the XML rendering of the encrypted data, required by the XmlObject interface. |
Methods inherited from class com.waveset.util.AbstractXmlObject |
addXmlHeader, cloneObject, dump, dumpFile, getReference, println, setTrace, toIdentityString, toVerboseString, toVerboseString, toXml, toXml, toXml |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final java.lang.String code_id
public static final java.lang.String XML_ELEMENT
Constructor Detail |
public EncryptedData()
EncryptedData
object.
Typically used to decrypt an encrypted and base-64-encoded
string subsequently specified by fromString(String)
:
   EncryptedData ed = new EncryptedData();
   ed.fromString(encryptedEncodedString);
   String clearText = ed.decryptToString();
java.lang.IllegalStateException
- if there is a problem
initializing the wrapped Encryptor
object.public EncryptedData(java.lang.String cipher, java.lang.String data)
public EncryptedData(boolean useDefault, java.lang.String data)
public EncryptedData(java.lang.String data)
EncryptedData
object with data.
data
- a clear-text string to be encrypted.
Typically used to encrypt and base-64-encode the string.
   EncryptedData ed = new EncryptedData(clearText);
   String encryptedEncodedString = ed.toString();
java.lang.IllegalStateException
- if there is a problem
initializing the wrapped Encryptor
object
or if there is a problem encrypting the specified string.public EncryptedData(org.w3c.dom.Element e) throws WavesetException
Method Detail |
public static void setKey(byte[] key)
ServerKeyStore
should call this.
public static void setKeyEncryptionKey(byte[] keyEncryptionKey)
com.waveset.security.authn.ServerKeyStore
should call this.
public java.lang.String getElementName()
getElementName
in interface XmlObject
getElementName
in class AbstractXmlObject
public char[] decryptToCharArray()
public java.lang.String decryptToString()
public byte[] decrypt() throws java.lang.IllegalStateException
java.lang.IllegalStateException
public byte[] getData()
public void setData(byte[] data)
public void clear()
public boolean equals(java.lang.Object other)
jsl - this was originally written to take an EncryptedData argument but I had problems with that overloading the inherited Object.equals method when comparing two Objects. Now taking an Object and testing the class. We could in theory now compare with Strings.
public boolean equals(EncryptedData data)
public java.lang.String toString()
public void fromString(java.lang.String estring) throws WavesetException
EncryptedData
object with data.
estring
- an encrypted and base-64-encoded string.
Typically used to decrypt an encrypted and base-64-encoded string.
   EncryptedData ed = new EncryptedData();
   ed.fromString(encryptedEncodedString);
   String clearText = ed.decryptToString();
WavesetException
- if the specified string is not
base-64-encoded.public int getPadLen()
public void setPadLen(int padlen)
public int length()
public void toXml(java.lang.StringBuffer b, int indent)
toXml
in interface XmlObject
toXml
in class AbstractXmlObject
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |