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?

-- 
-- 
You received this message because you are subscribed to the "Crypto++ Users" 
Google Group.
To unsubscribe, send an email to [email protected].
More information about Crypto++ and this group is available at 
http://www.cryptopp.com.
--- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to