| 333 | } |
| 334 | |
| 335 | Binary Session::MyDestination() const |
| 336 | { |
| 337 | // From https://geti2p.net/spec/common-structures#destination: |
| 338 | // "They are 387 bytes plus the certificate length specified at bytes 385-386, which may be |
| 339 | // non-zero" |
| 340 | static constexpr size_t DEST_LEN_BASE = 387; |
| 341 | static constexpr size_t CERT_LEN_POS = 385; |
| 342 | |
| 343 | uint16_t cert_len; |
| 344 | memcpy(&cert_len, &m_private_key.at(CERT_LEN_POS), sizeof(cert_len)); |
| 345 | cert_len = be16toh(cert_len); |
| 346 | |
| 347 | const size_t dest_len = DEST_LEN_BASE + cert_len; |
| 348 | |
| 349 | return Binary{m_private_key.begin(), m_private_key.begin() + dest_len}; |
| 350 | } |
| 351 | |
| 352 | void Session::CreateIfNotCreatedAlready() |
| 353 | { |