|
|
|
@ -748,7 +748,7 @@ namespace data
@@ -748,7 +748,7 @@ namespace data
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
LocalLeaseSet2::LocalLeaseSet2 (uint8_t storeType, const i2p::data::PrivateKeys& keys, |
|
|
|
|
uint16_t keyType, uint16_t keyLen, const uint8_t * encryptionPublicKey, |
|
|
|
|
const KeySections& encryptionKeys, |
|
|
|
|
std::vector<std::shared_ptr<i2p::tunnel::InboundTunnel> > tunnels, |
|
|
|
|
bool isPublic, bool isPublishedEncrypted): |
|
|
|
|
LocalLeaseSet (keys.GetPublic (), nullptr, 0) |
|
|
|
@ -757,8 +757,11 @@ namespace data
@@ -757,8 +757,11 @@ namespace data
|
|
|
|
|
// assume standard LS2
|
|
|
|
|
int num = tunnels.size (); |
|
|
|
|
if (num > MAX_NUM_LEASES) num = MAX_NUM_LEASES; |
|
|
|
|
size_t keySectionsLen = 0; |
|
|
|
|
for (const auto& it: encryptionKeys) |
|
|
|
|
keySectionsLen += 2/*key type*/ + 2/*key len*/ + it.keyLen/*key*/; |
|
|
|
|
m_BufferLen = identity->GetFullLen () + 4/*published*/ + 2/*expires*/ + 2/*flag*/ + 2/*properties len*/ + |
|
|
|
|
1/*num keys*/ + 2/*key type*/ + 2/*key len*/ + keyLen/*key*/ + 1/*num leases*/ + num*LEASE2_SIZE + keys.GetSignatureLen (); |
|
|
|
|
1/*num keys*/ + keySectionsLen + 1/*num leases*/ + num*LEASE2_SIZE + keys.GetSignatureLen (); |
|
|
|
|
uint16_t flags = 0; |
|
|
|
|
if (keys.IsOfflineSignature ()) |
|
|
|
|
{ |
|
|
|
@ -789,10 +792,13 @@ namespace data
@@ -789,10 +792,13 @@ namespace data
|
|
|
|
|
} |
|
|
|
|
htobe16buf (m_Buffer + offset, 0); offset += 2; // properties len
|
|
|
|
|
// keys
|
|
|
|
|
m_Buffer[offset] = 1; offset++; // 1 key
|
|
|
|
|
htobe16buf (m_Buffer + offset, keyType); offset += 2; // key type
|
|
|
|
|
htobe16buf (m_Buffer + offset, keyLen); offset += 2; // key len
|
|
|
|
|
memcpy (m_Buffer + offset, encryptionPublicKey, keyLen); offset += keyLen; // key
|
|
|
|
|
m_Buffer[offset] = encryptionKeys.size (); offset++; // 1 key
|
|
|
|
|
for (const auto& it: encryptionKeys) |
|
|
|
|
{ |
|
|
|
|
htobe16buf (m_Buffer + offset, it.keyType); offset += 2; // key type
|
|
|
|
|
htobe16buf (m_Buffer + offset, it.keyLen); offset += 2; // key len
|
|
|
|
|
memcpy (m_Buffer + offset, it.encryptionPublicKey, it.keyLen); offset += it.keyLen; // key
|
|
|
|
|
} |
|
|
|
|
// leases
|
|
|
|
|
uint32_t expirationTime = 0; // in seconds
|
|
|
|
|
m_Buffer[offset] = num; offset++; // num leases
|
|
|
|
|