Connor Huffine
unread,May 19, 2013, 2:18:48 AM5/19/13Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to cryptop...@googlegroups.com
For some reason, my code is not giving me proper pairs; it gives me a private key that doesn't correspond to the public key I'm generating. Everything is in hex.
Example:
private key: e6d9f1845ccf7effe2e0a4d79a4adf59ab421e71127d16ff00c12b4a20d22d8d
x: ac43191cb357b72cbbcc26688ffefa9f5a1524ea5a19512bde902a3a823ca7ca
y: 21d409304f6bbc829e04793718929b0115e7daae6e6d4bc11a7fe405783a942e
compressed: 03ac43191cb357b72cbbcc26688ffefa9f5a1524ea5a19512bde902a3a823ca7ca
Brick o' code:
AutoSeededRandomPool prng;
ECDSA<ECP, SHA256>::PrivateKey privateKey;
ECDSA<ECP, SHA256>::PublicKey publicKey;
privateKey.Initialize( prng, CryptoPP::ASN1::secp256r1());
bool result = privateKey.Validate( prng, 3 );
cout << "valid: " << result << endl << endl;
const Integer& x1 = privateKey.GetPrivateExponent();
cout << "priv: " << std::hex << x1 << endl;
privateKey.MakePublicKey(publicKey);
result = publicKey.Validate( prng, 3 );
cout << "valid: " << result << endl << endl;
Integer qx = publicKey.GetPublicElement().x;
Integer qy = publicKey.GetPublicElement().y;
cout << "pub x: " << std::hex << qx << endl;
cout << "pub y: " << std::hex << qy << endl;
What've I done wrong?