|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.i2p.data.DataStructureImpl
net.i2p.data.DatabaseEntry
public abstract class DatabaseEntry
Base implementation of common methods for the two data structures that are stored in the netDb, i.e. LeaseSet and RouterInfo. Implemented in 0.8.2 and retrofitted over LeaseSet and RouterInfo. This consolidates some common code and makes it easier to implement the NetDB and I2NP without doing instanceof all over the place. DatabaseEntries have a SHA256 hash, a routing key, a timestamp, and signatures.
Field Summary | |
---|---|
protected Hash |
_currentRoutingKey
|
protected byte[] |
_routingKeyGenMod
|
protected Signature |
_signature
|
static int |
KEY_TYPE_LEASESET
|
static int |
KEY_TYPE_ROUTERINFO
these are the same as in i2np's DatabaseStoreMessage |
Constructor Summary | |
---|---|
DatabaseEntry()
|
Method Summary | |
---|---|
protected abstract byte[] |
getBytes()
Returns the raw payload data, excluding the signature, to be signed by sign(). |
abstract long |
getDate()
A common interface to the timestamp of the two subclasses. |
Hash |
getHash()
A common interface to the Hash of the two subclasses. |
protected abstract KeysAndCert |
getKeysAndCert()
Get the keys and the cert Identical to getDestination() in LeaseSet, and getIdentity() in RouterInfo. |
Hash |
getRoutingKey()
Get the routing key for the structure using the current modifier in the RoutingKeyGenerator. |
Signature |
getSignature()
Retrieve the proof that the identity stands behind the info here |
protected SigningPublicKey |
getSigningPublicKey()
Identical to getDestination().getSigningPublicKey() in LeaseSet, and getIdentity().getSigningPublicKey() in RouterInfo. |
abstract int |
getType()
Get the type of the data structure. |
void |
setRoutingKey(Hash key)
|
void |
setSignature(Signature signature)
Configure the proof that the entity stands behind the info here |
void |
sign(SigningPrivateKey key)
Sign the structure using the supplied signing key |
boolean |
validateRoutingKey()
|
protected boolean |
verifySignature()
This is the same as isValid() in RouterInfo or verifySignature() in LeaseSet. |
Methods inherited from class net.i2p.data.DataStructureImpl |
---|
calculateHash, fromBase64, fromByteArray, read, toBase64, toByteArray |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface net.i2p.data.DataStructure |
---|
readBytes, writeBytes |
Field Detail |
---|
public static final int KEY_TYPE_ROUTERINFO
public static final int KEY_TYPE_LEASESET
protected volatile Signature _signature
protected volatile Hash _currentRoutingKey
protected volatile byte[] _routingKeyGenMod
Constructor Detail |
---|
public DatabaseEntry()
Method Detail |
---|
public abstract long getDate()
protected abstract KeysAndCert getKeysAndCert()
public Hash getHash()
public abstract int getType()
protected abstract byte[] getBytes() throws DataFormatException
DataFormatException
public Hash getRoutingKey()
public void setRoutingKey(Hash key)
public boolean validateRoutingKey()
public Signature getSignature()
public void setSignature(Signature signature)
IllegalStateException
- if already signedpublic void sign(SigningPrivateKey key) throws DataFormatException
IllegalStateException
- if already signed
DataFormatException
protected SigningPublicKey getSigningPublicKey()
protected boolean verifySignature()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |