mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +02:00
TunnelDecryption for tunnels
This commit is contained in:
parent
7754968e7a
commit
0d51f240d0
3 changed files with 18 additions and 24 deletions
|
@ -1,8 +1,6 @@
|
|||
#include <string.h>
|
||||
#include "I2PEndian.h"
|
||||
#include <cryptopp/sha.h>
|
||||
#include <cryptopp/modes.h>
|
||||
#include <cryptopp/aes.h>
|
||||
#include <cryptopp/gzip.h>
|
||||
#include "ElGamal.h"
|
||||
#include "Timestamp.h"
|
||||
|
@ -259,11 +257,12 @@ namespace i2p
|
|||
//TODO: fill filler
|
||||
CryptoPP::SHA256().CalculateDigest(reply->hash, reply->padding, sizeof (reply->padding) + 1); // + 1 byte of ret
|
||||
// encrypt reply
|
||||
CryptoPP::CBC_Mode<CryptoPP::AES>::Encryption encryption;
|
||||
i2p::crypto::CBCEncryption encryption;
|
||||
for (int j = 0; j < num; j++)
|
||||
{
|
||||
encryption.SetKeyWithIV (clearText.replyKey, 32, clearText.replyIV);
|
||||
encryption.ProcessData((uint8_t *)(records + j), (uint8_t *)(records + j), sizeof (records[j]));
|
||||
encryption.SetKey (clearText.replyKey);
|
||||
encryption.SetIV (clearText.replyIV);
|
||||
encryption.Encrypt((uint8_t *)(records + j), sizeof (records[j]), (uint8_t *)(records + j));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue