MCPcopy Create free account
hub / github.com/PurpleI2P/i2pd / Decrypt

Method Decrypt

libi2pd_client/I2CP.cpp:79–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 {

Callers

nothing calls this directly

Calls 1

LogPrintFunction · 0.85

Tested by

no test coverage detected