I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 1c4d1e9a authored by zzz's avatar zzz
Browse files

* LeaseSet: Fix size calculations

parent 51f20c2c
No related branches found
No related tags found
No related merge requests found
......@@ -229,7 +229,7 @@ public class LeaseSet extends DatabaseEntry {
return null;
int len = PublicKey.KEYSIZE_BYTES // dest
+ SigningPublicKey.KEYSIZE_BYTES // dest
+ 4 // cert
+ 3 // cert minimum, could be more, only used to size the BAOS
+ PublicKey.KEYSIZE_BYTES // encryptionKey
+ SigningPublicKey.KEYSIZE_BYTES // signingKey
+ 1
......@@ -295,13 +295,16 @@ public class LeaseSet extends DatabaseEntry {
_signature.writeBytes(out);
}
/**
* Number of bytes, NOT including signature
*/
public int size() {
return PublicKey.KEYSIZE_BYTES //destination.pubKey
+ SigningPublicKey.KEYSIZE_BYTES // destination.signPubKey
+ 2 // destination.certificate
+ _destination.getCertificate().size() // destination.certificate, usually 3
+ PublicKey.KEYSIZE_BYTES // encryptionKey
+ SigningPublicKey.KEYSIZE_BYTES // signingKey
+ 1
+ 1 // number of leases
+ _leases.size() * (Hash.HASH_LENGTH + 4 + 8);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment