Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RLPx p2p crypto layer (work in progress, do not merge) #271

Closed
wants to merge 28 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
e82d0aa
initial hook for crypto handshake (void, off by default)
zelig Jan 18, 2015
a325b45
add privkey to clientIdentity + tests
zelig Jan 18, 2015
ac4e71f
fix protocol to accomodate privkey
zelig Jan 18, 2015
b8f0620
add crypto auth logic to p2p
zelig Jan 18, 2015
e2e0849
rewrite to comply with latest spec
zelig Jan 18, 2015
248ab71
fix crash
zelig Jan 19, 2015
605ee4d
handshake test to crypto
zelig Jan 19, 2015
a314bbf
handshake test to crypto
zelig Jan 19, 2015
b5734f3
completed the test. FAIL now. it crashes at diffie-hellman. ECIES -> …
zelig Jan 19, 2015
6ed5a1f
Merge remote-tracking branch 'upstream/develop' into p2p.crypto
zelig Jan 19, 2015
44779d8
integrate cryptoId into peer and connection lifecycle
zelig Jan 19, 2015
a8b3c03
first stab at integrating crypto in our p2p
zelig Jan 19, 2015
6bb203d
add minor comments to the test
zelig Jan 20, 2015
20ac187
add equality check for nonce and remote nonce
zelig Jan 20, 2015
2d4f598
important fix for peer pubkey. when taken from identity, chop first f…
zelig Jan 20, 2015
0433cae
changes that fix it all:
zelig Jan 20, 2015
8f938c7
add code documentation
zelig Jan 21, 2015
012d9e1
add initial peer level test (failing)
zelig Jan 21, 2015
1dda555
chop first byte when cryptoid.PubKeyS is set from identity.Pubkey() s…
zelig Jan 21, 2015
92bd253
peer-level integration test for crypto handshake
zelig Jan 21, 2015
c5001a4
add temporary forced session token generation
zelig Jan 21, 2015
777528d
Merge remote-tracking branch 'upstream/develop' into p2p.crypto2
zelig Jan 26, 2015
1226440
apply handshake related improvements from p2p.crypto branch
zelig Jan 26, 2015
2cd375c
make crypto handshake calls package level, store privateKey on peer +…
zelig Jan 26, 2015
295b59c
get rid of Private Key in ClientIdentity
zelig Jan 26, 2015
93699ac
Merge remote-tracking branch 'upstream/develop' into p2p.crypto2
zelig Jan 29, 2015
154fcbf
fix clientidentity test after privkey removed
zelig Jan 29, 2015
55ea1a7
key generation abstracted out, for testing with deterministic keys
zelig Jan 29, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion p2p/client_identity.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ type SimpleClientIdentity struct {
customIdentifier string
os string
implementation string
privkey []byte
pubkey []byte
}

Expand Down Expand Up @@ -50,8 +51,12 @@ func (c *SimpleClientIdentity) String() string {
c.implementation)
}

func (c *SimpleClientIdentity) Privkey() []byte {
return c.privkey
}

func (c *SimpleClientIdentity) Pubkey() []byte {
return []byte(c.pubkey)
return c.pubkey
}

func (c *SimpleClientIdentity) SetCustomIdentifier(customIdentifier string) {
Expand Down
5 changes: 5 additions & 0 deletions p2p/client_identity_test.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
package p2p

import (
"bytes"
"fmt"
"runtime"
"testing"
)

func TestClientIdentity(t *testing.T) {
clientIdentity := NewSimpleClientIdentity("Ethereum(G)", "0.5.16", "test", []byte("pubkey"))
key := clientIdentity.Pubkey()
if !bytes.Equal(key, []byte("pubkey")) {
t.Errorf("Expected Pubkey to be %x, got %x", key, []byte("pubkey"))
}
clientString := clientIdentity.String()
expected := fmt.Sprintf("Ethereum(G)/v0.5.16/test/%s/%s", runtime.GOOS, runtime.Version())
if clientString != expected {
Expand Down
Loading