| 168 | } |
| 169 | |
| 170 | CPubKey CKey::GetPubKey() const { |
| 171 | assert(fValid); |
| 172 | secp256k1_pubkey pubkey; |
| 173 | CPubKey result; |
| 174 | size_t clen = 65; |
| 175 | int ret = secp256k1_ec_pubkey_create(secp256k1_context_sign, &pubkey, begin()); |
| 176 | assert(ret); |
| 177 | secp256k1_ec_pubkey_serialize(secp256k1_context_sign, (unsigned char*)result.begin(), &clen, &pubkey, fCompressed ? SECP256K1_EC_COMPRESSED : SECP256K1_EC_UNCOMPRESSED); |
| 178 | assert(result.size() == clen); |
| 179 | assert(result.IsValid()); |
| 180 | return result; |
| 181 | } |
| 182 | |
| 183 | bool CKey::SignECDSA(const uint256& hash, std::vector<uint8_t>& vchSig, uint32_t test_case) const { |
| 184 | if (!fValid) |