aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsubtly <subtly@users.noreply.github.com>2014-10-23 10:50:04 +0800
committersubtly <subtly@users.noreply.github.com>2014-10-23 10:50:04 +0800
commit19e169694c7ae60acc8eb923fe71c4a971dc32fd (patch)
treebb36da2da69a5f6454e3b672734ff9793aed892f
parent6513d4312962f7d99d52572f02b5ff4277272496 (diff)
downloaddexon-solidity-19e169694c7ae60acc8eb923fe71c4a971dc32fd.tar.gz
dexon-solidity-19e169694c7ae60acc8eb923fe71c4a971dc32fd.tar.zst
dexon-solidity-19e169694c7ae60acc8eb923fe71c4a971dc32fd.zip
fix public import/export
-rw-r--r--crypto.cpp18
1 files changed, 7 insertions, 11 deletions
diff --git a/crypto.cpp b/crypto.cpp
index a9b9904c..bb8db2b6 100644
--- a/crypto.cpp
+++ b/crypto.cpp
@@ -51,15 +51,10 @@ BOOST_AUTO_TEST_CASE(cryptopp_public_export_import)
Public p;
pp::exportDL_PublicKey_EC(e.GetKey(), p);
- Integer x(&p[0], 32);
- Integer y(&p[32], 32);
-
+
DL_PublicKey_EC<ECP> pub;
- pub.Initialize(pp::secp256k1(), ECP::Point(x,y));
- assert(pub == e.GetKey());
-
- DL_PublicKey_EC<ECP> pub2;
- pub.Initialize(pp::secp256k1(), ECP::Point(x,y));
+ pub.Initialize(pp::secp256k1(), pp::PointFromPublic(p));
+ assert(pub.GetPublicElement() == e.GetKey().GetPublicElement());
}
BOOST_AUTO_TEST_CASE(ecies_eckeypair)
@@ -78,9 +73,10 @@ BOOST_AUTO_TEST_CASE(ecies_eckeypair)
// Fix Me!
// encrypt(k.publicKey(), b);
-// assert(b != asBytes(original));
-// bytes plain = k.decrypt(&b);
-// assert(plain == asBytes(original));
+ k.encrypt(b);
+ assert(b != asBytes(original));
+ k.decrypt(b);
+ assert(b == asBytes(original));
}
BOOST_AUTO_TEST_CASE(ecdhe_aes128_ctr_sha3mac)