mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-03-07 06:09:42 +00:00
decryptor for ECIES-X25519-AEAD-Ratchet
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include <string.h>
|
||||
#include "Log.h"
|
||||
#include "Gost.h"
|
||||
#include "Elligator.h"
|
||||
#include "CryptoKey.h"
|
||||
|
||||
namespace i2p
|
||||
@@ -146,6 +147,22 @@ namespace crypto
|
||||
BN_free (x); BN_free (y);
|
||||
}
|
||||
|
||||
|
||||
bool ECIESX25519AEADRatchetDecryptor::Decrypt (const uint8_t * epub, uint8_t * keyMaterial, BN_CTX * ctx, bool zeroPadding)
|
||||
{
|
||||
uint8_t key[32];
|
||||
if (!GetElligator ()->Decode (epub, key)) return false;
|
||||
m_StaticKeys.Agree (key, keyMaterial);
|
||||
return true;
|
||||
}
|
||||
|
||||
void CreateECIESX25519AEADRatchetRandomKeys (uint8_t * priv, uint8_t * pub)
|
||||
{
|
||||
X25519Keys k;
|
||||
k.GenerateKeys ();
|
||||
k.GetPrivateKey (priv);
|
||||
memcpy (pub, k.GetPublicKey (), 32);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user