|
@ -23,7 +23,6 @@ |
|
|
|
|
|
|
|
|
#pragma once |
|
|
#pragma once |
|
|
|
|
|
|
|
|
#include "CryptoPP.h" |
|
|
|
|
|
#include "Common.h" |
|
|
#include "Common.h" |
|
|
|
|
|
|
|
|
namespace dev |
|
|
namespace dev |
|
@ -31,28 +30,12 @@ namespace dev |
|
|
namespace crypto |
|
|
namespace crypto |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
/// ECDSA Signature
|
|
|
|
|
|
using Signature = FixedHash<65>; |
|
|
|
|
|
|
|
|
|
|
|
/// Secret nonce from trusted key exchange.
|
|
|
|
|
|
using Nonce = h256; |
|
|
|
|
|
|
|
|
|
|
|
/// Public key with nonce corresponding to trusted key exchange.
|
|
|
|
|
|
typedef std::pair<Nonce,Public> PublicTrust; |
|
|
|
|
|
|
|
|
|
|
|
/// Recover public key from signature.
|
|
|
|
|
|
//Public recover(Signature const& _sig, h256 _messageHash);
|
|
|
|
|
|
|
|
|
|
|
|
/// Encrypts text (in place).
|
|
|
/// Encrypts text (in place).
|
|
|
void encrypt(Public const& _k, bytes& _text); |
|
|
void encrypt(Public const& _k, bytes& _text); |
|
|
|
|
|
|
|
|
/// Encrypt _text into _cipher.
|
|
|
|
|
|
//void encrypt(Public const& _k, bytesConstRef& _text, bytesRef& _cipher);
|
|
|
|
|
|
|
|
|
|
|
|
/// Decrypts text (in place).
|
|
|
/// Decrypts text (in place).
|
|
|
void decrypt(Secret const& _k, bytes& _text); |
|
|
void decrypt(Secret const& _k, bytes& _text); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class SecretKeyRef |
|
|
class SecretKeyRef |
|
|
{ |
|
|
{ |
|
|
public: |
|
|
public: |
|
@ -76,20 +59,28 @@ private: |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// [ECDHE Trusted Key Exchange]:
|
|
|
|
|
|
|
|
|
|
|
|
/// ECDSA Signature
|
|
|
|
|
|
using Signature = FixedHash<65>; |
|
|
|
|
|
|
|
|
|
|
|
/// Secret nonce from trusted key exchange.
|
|
|
|
|
|
using Nonce = h256; |
|
|
|
|
|
|
|
|
|
|
|
/// Public key with nonce corresponding to trusted key exchange.
|
|
|
|
|
|
typedef std::pair<Nonce,Public> PublicTrust; |
|
|
|
|
|
|
|
|
/**
|
|
|
/**
|
|
|
* @brief EC KeyPair |
|
|
* @brief EC KeyPair |
|
|
* @deprecated |
|
|
* @deprecated |
|
|
*/ |
|
|
*/ |
|
|
class ECKeyPair |
|
|
class ECKeyPair |
|
|
{ |
|
|
{ |
|
|
friend class ECDHETKeyExchange; |
|
|
|
|
|
|
|
|
|
|
|
public: |
|
|
/// TO BE REMOVED
|
|
|
static ECKeyPair create(); |
|
|
|
|
|
|
|
|
|
|
|
private: |
|
|
|
|
|
ECKeyPair() {}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
friend class ECDHETKeyExchange; |
|
|
std::map<Address,PublicTrust> m_trustEgress; |
|
|
std::map<Address,PublicTrust> m_trustEgress; |
|
|
std::set<Nonce> m_trustIngress; |
|
|
std::set<Nonce> m_trustIngress; |
|
|
}; |
|
|
}; |
|
|