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 voidencrypt(SessionKey key)Throws IllegalStateException if not initialized.booleanequals(Object object)HashgetHash()Overridden because we have a blinded key, not a dest.LeasegetLease(int index)intgetLeaseCount()protected SigningPublicKeygetSigningPublicKey()Overridden to return the blinded key so super.verifySignature() will work.intgetType()Get the type of the data structure.inthashCode()the destination has enough randomness in it to use it by itself for speedvoidreadBytes(InputStream in)This does NOT validate the signatureprotected voidreadHeader(InputStream in)Overridden because we have a blinded key, not a destprotected voidreadOfflineBytes(InputStream in)Overridden because we have a blinded key, not a destvoidsetDestination(Destination dest)Overridden to set the blinded keyintsize()Number of bytes, NOT including signatureStringtoString()booleanverifyOfflineSignature()Overridden because we have a blinded key, not a destprotected voidwriteBytesWithoutSig(OutputStream out)Without sig.protected voidwriteHeader(OutputStream out)Overridden because we have a blinded key, not a destprotected voidwriteOfflineBytes(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:DatabaseEntryGet the type of the data structure. This should be faster than instanceof.
-
getLeaseCount
public int getLeaseCount()
- Overrides:
getLeaseCountin 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:
setDestinationin 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:
getSigningPublicKeyin classDatabaseEntry- Returns:
- SPK or null
-
readBytes
public void readBytes(InputStream in) throws DataFormatException, IOException
This does NOT validate the signature- Specified by:
readBytesin interfaceDataStructure- Overrides:
readBytesin 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:
writeBytesWithoutSigin classLeaseSet2- Throws:
DataFormatExceptionIOException
-
verifyOfflineSignature
public boolean verifyOfflineSignature()
Overridden because we have a blinded key, not a dest- Overrides:
verifyOfflineSignaturein classLeaseSet2
-
readHeader
protected void readHeader(InputStream in) throws DataFormatException, IOException
Overridden because we have a blinded key, not a dest- Overrides:
readHeaderin classLeaseSet2- Throws:
DataFormatExceptionIOException
-
writeHeader
protected void writeHeader(OutputStream out) throws DataFormatException, IOException
Overridden because we have a blinded key, not a dest- Overrides:
writeHeaderin classLeaseSet2- Throws:
DataFormatExceptionIOException
-
readOfflineBytes
protected void readOfflineBytes(InputStream in) throws DataFormatException, IOException
Overridden because we have a blinded key, not a dest- Overrides:
readOfflineBytesin classLeaseSet2- Throws:
DataFormatExceptionIOException
-
writeOfflineBytes
protected void writeOfflineBytes(OutputStream out) throws DataFormatException, IOException
Overridden because we have a blinded key, not a dest- Overrides:
writeOfflineBytesin classLeaseSet2- Throws:
DataFormatExceptionIOException
-
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:
getHashin classDatabaseEntry- Returns:
- Hash or null
- Throws:
IllegalStateException
-
encrypt
public void encrypt(SessionKey key)
Throws IllegalStateException if not initialized.- Overrides:
encryptin 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
-
-