I do not find any function to load the public key. I've tried to use 
BERDecode on DH 
Domain http://www.cryptopp.com/docs/ref/class_d_h___domain.html but without 
success. I've tried too declaring a CryptoPP::ECIES< CryptoPP::ECP 
>::PublicKey and using .Load, but nothing. I've managed to pass from 
SecByteBlock to Byte but now i would need to load a public key in .der 
format on this.

Here's is the code I have at the moment.

int main( int, char** ) {

    OID CURVE = secp256k1();
    AutoSeededX917RNG<AES> rng;

    /* A */
    ECDH < ECP >::Domain dhA( CURVE );

    byte privA[dhA.PrivateKeyLength()];
    byte pubA[dhA.PublicKeyLength()];

    dhA.GenerateKeyPair(rng, privA, pubA);

    byte sharedA[dhA.AgreedValueLength()];    

    /* B */
    ECDH < ECP >::Domain dhB( CURVE );

    byte privB[dhB.PrivateKeyLength()];
    byte pubB[dhB.PublicKeyLength()];

    dhB.GenerateKeyPair(rng, privB, pubB);

    byte sharedB[dhB.AgreedValueLength()];    

    /* AGREEMENT */
    dhA.Agree (sharedA, privA, pubB);
    dhB.Agree (sharedB, privB, pubA);

    if ((dhA.AgreedValueLength() != dhB.AgreedValueLength()) || (memcmp 
(sharedB, sharedA, dhA.AgreedValueLength()) != 0)) {
        cout << "Something wrong" << endl;
    }
    else {
        cout << "Agreed to shared secret" << endl;
    }

    return 0;
}

-- 
-- 
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/d/optout.

Reply via email to