fix public import/export

This commit is contained in:
subtly 2014-10-23 04:50:04 +02:00
parent 6513d43129
commit 19e169694c

View File

@ -51,15 +51,10 @@ BOOST_AUTO_TEST_CASE(cryptopp_public_export_import)
Public p; Public p;
pp::exportDL_PublicKey_EC(e.GetKey(), p); pp::exportDL_PublicKey_EC(e.GetKey(), p);
Integer x(&p[0], 32);
Integer y(&p[32], 32);
DL_PublicKey_EC<ECP> pub; DL_PublicKey_EC<ECP> pub;
pub.Initialize(pp::secp256k1(), ECP::Point(x,y)); pub.Initialize(pp::secp256k1(), pp::PointFromPublic(p));
assert(pub == e.GetKey()); assert(pub.GetPublicElement() == e.GetKey().GetPublicElement());
DL_PublicKey_EC<ECP> pub2;
pub.Initialize(pp::secp256k1(), ECP::Point(x,y));
} }
BOOST_AUTO_TEST_CASE(ecies_eckeypair) BOOST_AUTO_TEST_CASE(ecies_eckeypair)
@ -78,9 +73,10 @@ BOOST_AUTO_TEST_CASE(ecies_eckeypair)
// Fix Me! // Fix Me!
// encrypt(k.publicKey(), b); // encrypt(k.publicKey(), b);
// assert(b != asBytes(original)); k.encrypt(b);
// bytes plain = k.decrypt(&b); assert(b != asBytes(original));
// assert(plain == asBytes(original)); k.decrypt(b);
assert(b == asBytes(original));
} }
BOOST_AUTO_TEST_CASE(ecdhe_aes128_ctr_sha3mac) BOOST_AUTO_TEST_CASE(ecdhe_aes128_ctr_sha3mac)