From 773337596bbb7e77f6fff9bee7b14ec6db3dc69e Mon Sep 17 00:00:00 2001 From: subtly Date: Fri, 13 Feb 2015 02:57:26 -0500 Subject: [PATCH] ack handshake for new node and encrypt both sides --- crypto.cpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/crypto.cpp b/crypto.cpp index b63bdf596..ed35c3408 100644 --- a/crypto.cpp +++ b/crypto.cpp @@ -347,10 +347,25 @@ BOOST_AUTO_TEST_CASE(handshakeNew) nonceA.ref().copyTo(nonce); auth[auth.size() - 1] = 0x0; } + bytes authcipher; + encrypt(nodeB.pub(), &auth, authcipher); + cnote << "initAuth:" << toHex(authcipher); - cnote << "initAuth:" << toHex(auth); - -// bytes ack(h256::size * 2 + 1); + ECDHE eB; + bytes nBbytes(fromHex("0xBBBB")); + h256 nonceB(sha3(nAbytes)); + bytes ack(h256::size * 2 + 1); + { + bytesConstRef epubk(&auth[0], Secret::size); + bytesConstRef nonce(&auth[Secret::size], h256::size); + + eB.pubkey().ref().copyTo(epubk); + nonceB.ref().copyTo(nonce); + auth[auth.size() - 1] = 0x0; + } + bytes ackcipher; + encrypt(nodeA.pub(), &ack, ackcipher); + cnote << "ackAuth:" << toHex(ackcipher); } BOOST_AUTO_TEST_CASE(ecdhe_aes128_ctr_sha3mac)