Help save net neutrality! Learn more.
Close

#42 Crash in ECIES when trying to Generate Private Key

closed
nobody
None
5
2012-12-22
2012-12-22
Anonymous
No

ECIES<ECP> can generate a key with:

ECIES<ECP>::Decryptor decryptor(prng, ASN1::secp256r1());

Trying to generate a key outside of construction leads to a crash due to "Not Implemented" exception:

ECIES<ECP>::Decryptor decryptor;
decryptor.AccessKey().AccessGroupParameters().Initialize(ASN1::secp256r1());
decryptor.AccessKey().GenerateRandom(prng, g_nullNameValuePairs);

Though GenerateRandom() is being called on a DL_PrivateKeyImpl<...>, the call is being routed into DL_GroupParameters_EC<...>. Crypto++ does not implemnt curve generation and its throwing a NotImplemented exception.

The attached file duplicates the problem.

Discussion

  • Comment has been marked as spam. 
    Undo

    You can see all pending comments posted by this user  here

    Anonymous - 2012-12-22

    Test duplicating errant behavior

     
  • Comment has been marked as spam. 
    Undo

    You can see all pending comments posted by this user  here

    Anonymous - 2012-12-22

    For those who want two step construction and initialization, here are two examples that can be used:

    // Do this if desired or required
    ECIES<ECP>::Decryptor decryptor;
    decryptor.AccessKey().AccessGroupParameters().Initialize(prng, ASN1::secp256r1());

    // Do this instead if desired or required
    ECIES<ECP>::Decryptor decryptor;
    decryptor.AccessKey().AccessGroupParameters().Initialize(ASN1::secp256r1());

    Integer x(prng, Integer::One(), decryptor.AccessKey().GetGroupParameters().GetSubgroupOrder()-1);
    decryptor.AccessKey().SetPrivateExponent(x);

     
  • Comment has been marked as spam. 
    Undo

    You can see all pending comments posted by this user  here

    Anonymous - 2012-12-22
    • status: open --> closed
     
    Last edit: Anonymous 2013-11-04