diff options
author | subtly <subtly@users.noreply.github.com> | 2015-02-13 15:57:26 +0800 |
---|---|---|
committer | subtly <subtly@users.noreply.github.com> | 2015-02-13 15:57:26 +0800 |
commit | 773337596bbb7e77f6fff9bee7b14ec6db3dc69e (patch) | |
tree | 706b016d004a73b4f459cafd764da24e718cb768 /crypto.cpp | |
parent | 5f5bca7632cee1d810bdc086ca7391fc06c7d892 (diff) | |
download | dexon-solidity-773337596bbb7e77f6fff9bee7b14ec6db3dc69e.tar dexon-solidity-773337596bbb7e77f6fff9bee7b14ec6db3dc69e.tar.gz dexon-solidity-773337596bbb7e77f6fff9bee7b14ec6db3dc69e.tar.bz2 dexon-solidity-773337596bbb7e77f6fff9bee7b14ec6db3dc69e.tar.lz dexon-solidity-773337596bbb7e77f6fff9bee7b14ec6db3dc69e.tar.xz dexon-solidity-773337596bbb7e77f6fff9bee7b14ec6db3dc69e.tar.zst dexon-solidity-773337596bbb7e77f6fff9bee7b14ec6db3dc69e.zip |
ack handshake for new node and encrypt both sides
Diffstat (limited to 'crypto.cpp')
-rw-r--r-- | crypto.cpp | 23 |
1 files changed, 19 insertions, 4 deletions
@@ -347,10 +347,25 @@ BOOST_AUTO_TEST_CASE(handshakeNew) nonceA.ref().copyTo(nonce); auth[auth.size() - 1] = 0x0; } - - cnote << "initAuth:" << toHex(auth); - -// bytes ack(h256::size * 2 + 1); + bytes authcipher; + encrypt(nodeB.pub(), &auth, authcipher); + cnote << "initAuth:" << toHex(authcipher); + + 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) |