Merge branch 'phoenix' of https://github.com/InvictusInnovations/fc into phoenix

This commit is contained in:
dnotestein 2013-09-12 21:56:57 -04:00
commit 64694d8e7f
2 changed files with 11 additions and 7 deletions

View file

@ -48,12 +48,12 @@ namespace fc
* and other information that is generally only useful for
* developers.
*/
string to_detail_string( log_level ll = log_level::all )const;
std::string to_detail_string( log_level ll = log_level::all )const;
/**
* Generates a user-friendly error report.
*/
string to_string( log_level ll = log_level::info )const;
std::string to_string( log_level ll = log_level::info )const;
/**
* Throw this exception as its most derived type.
@ -183,7 +183,7 @@ namespace fc
FC_DECLARE_EXCEPTION( assert_exception, "Assert Exception" );
FC_DECLARE_EXCEPTION( eof_exception, "End Of File" );
fc::string except_str();
std::string except_str();
} // namespace fc

View file

@ -389,11 +389,15 @@ namespace fc { namespace ecc {
public_key::public_key( const public_key_data& dat )
{
const char* front = &dat.data[0];
my->_key = EC_KEY_new_by_curve_name( NID_secp256k1 );
my->_key = o2i_ECPublicKey( &my->_key, (const unsigned char**)&front, sizeof(public_key_data) );
if( !my->_key )
if( *front == 0 ){}
else
{
FC_THROW_EXCEPTION( exception, "error decoding public key", ("s", ERR_error_string( ERR_get_error(), nullptr) ) );
my->_key = EC_KEY_new_by_curve_name( NID_secp256k1 );
my->_key = o2i_ECPublicKey( &my->_key, (const unsigned char**)&front, sizeof(public_key_data) );
if( !my->_key )
{
FC_THROW_EXCEPTION( exception, "error decoding public key", ("s", ERR_error_string( ERR_get_error(), nullptr) ) );
}
}
}