mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-27 11:17:49 +02:00
implement Decrypt for all local destination
This commit is contained in:
parent
60aa459dfc
commit
c5f784719d
8 changed files with 44 additions and 6 deletions
|
@ -587,7 +587,13 @@ namespace data
|
|||
std::shared_ptr<i2p::crypto::CryptoKeyDecryptor> PrivateKeys::CreateDecryptor (const uint8_t * key) const
|
||||
{
|
||||
if (!key) key = m_PrivateKey; // use privateKey
|
||||
switch (m_Public->GetCryptoKeyType ())
|
||||
return CreateDecryptor (m_Public->GetCryptoKeyType (), key);
|
||||
}
|
||||
|
||||
std::shared_ptr<i2p::crypto::CryptoKeyDecryptor> PrivateKeys::CreateDecryptor (CryptoKeyType cryptoType, const uint8_t * key)
|
||||
{
|
||||
if (!key) return nullptr;
|
||||
switch (cryptoType)
|
||||
{
|
||||
case CRYPTO_KEY_TYPE_ELGAMAL:
|
||||
return std::make_shared<i2p::crypto::ElGamalDecryptor>(key);
|
||||
|
@ -596,9 +602,9 @@ namespace data
|
|||
return std::make_shared<i2p::crypto::ECIESP256Decryptor>(key);
|
||||
break;
|
||||
default:
|
||||
LogPrint (eLogError, "Identity: Unknown crypto key type ", (int)m_Public->GetCryptoKeyType ());
|
||||
LogPrint (eLogError, "Identity: Unknown crypto key type ", (int)cryptoType);
|
||||
};
|
||||
return nullptr;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PrivateKeys PrivateKeys::CreateRandomKeys (SigningKeyType type, CryptoKeyType cryptoType)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue