mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 03:37:49 +02:00
decryptor for ECIES-X25519-AEAD-Ratchet
This commit is contained in:
parent
9ed58e5186
commit
553d59c32b
4 changed files with 43 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue