public class LeaseSet extends DatabaseEntry
| Modifier and Type | Field and Description |
|---|---|
static int |
MAX_LEASES
Unlimited before 0.6.3;
6 as of 0.6.3;
Increased in version 0.9.
|
_currentRoutingKey, _routingKeyGenMod, _signature, KEY_TYPE_LEASESET, KEY_TYPE_ROUTERINFO| Constructor and Description |
|---|
LeaseSet() |
| Modifier and Type | Method and Description |
|---|---|
void |
addLease(Lease lease) |
void |
encrypt(SessionKey key)
Encrypt the gateway and tunnel ID of each lease, leaving the expire dates unchanged.
|
boolean |
equals(Object object) |
protected byte[] |
getBytes()
Returns the raw payload data, excluding the signature, to be signed by sign().
|
long |
getDate()
A common interface to the timestamp of the two subclasses.
|
Destination |
getDestination() |
long |
getEarliestLeaseDate()
Retrieve the end date of the earliest lease include in this leaseSet.
|
PublicKey |
getEncryptionKey() |
protected KeysAndCert |
getKeysAndCert()
Get the keys and the cert
Identical to getDestination() in LeaseSet,
and getIdentity() in RouterInfo.
|
Lease |
getLease(int index) |
int |
getLeaseCount() |
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.
|
SigningPublicKey |
getSigningKey()
Deprecated.
unused
|
int |
getType()
Get the type of the data structure.
|
int |
hashCode()
the destination has enough randomness in it to use it by itself for speed
|
boolean |
isCurrent(long fudge)
Determine whether ANY lease is currently valid, at least within a given
fudge factor
|
void |
readBytes(InputStream in)
This does NOT validate the signature
|
void |
setDestination(Destination dest) |
void |
setEncryptionKey(PublicKey encryptionKey) |
void |
setReceivedAsPublished(boolean received)
Default false
|
void |
setReceivedAsReply()
set to true @since 0.7.14
|
void |
setSigningKey(SigningPublicKey key) |
int |
size()
Number of bytes, NOT including signature
|
String |
toString() |
boolean |
verifySignature()
Verify that the signature matches the lease set's destination's signing public key.
|
boolean |
verifySignature(SigningPublicKey signingKey)
Deprecated.
revocation unused
|
void |
writeBytes(OutputStream out)
This does NOT validate the signature
|
getHash, getRoutingKey, getSignature, getSigningPublicKey, setRoutingKey, setSignature, sign, validateRoutingKeycalculateHash, fromBase64, fromByteArray, read, toBase64, toByteArraypublic static final int MAX_LEASES
public long getDate()
DatabaseEntrygetDate in class DatabaseEntryprotected KeysAndCert getKeysAndCert()
DatabaseEntrygetKeysAndCert in class DatabaseEntrypublic int getType()
DatabaseEntrygetType in class DatabaseEntrypublic Destination getDestination()
public void setDestination(Destination dest)
public PublicKey getEncryptionKey()
public void setEncryptionKey(PublicKey encryptionKey)
public SigningPublicKey getSigningKey()
public void setSigningKey(SigningPublicKey key)
public boolean getReceivedAsPublished()
public void setReceivedAsPublished(boolean received)
public boolean getReceivedAsReply()
public void setReceivedAsReply()
public void addLease(Lease lease)
public int getLeaseCount()
public Lease getLease(int index)
public long getEarliestLeaseDate()
public boolean verifySignature()
verifySignature in class DatabaseEntrypublic boolean verifySignature(SigningPublicKey signingKey)
public boolean isCurrent(long fudge)
fudge - milliseconds fudge factor to allow between the current timeprotected byte[] getBytes()
DatabaseEntrygetBytes in class DatabaseEntrypublic void readBytes(InputStream in) throws DataFormatException, IOException
in - stream to read fromDataFormatException - if the data is improperly formattedIOException - if there was a problem reading the streampublic void writeBytes(OutputStream out) throws DataFormatException, IOException
out - stream to write toDataFormatException - if the data was incomplete or not yet ready to be writtenIOException - if there was a problem writing to the streampublic int size()
public int hashCode()
public void encrypt(SessionKey key)