Hi there,

I'm trying to retrieve a public key, given x and y with the following code:

//x and y came from a webservice
std::string x = 
std::string y = 
std::string pt = x + y;
CryptoPP::HexDecoder decoder;
decoder.Put((byte*)pt.data(), pt.size());

CryptoPP::ECP::Point q;
size_t len = decoder.MaxRetrievable();

q.identity = false;
q.x.Decode(decoder, len / 2);
q.y.Decode(decoder, len / 2);            //Wrong value
    CryptoPP::ECDSA<CryptoPP::ECP, CryptoPP::SHA256>::PublicKey publicKey;
    publicKey.Initialize(CryptoPP::ASN1::brainpoolP256r1(), q);

After Initializing the public key, I try to validate it:

CryptoPP::ECDSA<CryptoPP::ECP, CryptoPP::SHA256>::Verifier 

    CryptoPP::AutoSeededRandomPool prng;
    bool result = publicKey.Validate(prng, 3);

result is always false and I tried to get the int-values of x and y with 
the following:

const CryptoPP::ECP::Point& qq = publicKey.GetPublicElement();
    std::ostringstream cou;
    cou << "Q.x: " <<  qq.x;
    cou << "Q.y: " <<  qq.y;

While x seems to be okay, y is not. And I don't know what to do... Is there 
anybody with a similar problem and a possible solution?

Best regards

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 cryptopp-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 

Reply via email to