Skip to content

Commit 463921b

Browse files
committed
CKey: add method to negate the key
1 parent 848ec56 commit 463921b

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/key.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,12 @@ void CKey::MakeNewKey(bool fCompressedIn) {
163163
fCompressed = fCompressedIn;
164164
}
165165

166+
bool CKey::Negate()
167+
{
168+
assert(fValid);
169+
return secp256k1_ec_privkey_negate(secp256k1_context_sign, keydata.data());
170+
}
171+
166172
CPrivKey CKey::GetPrivKey() const {
167173
assert(fValid);
168174
CPrivKey privkey;

src/key.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ class CKey
9898
//! Generate a new private key using a cryptographic PRNG.
9999
void MakeNewKey(bool fCompressed);
100100

101+
//! Negate private key
102+
bool Negate();
103+
101104
/**
102105
* Convert the private key to a CPrivKey (serialized OpenSSL private key data).
103106
* This is expensive.

0 commit comments

Comments
 (0)