diff --git a/include/fc/exception/exception.hpp b/include/fc/exception/exception.hpp index 968d9d0..805ceaa 100644 --- a/include/fc/exception/exception.hpp +++ b/include/fc/exception/exception.hpp @@ -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 diff --git a/src/crypto/elliptic.cpp b/src/crypto/elliptic.cpp index 704f5cb..68f7ad6 100644 --- a/src/crypto/elliptic.cpp +++ b/src/crypto/elliptic.cpp @@ -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) ) ); + } } }