| 146 | } |
| 147 | |
| 148 | bool CAlert::Sign() |
| 149 | { |
| 150 | CDataStream sMsg(SER_NETWORK, CLIENT_VERSION); |
| 151 | sMsg << *(CUnsignedAlert*)this; |
| 152 | vchMsg = std::vector<unsigned char>(sMsg.begin(), sMsg.end()); |
| 153 | CBitcoinSecret vchSecret; |
| 154 | if (!vchSecret.SetString(GetArg("-alertkey", ""))) |
| 155 | { |
| 156 | printf("CAlert::SignAlert() : vchSecret.SetString failed\n"); |
| 157 | return false; |
| 158 | } |
| 159 | CKey key = vchSecret.GetKey(); |
| 160 | if (!key.SignECDSA(Hash(vchMsg.begin(), vchMsg.end()), vchSig)) |
| 161 | { |
| 162 | printf("CAlert::SignAlert() : key.SignECDSA failed\n"); |
| 163 | return false; |
| 164 | } |
| 165 | |
| 166 | return true; |
| 167 | } |
| 168 | |
| 169 | bool CAlert::CheckSignature(const std::vector<unsigned char>& alertKey) const |
| 170 | { |