mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-07-04 17:23:54 +02:00
blind public key for encrypted LeaseSet2
This commit is contained in:
parent
ea3070d02b
commit
32e55ebd0c
4 changed files with 30 additions and 2 deletions
|
@ -3,6 +3,7 @@
|
|||
#include <openssl/hmac.h>
|
||||
#include "I2PEndian.h"
|
||||
#include "Crypto.h"
|
||||
#include "Ed25519.h"
|
||||
#include "Log.h"
|
||||
#include "Timestamp.h"
|
||||
#include "NetDb.hpp"
|
||||
|
@ -532,6 +533,16 @@ namespace data
|
|||
HMAC(EVP_sha256(), prk, 32, out, 41, out + 32, &len);
|
||||
}
|
||||
|
||||
void LeaseSet2::BlindPublicKey (std::shared_ptr<const IdentityEx> identity, const char * date, SigningKeyType blindedKeyType, uint8_t * blindedKey)
|
||||
{
|
||||
uint16_t stA = htobe16 (identity->GetSigningKeyType ()), stA1 = htobe16 (blindedKeyType);
|
||||
uint8_t salt[32], seed[64];
|
||||
//seed = HKDF(H("I2PGenerateAlpha", keydata), datestring || secret, "i2pblinding1", 64)
|
||||
H ("I2PGenerateAlpha", { {identity->GetSigningPublicKeyBuffer (), identity->GetSigningPublicKeyLen ()}, {(const uint8_t *)&stA, 2}, {(const uint8_t *)&stA1, 2} }, salt);
|
||||
HKDF (salt, { (const uint8_t *)date, 8 }, "i2pblinding1", seed);
|
||||
i2p::crypto::GetEd25519 ()->BlindPublicKey (identity->GetSigningPublicKeyBuffer (), seed, blindedKey);
|
||||
}
|
||||
|
||||
void LeaseSet2::Encrypt (const uint8_t * data, uint8_t * encrypted, BN_CTX * ctx) const
|
||||
{
|
||||
auto encryptor = m_Encryptor; // TODO: atomic
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue