|
||||||||||
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
net.i2p.data.LeaseSet
public class LeaseSet
Defines the set of leases a destination currently has. Support encryption and decryption with a supplied key. Only the gateways and tunnel IDs in the individual leases are encrypted. Encrypted leases are not indicated as such. The only way to tell a lease is encrypted is to determine that the listed gateways do not exist. Routers wishing to decrypt a leaseset must have the desthash and key in their keyring. This is required for the local router as well, since the encryption is done on the client side of I2CP, the router must decrypt it back again for local usage (but not for transmission to the floodfills) Decrypted leases are only available through the getLease() method, so that storage and network transmission via writeBytes() will output the original encrypted leases and the original leaseset signature. Revocation (zero leases) isn't used anywhere. In addition: - A revoked leaseset has an EarliestLeaseDate of -1, so it will never be stored successfully. - Revocation of an encrypted leaseset will explode. - So having an included signature at all is pointless?
Field Summary | |
---|---|
static int |
MAX_LEASES
This seems like plenty |
Fields inherited from class net.i2p.data.DatabaseEntry |
---|
_currentRoutingKey, _routingKeyGenMod, _signature, KEY_TYPE_LEASESET, KEY_TYPE_ROUTERINFO |
Constructor Summary | |
---|---|
LeaseSet()
|
Method Summary | |
---|---|
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()
|
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 |
Methods inherited from class net.i2p.data.DatabaseEntry |
---|
getHash, getRoutingKey, getSignature, getSigningPublicKey, setRoutingKey, setSignature, sign, validateRoutingKey |
Methods inherited from class net.i2p.data.DataStructureImpl |
---|
calculateHash, fromBase64, fromByteArray, read, toBase64, toByteArray |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int MAX_LEASES
Constructor Detail |
---|
public LeaseSet()
Method Detail |
---|
public long getDate()
DatabaseEntry
getDate
in class DatabaseEntry
protected KeysAndCert getKeysAndCert()
DatabaseEntry
getKeysAndCert
in class DatabaseEntry
public int getType()
DatabaseEntry
getType
in class DatabaseEntry
public 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 DatabaseEntry
public boolean verifySignature(SigningPublicKey signingKey)
public boolean isCurrent(long fudge)
fudge
- milliseconds fudge factor to allow between the current time
protected byte[] getBytes()
DatabaseEntry
getBytes
in class DatabaseEntry
public void readBytes(InputStream in) throws DataFormatException, IOException
in
- stream to read from
DataFormatException
- if the data is improperly formatted
IOException
- if there was a problem reading the streampublic void writeBytes(OutputStream out) throws DataFormatException, IOException
out
- stream to write to
DataFormatException
- if the data was incomplete or not yet ready to be written
IOException
- if there was a problem writing to the streampublic int size()
public boolean equals(Object object)
equals
in class Object
public int hashCode()
hashCode
in class Object
public String toString()
toString
in class Object
public void encrypt(SessionKey key)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |