| 77 | } |
| 78 | |
| 79 | bool I2CPDestination::Decrypt (const uint8_t * encrypted, uint8_t * data, i2p::data::CryptoKeyType preferredCrypto) const |
| 80 | { |
| 81 | std::shared_ptr<i2p::crypto::LocalEncryptionKey> encryptionKey; |
| 82 | if (!m_EncryptionKeys.empty ()) |
| 83 | { |
| 84 | if (m_EncryptionKeys.rbegin ()->first == preferredCrypto) |
| 85 | encryptionKey = m_EncryptionKeys.rbegin ()->second; |
| 86 | else |
| 87 | { |
| 88 | auto it = m_EncryptionKeys.find (preferredCrypto); |
| 89 | if (it != m_EncryptionKeys.end ()) |
| 90 | encryptionKey = it->second; |
| 91 | } |
| 92 | if (!encryptionKey) |
| 93 | encryptionKey = m_EncryptionKeys.rbegin ()->second; |
| 94 | } |
| 95 | if (encryptionKey) |
| 96 | return encryptionKey->decryptor->Decrypt (encrypted, data); |
| 97 | else |
| 98 | LogPrint (eLogError, "I2CP: Decryptor is not set"); |
| 99 | return false; |
| 100 | } |
| 101 | |
| 102 | const uint8_t * I2CPDestination::GetEncryptionPublicKey (i2p::data::CryptoKeyType keyType) const |
| 103 | { |
nothing calls this directly
no test coverage detected