Package net.i2p.data
Class EncryptedLeaseSet
- java.lang.Object
-
- net.i2p.data.DataStructureImpl
-
- net.i2p.data.DatabaseEntry
-
- net.i2p.data.LeaseSet
-
- net.i2p.data.LeaseSet2
-
- net.i2p.data.EncryptedLeaseSet
-
- All Implemented Interfaces:
Serializable
,DataStructure
public class EncryptedLeaseSet extends LeaseSet2
Use getSigningKey() / setSigningKey() (revocation key in super) for the blinded key. PRELIMINARY - Subject to change - see proposal 123- Since:
- 0.9.38
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class net.i2p.data.LeaseSet2
_expires, _flags, _offlineSignature, _options, _published, _transientExpires, _transientSigningPublicKey
-
Fields inherited from class net.i2p.data.LeaseSet
_byteified, _checked, _destination, _encryptionKey, _lastExpiration, _leases, _receivedAsPublished, _signingKey, MAX_LEASES
-
Fields inherited from class net.i2p.data.DatabaseEntry
_currentRoutingKey, _routingKeyGenMod, _signature, KEY_TYPE_ENCRYPTED_LS2, KEY_TYPE_LEASESET, KEY_TYPE_LS2, KEY_TYPE_META_LS2, KEY_TYPE_ROUTERINFO, KEY_TYPE_SERVICE_LIST, KEY_TYPE_SERVICE_RECORD
-
-
Constructor Summary
Constructors Constructor Description EncryptedLeaseSet()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
encrypt(SessionKey key)
Throws IllegalStateException if not initialized.boolean
equals(Object object)
Hash
getHash()
Overridden because we have a blinded key, not a dest.Lease
getLease(int index)
int
getLeaseCount()
protected SigningPublicKey
getSigningPublicKey()
Overridden to return the blinded key so super.verifySignature() will work.int
getType()
Get the type of the data structure.int
hashCode()
the destination has enough randomness in it to use it by itself for speedvoid
readBytes(InputStream in)
This does NOT validate the signatureprotected void
readHeader(InputStream in)
Overridden because we have a blinded key, not a destprotected void
readOfflineBytes(InputStream in)
Overridden because we have a blinded key, not a destvoid
setDestination(Destination dest)
Overridden to set the blinded keyint
size()
Number of bytes, NOT including signatureString
toString()
boolean
verifyOfflineSignature()
Overridden because we have a blinded key, not a destprotected void
writeBytesWithoutSig(OutputStream out)
Without sig.protected void
writeHeader(OutputStream out)
Overridden because we have a blinded key, not a destprotected void
writeOfflineBytes(OutputStream out)
Overridden because we have a blinded key, not a dest-
Methods inherited from class net.i2p.data.LeaseSet2
addEncryptionKey, addLease, getBlindedHash, getBytes, getEncryptionKeys, getOption, getTransientSigningKey, isOffline, isUnpublished, offlineSign, setBlindedHash, setOfflineSignature, setOptions, setUnpublished, sign, verifyOfflineSignature, verifySignature, writeBody, writeBytes
-
Methods inherited from class net.i2p.data.LeaseSet
getDate, getDestination, getEarliestLeaseDate, getEncryptionKey, getKeysAndCert, getLatestLeaseDate, getReceivedAsPublished, getReceivedAsReply, getSigningKey, isCurrent, setEncryptionKey, setReceivedAsPublished, setReceivedAsReply, setSigningKey, verifySignature
-
Methods inherited from class net.i2p.data.DatabaseEntry
getRoutingKey, getSignature, isLeaseSet, isLeaseSet, setSignature, validateRoutingKey
-
Methods inherited from class net.i2p.data.DataStructureImpl
calculateHash, fromBase64, fromByteArray, read, toBase64, toByteArray
-
-
-
-
Method Detail
-
getType
public int getType()
Description copied from class:DatabaseEntry
Get the type of the data structure. This should be faster than instanceof.
-
getLeaseCount
public int getLeaseCount()
- Overrides:
getLeaseCount
in classLeaseSet
- Returns:
- 0-16, or 0 if not decrypted.
-
getLease
public Lease getLease(int index)
-
setDestination
public void setDestination(Destination dest)
Overridden to set the blinded key- Overrides:
setDestination
in classLeaseSet
- Parameters:
dest
- non-null, must be EdDSA_SHA512_Ed25519- Throws:
IllegalStateException
- if already signedIllegalArgumentException
- if not EdDSA
-
getSigningPublicKey
protected SigningPublicKey getSigningPublicKey()
Overridden to return the blinded key so super.verifySignature() will work.- Overrides:
getSigningPublicKey
in classDatabaseEntry
- Returns:
- SPK or null
-
readBytes
public void readBytes(InputStream in) throws DataFormatException, IOException
This does NOT validate the signature- Specified by:
readBytes
in interfaceDataStructure
- Overrides:
readBytes
in classLeaseSet2
- Parameters:
in
- stream to read from- Throws:
IllegalStateException
- if called more than once or Destination already setDataFormatException
- if the data is improperly formattedIOException
- if there was a problem reading the stream
-
writeBytesWithoutSig
protected void writeBytesWithoutSig(OutputStream out) throws DataFormatException, IOException
Without sig. This does NOT validate the signature- Overrides:
writeBytesWithoutSig
in classLeaseSet2
- Throws:
DataFormatException
IOException
-
verifyOfflineSignature
public boolean verifyOfflineSignature()
Overridden because we have a blinded key, not a dest- Overrides:
verifyOfflineSignature
in classLeaseSet2
-
readHeader
protected void readHeader(InputStream in) throws DataFormatException, IOException
Overridden because we have a blinded key, not a dest- Overrides:
readHeader
in classLeaseSet2
- Throws:
DataFormatException
IOException
-
writeHeader
protected void writeHeader(OutputStream out) throws DataFormatException, IOException
Overridden because we have a blinded key, not a dest- Overrides:
writeHeader
in classLeaseSet2
- Throws:
DataFormatException
IOException
-
readOfflineBytes
protected void readOfflineBytes(InputStream in) throws DataFormatException, IOException
Overridden because we have a blinded key, not a dest- Overrides:
readOfflineBytes
in classLeaseSet2
- Throws:
DataFormatException
IOException
-
writeOfflineBytes
protected void writeOfflineBytes(OutputStream out) throws DataFormatException, IOException
Overridden because we have a blinded key, not a dest- Overrides:
writeOfflineBytes
in classLeaseSet2
- Throws:
DataFormatException
IOException
-
getHash
public Hash getHash()
Overridden because we have a blinded key, not a dest. This is the hash of the signing public key type and the signing public key. Throws IllegalStateException if not initialized.- Overrides:
getHash
in classDatabaseEntry
- Returns:
- Hash or null
- Throws:
IllegalStateException
-
encrypt
public void encrypt(SessionKey key)
Throws IllegalStateException if not initialized.- Overrides:
encrypt
in classLeaseSet2
- Parameters:
key
- ignored, to be fixed- Throws:
IllegalStateException
-
hashCode
public int hashCode()
the destination has enough randomness in it to use it by itself for speed
-
-