* LeaseSet: Fix size calculations

This commit is contained in:
zzz
2011-12-09 13:16:29 +00:00
parent 51f20c2c33
commit 1c4d1e9a62

View File

@ -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);
}