Hello,
In my application i generate an ECIES private/public key pair. Then i use 
the private exponent and the public key point to initialize an ECDSA key 
pair. Do i need to run validate() on the ECDSA key pair if i already 
validated the ECIES key pair? Sample code is below.
Regards,

Stefan

-----------------------------------------------------------
#define _DOUT_ std::cout << __FILE__ << ":" << __LINE__ << " "

    CryptoPP::ECIES<CryptoPP::ECP>::PrivateKey privKey;
    CryptoPP::ECIES<CryptoPP::ECP>::PublicKey pubKey;
    CryptoPP::AutoSeededRandomPool rng;

    privKey.Initialize(rng, CryptoPP::ASN1::secp521r1());
    privKey.MakePublicKey(pubKey);

    if (!privKey.Validate(rng, 3)) {
      _DOUT_ << "Detected Problem with private key." << std::endl;
    } else {
      _DOUT_ << "Private key is ok!" << std::endl;
    }

    if (!pubKey.Validate(rng, 3)) {
      _DOUT_ << "Detected Problem with public key." << std::endl;
    } else {
      _DOUT_ << "Public key is ok!" << std::endl;
    }

    _DOUT_ << "Creating signing and checking key" << std::endl;
    CryptoPP::ECDSA<CryptoPP::ECP, CryptoPP::SHA256>::PrivateKey signingKey;
    CryptoPP::ECDSA<CryptoPP::ECP, CryptoPP::SHA256>::PublicKey checkKey;
    
    const CryptoPP::Integer &x = privKey.GetPrivateExponent();
    signingKey.Initialize(CryptoPP::ASN1::secp521r1(), x);
    
    signingKey.ThrowIfInvalid(rng, 3);  // <- do i need this?
    
    const CryptoPP::ECP::Point &p = pubKey.GetPublicElement();
    checkKey.Initialize(CryptoPP::ASN1::secp521r1(), p);
    
    checkKey.ThrowIfInvalid(rng, 3); // <- and this?
-----------------------------------------------------------

-- 
-- 
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