public abstract class DatabaseEntry extends DataStructureImpl
DatabaseEntry provides common infrastructure for NetDb-storable objects:
LeaseSet and RouterInfoKey Features:
Supported Entry Types:
KEY_TYPE_ROUTERINFO - Router information and capabilitiesKEY_TYPE_LEASESET - Legacy LeaseSet formatKEY_TYPE_LS2 - Modern LeaseSet2 formatKEY_TYPE_META_LS2 - MetaLeaseSet for advanced routingIntegrity Protection:
Usage Patterns:
Security Considerations:
Implementation Notes:
Warning:
| Modifier and Type | Field and Description |
|---|---|
protected Signature |
_signature |
static int |
KEY_TYPE_ENCRYPTED_LS2
Encrypted LeaseSet 2 type.
|
static int |
KEY_TYPE_LEASESET |
static int |
KEY_TYPE_LS2
LeaseSet 2 type.
|
static int |
KEY_TYPE_META_LS2
Meta LeaseSet 2 type.
|
static int |
KEY_TYPE_ROUTERINFO
these are the same as in i2np's DatabaseStoreMessage
|
static int |
KEY_TYPE_SERVICE_LIST
Service list type.
|
static int |
KEY_TYPE_SERVICE_RECORD
Service record type.
|
| Constructor and Description |
|---|
DatabaseEntry() |
| Modifier and Type | Method and Description |
|---|---|
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.
|
abstract KeysAndCert |
getKeysAndCert()
Get the keys and the cert
Identical to getDestination() in LeaseSet,
and getIdentity() in RouterInfo.
|
boolean |
getReceivedAsPublished()
If true, we received this LeaseSet by a remote peer publishing it to
us, rather than by searching for it ourselves or locally creating it.
|
boolean |
getReceivedAsReply()
If true, we received this LeaseSet by searching for it
Default false.
|
Hash |
getReceivedBy()
The Hash of the local client that received this LS,
null if the router or unknown.
|
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.
|
boolean |
isLeaseSet()
Convenience method, is the type any variant of leaseset?
|
static boolean |
isLeaseSet(int type)
Convenience method, is the type any variant of leaseset?
|
boolean |
isRouterInfo()
Convenience method, is the type any variant of router info?
|
void |
setReceivedAsPublished()
Marks this entry as received via published mode.
|
void |
setReceivedAsReply()
set to true
|
void |
setReceivedBy(Hash receivedBy)
Sets the local client that received this entry.
|
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()
Validates the routing key for this entry.
|
boolean |
verifySignature()
This is the same as isValid() in RouterInfo
or verifySignature() in LeaseSet.
|
calculateHash, fromBase64, fromByteArray, read, toBase64, toByteArrayclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitreadBytes, writeBytesprotected volatile Signature _signature
public static final int KEY_TYPE_ENCRYPTED_LS2
public static final int KEY_TYPE_LEASESET
public static final int KEY_TYPE_LS2
public static final int KEY_TYPE_META_LS2
public static final int KEY_TYPE_ROUTERINFO
public static final int KEY_TYPE_SERVICE_LIST
public static final int KEY_TYPE_SERVICE_RECORD
protected abstract byte[] getBytes()
throws DataFormatException
DataFormatExceptionpublic abstract long getDate()
public Hash getHash()
public abstract KeysAndCert getKeysAndCert()
public boolean getReceivedAsPublished()
public boolean getReceivedAsReply()
public Hash getReceivedBy()
public Hash getRoutingKey()
IllegalStateException - if not in RouterContextpublic Signature getSignature()
protected SigningPublicKey getSigningPublicKey()
public abstract int getType()
public boolean isLeaseSet()
public static boolean isLeaseSet(int type)
public boolean isRouterInfo()
public void setReceivedAsPublished()
public void setReceivedAsReply()
public void setReceivedBy(Hash receivedBy)
public void setSignature(Signature signature)
IllegalStateException - if already signedpublic void sign(SigningPrivateKey key) throws DataFormatException
IllegalStateException - if already signedDataFormatExceptionpublic boolean validateRoutingKey()
IllegalStateException - if not in RouterContextpublic boolean verifySignature()