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()
Same as getEarliestLeaseDate()
|
Destination |
getDestination() |
long |
getEarliestLeaseDate()
Retrieve the end date of the earliest lease included in this leaseSet.
|
PublicKey |
getEncryptionKey() |
KeysAndCert |
getKeysAndCert()
Get the keys and the cert
Identical to getDestination() in LeaseSet,
and getIdentity() in RouterInfo.
|
long |
getLatestLeaseDate()
Retrieve the end date of the latest lease included in this leaseSet.
|
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)
The revocation 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, setSignature, sign, validateRoutingKey
calculateHash, fromBase64, fromByteArray, read, toBase64, toByteArray
public static final int MAX_LEASES
public long getDate()
getDate
in class DatabaseEntry
public KeysAndCert getKeysAndCert()
DatabaseEntry
getKeysAndCert
in class DatabaseEntry
public int getType()
DatabaseEntry
getType
in class DatabaseEntry
public Destination getDestination()
public void setDestination(Destination dest)
IllegalStateException
- if already signedpublic PublicKey getEncryptionKey()
public void setEncryptionKey(PublicKey encryptionKey)
IllegalStateException
- if already signed@Deprecated public SigningPublicKey getSigningKey()
public void setSigningKey(SigningPublicKey key)
IllegalArgumentException
- if different typepublic boolean getReceivedAsPublished()
public void setReceivedAsPublished(boolean received)
public boolean getReceivedAsReply()
public void setReceivedAsReply()
public void addLease(Lease lease)
IllegalStateException
- if already signedpublic int getLeaseCount()
public Lease getLease(int index)
public long getEarliestLeaseDate()
public long getLatestLeaseDate()
public boolean verifySignature()
verifySignature
in class DatabaseEntry
@Deprecated public boolean verifySignature(SigningPublicKey signingKey)
public boolean isCurrent(long fudge)
fudge
- milliseconds fudge factor to allow between the current timeprotected byte[] getBytes()
DatabaseEntry
getBytes
in class DatabaseEntry
public void readBytes(InputStream in) throws DataFormatException, IOException
in
- stream to read fromIllegalStateException
- if called more than once or Destination already setDataFormatException
- 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)