64 void setPath(std::string
const& _path);
72 static bytesSec secret(std::string
const& _content, std::string
const& _pass);
77 h128 importKey(std::string
const& _file) {
auto ret = readKey(_file,
false);
if (ret) save();
return ret; }
80 h128 importKeyContent(std::string
const& _content) {
auto ret = readKeyContent(_content, std::string());
if (ret) save();
return ret; }
83 h128 importSecret(
bytesSec const& _s, std::string
const& _pass);
90 void kill(
h128 const& _uuid);
93 std::vector<h128>
keys()
const {
return keysOf(m_keys); }
100 void clearCache()
const;
105 h128 readKey(std::string
const& _file,
bool _takeFileOwnership);
110 h128 readKeyContent(std::string
const& _content, std::string
const& _file = std::string());
113 void save(std::string
const& _keysPath);
117 bool noteAddress(
h128 const& _uuid,
Address const& _address);
126 void load(std::string
const& _keysPath);
131 static bytesSec decrypt(std::string
const& _v, std::string
const& _pass);
133 std::pair<h128 const, EncryptedKey>
const* key(
Address const& _address)
const;
134 std::pair<h128 const, EncryptedKey>* key(
Address const& _address);
136 mutable std::unordered_map<h128, bytesSec>
m_cached;
138 std::unordered_map<h128, EncryptedKey>
m_keys;
Adapted from code found on http://stackoverflow.com/questions/180947/base64-decode-snippet-in-c Origi...
Address address(h128 const &_uuid) const
#define function(a, b, c, d, k, s)
std::vector< T > keysOf(std::map< T, U > const &_m)
h128 importKey(std::string const &_file)
Imports the (encrypted) key stored in the file _file and copies it to the managed directory...
void save()
Store all keys in the managed directory.
std::vector< h128 > keys() const
Returns the uuids of all stored keys.
std::string getDataDir(std::string _prefix="ethereum")
Fixed-size raw-byte array container type, with an API optimised for storing hashes.
h128 importKeyContent(std::string const &_content)
Imports the (encrypted) key contained in the json formatted _content and stores it in the managed dir...
void encrypt(Public const &_k, bytesConstRef _plain, bytes &o_cipher)
Encrypts plain text using Public key.
bool decrypt(Secret const &_k, bytesConstRef _cipher, bytes &o_plaintext)
Decrypts cipher using Secret key.
std::unordered_map< h128, EncryptedKey > m_keys
Stores encrypted keys together with the file they were loaded from by uuid.
bool contains(h128 const &_k) const
Manages encrypted keys stored in a certain directory on disk.
static std::string defaultPath()
std::unordered_map< h128, bytesSec > m_cached
Stores decrypted keys by uuid.