Commit Graph

13 Commits

Author SHA1 Message Date
Felix Lange 5bdc115943 p2p: integrate p2p/discover
Overview of changes:

- ClientIdentity has been removed, use discover.NodeID
- Server now requires a private key to be set (instead of public key)
- Server performs the encryption handshake before launching Peer
- Dial logic takes peers from discover table
- Encryption handshake code has been cleaned up a bit
- baseProtocol is gone because we don't exchange peers anymore
- Some parts of baseProtocol have moved into Peer instead
2015-02-06 00:00:36 +01:00
zelig 2e48d39fc7 key generation abstracted out, for testing with deterministic keys 2015-02-06 00:00:36 +01:00
zelig 68205dec9f make crypto handshake calls package level, store privateKey on peer + tests ok 2015-02-06 00:00:36 +01:00
zelig 4499743522 apply handshake related improvements from p2p.crypto branch 2015-02-06 00:00:35 +01:00
zelig faa069a126 peer-level integration test for crypto handshake
- add const length params for handshake messages
- add length check to fail early
- add debug logs to help interop testing (!ABSOLUTELY SHOULD BE DELETED LATER)
- wrap connection read/writes in error check
- add cryptoReady channel in peer to signal when secure session setup is finished
- wait for cryptoReady or timeout in TestPeersHandshake
2015-02-06 00:00:35 +01:00
zelig 1f2adb05b5 add initial peer level test (failing) 2015-02-06 00:00:35 +01:00
zelig 364b783281 changes that fix it all:
- set proper public key serialisation length in pubLen = 64
- reset all sizes and offsets
- rename from DER to S (we are not using DER encoding)
- add remoteInitRandomPubKey as return value to respondToHandshake
- add ImportPublicKey with error return to read both EC golang.elliptic style 65 byte encoding and 64 byte one
- add ExportPublicKey falling back to go-ethereum/crypto.FromECDSAPub() chopping off the first byte
- add Import - Export tests
- all tests pass
2015-02-06 00:00:35 +01:00
zelig 923504ce3d add equality check for nonce and remote nonce 2015-02-06 00:00:35 +01:00
zelig 2e868566d7 add minor comments to the test 2015-02-06 00:00:35 +01:00
zelig e252c634cb first stab at integrating crypto in our p2p
- abstract the entire handshake logic in cryptoId.Run() taking session-relevant parameters
- changes in peer to accomodate how the encryption layer would be switched on
- modify arguments of handshake components
- fixed test getting the wrong pubkey but it till crashes on DH in newSession()
2015-02-06 00:00:35 +01:00
zelig 489d956283 completed the test. FAIL now. it crashes at diffie-hellman. ECIES -> secp256k1-go panics 2015-02-06 00:00:35 +01:00
zelig 076c382a74 handshake test to crypto 2015-02-06 00:00:35 +01:00
zelig 3b6385b146 handshake test to crypto 2015-02-06 00:00:34 +01:00