added api methods to encryption functions

This commit is contained in:
Daniel Larimer 2014-02-16 21:28:55 -05:00
parent a5c8a07dc6
commit 5178ca8c1a
2 changed files with 7 additions and 0 deletions

View file

@ -99,6 +99,12 @@ namespace fc {
bool verify( const fc::sha256& digest, const signature& sig ); bool verify( const fc::sha256& digest, const signature& sig );
public_key get_public_key()const; public_key get_public_key()const;
inline friend bool operator==( const private_key& a, const private_key& b )
{
return a.get_secret() == b.get_secret();
}
private: private:
fc::fwd<detail::private_key_impl,8> my; fc::fwd<detail::private_key_impl,8> my;
}; };

View file

@ -256,6 +256,7 @@ std::vector<char> aes_encrypt( const fc::sha512& key, const std::vector<char>& p
auto cipher_len = aes_encrypt( (unsigned char*)plain_text.data(), plain_text.size(), auto cipher_len = aes_encrypt( (unsigned char*)plain_text.data(), plain_text.size(),
(unsigned char*)&key, ((unsigned char*)&key)+32, (unsigned char*)&key, ((unsigned char*)&key)+32,
(unsigned char*)cipher_text.data() ); (unsigned char*)cipher_text.data() );
FC_ASSERT( cipher_len <= cipher_text.size() );
cipher_text.resize(cipher_len); cipher_text.resize(cipher_len);
return cipher_text; return cipher_text;