|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.xlattice.crypto.SignedList
public abstract class SignedList
In its serialized form a SignedList consists of a public key line, a title line, a timestamp line, a number of content lines, and a digital signature. Each of the lines ends with a CR-LF sequence. A blank line follows the last content line. The timestamp (in CCYY-MM-DD HH:MM:SS form) represents the time at which the list was signed using the RSA private key corresponding to the key in the public key line. The public key itself is base-64 encoded. The SHA1withRSA digital signature is on the entire SignedList excluding the digital signature line. All line endings are converted to CRLF before taking the digital signature. The SignedList itself has a 20-byte extended hash, the 20-byte SHA1 digest of a function of the public key and the title. This means that the owner of the RSA key can create any number of documents with the same hash but different timestamps with the intention being that users can choose to regard the document with the most recent timestamp as authentic. What the content line contains varies between subclasses.
| Field Summary | |
|---|---|
static int |
BUF_SIZE
|
static java.lang.String |
CRLF
|
| Constructor Summary | |
|---|---|
protected |
SignedList(java.io.Reader reader)
|
protected |
SignedList(RSAPublicKey publicKey,
java.lang.String title)
|
| Method Summary | |
|---|---|
byte[] |
getHash()
Return this SignedList's hash, a byte array 20 bytes long. |
RSAPublicKey |
getPublicKey()
|
java.lang.String |
getTitle()
|
boolean |
isSigned()
|
protected abstract void |
readContents(java.io.BufferedReader in)
Subclasses must read in content lines, stripping off line endings do a verifier.update(line), where line excludes any terminating CRLF. |
static java.lang.String |
readFoldedLine(java.io.BufferedReader in,
boolean unfold)
Read lines until one is found that does not begin with a space. |
void |
sign(RSAKey key)
Set a timestamp and calculate a digital signature. |
abstract int |
size()
The number of items in the list, excluding the header lines (public key, title, timestamp) and the footer lines (blank line, digital signature). |
java.lang.String |
toString()
Serialize the entire document. |
abstract java.lang.String |
toString(int n)
Nth content item in String form, without any terminating CRLF. |
boolean |
verify()
Verify that the SignedList agrees with its digital signature. |
protected java.lang.StringBuffer |
withoutDigSig()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int BUF_SIZE
public static final java.lang.String CRLF
| Constructor Detail |
|---|
protected SignedList(RSAPublicKey publicKey,
java.lang.String title)
throws org.xlattice.CryptoException
org.xlattice.CryptoException
protected SignedList(java.io.Reader reader)
throws org.xlattice.CryptoException,
java.io.IOException
org.xlattice.CryptoException
java.io.IOException| Method Detail |
|---|
public final RSAPublicKey getPublicKey()
public final java.lang.String getTitle()
public final boolean isSigned()
public static java.lang.String readFoldedLine(java.io.BufferedReader in,
boolean unfold)
throws java.io.IOException
in - open BufferedReaderunfold - unfold the line if true
java.io.IOExceptionpublic byte[] getHash()
protected abstract void readContents(java.io.BufferedReader in)
throws org.xlattice.CryptoException,
java.io.IOException
org.xlattice.CryptoException - if error in content lines
java.io.IOException
public final void sign(RSAKey key)
throws org.xlattice.CryptoException
key - RSAKey whose secret materials are used to sign
org.xlattice.CryptoExceptionpublic abstract int size()
public boolean verify()
throws org.xlattice.CryptoException
org.xlattice.CryptoExceptionprotected final java.lang.StringBuffer withoutDigSig()
public final java.lang.String toString()
toString in class java.lang.Objectpublic abstract java.lang.String toString(int n)
n - index of content item to be serialized
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||