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 | _signaturecryptographic signature |
static int | KEY_TYPE_ENCRYPTED_LS2Encrypted LeaseSet 2 type. |
static int | KEY_TYPE_LEASESETLeaseSet (v1) type. |
static int | KEY_TYPE_LS2LeaseSet 2 type. |
static int | KEY_TYPE_META_LS2Meta LeaseSet 2 type. |
static int | KEY_TYPE_ROUTERINFORouter info type. |
static int | KEY_TYPE_SERVICE_LISTService list type. |
static int | KEY_TYPE_SERVICE_RECORDService 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()Keys and certificate for this entry. |
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()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()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()Marks this entry as received via reply. |
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 DataFormatExceptionDataFormatException - if the data cannot be serializedpublic 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)
type - the typepublic boolean isRouterInfo()
public void setReceivedAsPublished()
public void setReceivedAsReply()
public void setReceivedBy(Hash receivedBy)
receivedBy - the hash of the receiving clientpublic void setSignature(Signature signature)
signature - the signature to setIllegalStateException - if already signedpublic void sign(SigningPrivateKey key) throws DataFormatException
key - the signing private keyIllegalStateException - if already signedDataFormatException - if signing failspublic boolean validateRoutingKey()
IllegalStateException - if not in RouterContextpublic boolean verifySignature()