From 5178ca8c1ae590fdf35bed9e795fd09d81c1fc33 Mon Sep 17 00:00:00 2001 From: Daniel Larimer Date: Sun, 16 Feb 2014 21:28:55 -0500 Subject: [PATCH] added api methods to encryption functions --- include/fc/crypto/elliptic.hpp | 6 ++++++ src/crypto/aes.cpp | 1 + 2 files changed, 7 insertions(+) diff --git a/include/fc/crypto/elliptic.hpp b/include/fc/crypto/elliptic.hpp index 401c132..6730a19 100644 --- a/include/fc/crypto/elliptic.hpp +++ b/include/fc/crypto/elliptic.hpp @@ -99,6 +99,12 @@ namespace fc { bool verify( const fc::sha256& digest, const signature& sig ); 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: fc::fwd my; }; diff --git a/src/crypto/aes.cpp b/src/crypto/aes.cpp index 7459c93..72315f3 100644 --- a/src/crypto/aes.cpp +++ b/src/crypto/aes.cpp @@ -256,6 +256,7 @@ std::vector aes_encrypt( const fc::sha512& key, const std::vector& p auto cipher_len = aes_encrypt( (unsigned char*)plain_text.data(), plain_text.size(), (unsigned char*)&key, ((unsigned char*)&key)+32, (unsigned char*)cipher_text.data() ); + FC_ASSERT( cipher_len <= cipher_text.size() ); cipher_text.resize(cipher_len); return cipher_text;