Author

Topic: Digging source code: "Private key" vs. "Secret parameter" (Read 941 times)

legendary
Activity: 1176
Merit: 1280
May Bitcoin be touched by his Noodly Appendage
Looks like what we usually call a private key is a short 32 byte "secret parameter".
Absolutely

Why do we need a big CPrivKey when you can always generate key pair from just a secret?
I'm interested in the answer too
full member
Activity: 200
Merit: 104
Software design and user experience.
I'm reading Bitcoin-QT source code and don't quite understand the difference between CPrivKey and CSecret.

key.h has some explanation:

// CPrivKey is a serialized private key, with all parameters included (279 bytes)
typedef std::vector > CPrivKey;
// CSecret is a serialization of just the secret parameter (32 bytes)
typedef std::vector > CSecret;

Looks like what we usually call a private key is a short 32 byte "secret parameter". But then I see code that uses CPrivKey in wallet.cpp. I would go to OpenSSL to study the difference between EC_KEY_get0_private_key (used in CKey::GetSecret) and i2d_ECPrivateKey (used in CKey::GetPrivKey), but OpenSSL .h documentation does not really explain much.

Why do we need a big CPrivKey when you can always generate key pair from just a secret? Where can I learn more about practical aspects of ECDSA (I already have a good theoretical guide)?

Thanks.
Jump to: