com.waveset.util
Class SignedString
java.lang.Object
com.waveset.util.SignedString
- public class SignedString
- extends java.lang.Object
Field Summary |
static java.lang.String |
code_id
|
Constructor Summary |
SignedString(java.lang.String data,
byte[] key)
|
Method Summary |
java.lang.String |
fromString(java.lang.String inString)
Convert the incoming string from base64 into a byte array. |
static void |
main(java.lang.String[] args)
|
static void |
println(java.lang.Object o)
|
void |
setData(java.lang.String data)
|
void |
setKey(byte[] secretKey)
|
java.lang.String |
toString()
build an output buffer that looks like:
total length, includes three length fields and mac (four bytes)
uncompressed data length (four bytes)
compressed data length (four bytes)
compressed data (or uncompressed if compressed length == 0)
mac (length = total - compressed)
Then base64 encode the buffer, convert it to a string, and return it. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
code_id
public static final java.lang.String code_id
- See Also:
- Constant Field Values
SignedString
public SignedString(java.lang.String data,
byte[] key)
throws WavesetException
setKey
public void setKey(byte[] secretKey)
throws java.security.InvalidKeyException,
java.security.NoSuchAlgorithmException,
WavesetException
- Throws:
java.security.InvalidKeyException
java.security.NoSuchAlgorithmException
WavesetException
setData
public void setData(java.lang.String data)
throws java.io.UnsupportedEncodingException,
WavesetException
- Throws:
java.io.UnsupportedEncodingException
WavesetException
toString
public java.lang.String toString()
- build an output buffer that looks like:
total length, includes three length fields and mac (four bytes)
uncompressed data length (four bytes)
compressed data length (four bytes)
compressed data (or uncompressed if compressed length == 0)
mac (length = total - compressed)
Then base64 encode the buffer, convert it to a string, and return it.
fromString
public java.lang.String fromString(java.lang.String inString)
throws WavesetException
- Convert the incoming string from base64 into a byte array. Check the
length and the mac and if it all checks out, uncompress the data and return
it as a string. Stores the data in the object so that:
SignedString test = new SignedString(a,b);
SignedString test2 = new SignedString(test.fromString(test.toString()))
test == test2
- Throws:
WavesetException
main
public static void main(java.lang.String[] args)
throws java.lang.Exception
- Throws:
java.lang.Exception
println
public static void println(java.lang.Object o)