bool CKey::Sign(const uint256 &hash, std::vector<unsigned char>& vchSig) const { if (!fValid) return false; CECKey key; key.SetSecretBytes(vch); return key.Sign(hash, vchSig); }
CPrivKey CKey::GetPrivKey() const { assert(fValid); CECKey key; key.SetSecretBytes(vch); CPrivKey privkey; key.GetPrivKey(privkey, fCompressed); return privkey; }
CPubKey CKey::GetPubKey() const { assert(fValid); CECKey key; key.SetSecretBytes(vch); CPubKey pubkey; key.GetPubKey(pubkey, fCompressed); return pubkey; }
bool CKey::Decrypt(ecies_secure_t const &cryptex, std::string &vchText ) { if (!fValid) return false; CECKey key; key.SetSecretBytes(vch); return key.Decrypt(cryptex, vchText); }
bool CKey::SignCompact(const uint256 &hash, std::vector<unsigned char>& vchSig) const { if (!fValid) return false; CECKey key; key.SetSecretBytes(vch); vchSig.resize(65); int rec = -1; if (!key.SignCompact(hash, &vchSig[1], rec)) return false; assert(rec != -1); vchSig[0] = 27 + rec + (fCompressed ? 4 : 0); return true; }