Skip to content

Commit

Permalink
Key refactor for Message/Alert system
Browse files Browse the repository at this point in the history
  • Loading branch information
aciddude committed Feb 7, 2017
1 parent bc8a3df commit dab8f3d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/rpcnet.cpp
Expand Up @@ -461,9 +461,12 @@ Value sendalert(const Array& params, bool fHelp)

// Prepare master key and sign alert message
CBitcoinSecret vchSecret;
bool fCompressed;
if (!vchSecret.SetString(params[1].get_str()))
throw runtime_error("Invalid alert master key");
CKey key = vchSecret.GetKey(); // if key is not correct openssl may crash
CKey key;
CSecret secret = vchSecret.GetSecret(fCompressed);
key.SetSecret(secret, fCompressed); // if key is not correct openssl may crash
if (!key.Sign(Hash(alert.vchMsg.begin(), alert.vchMsg.end()), alert.vchSig))
throw runtime_error(
"Unable to sign alert, check alert master key?\n");
Expand Down

0 comments on commit dab8f3d

Please sign in to comment.