libp2p / go-libp2p

libp2p implementation in Go
MIT License
6.03k stars 1.06k forks source link

custom signature scheme: dial attempt failed: proto: can't skip unknown wire type 6 for crypto_pb.PublicKey #330

Open helinwang opened 6 years ago

helinwang commented 6 years ago

Hi,

I wrapped a custom priv/pub signature scheme to implement the go-libp2p-crypto.PrivKey and go-libp2p-crypto.PubKey interface. But got the following error when running the chat example:

dial attempt failed: proto: can't skip unknown wire type 6 for crypto_pb.PublicKey

Is custom signature scheme currently supported?

helinwang commented 6 years ago

The default chat.go works for me.

helinwang commented 6 years ago

This two commits add support to the BLS signature scheme:

https://github.com/helinwang/go-libp2p-crypto/commit/e0b70571efc4c1424523637c01f89488c04133e0 https://github.com/helinwang/go-libp2p/commit/5025955d87a24cd0dd2aa642521ff43e7118115b

Any possibility for it gets merged? (adds a new dependency to "github.com/dfinity/go-dfinity-crypto/bls" though.)

Btw, I have not used gx before, I have published my own version of go-libp2p-crypto (hash is here: https://github.com/helinwang/go-libp2p-crypto/commit/e0b70571efc4c1424523637c01f89488c04133e0#diff-d95150d9db6fb31091770e6d6105b08dL1 ), will it be persisted on IPFS forever?

Thank you!

Stebalien commented 6 years ago

will it be persisted on IPFS forever?

Not unless someone pins it.

dial attempt failed: proto: can't skip unknown wire type 6 for crypto_pb.PublicKey

In your public and private key's Bytes() function, you'll need to wrap your serialized key in a github.com/libp2p/go-libp2p-crypto/pb.{PublicKey,PrivateKey} protobuf. Take a look at the Bytes() implementation for Ed25519 and RSA.

We'll probably want to take a close look at the BLS implementation but I'd love to include this if you make a PR.

aratz-lasa commented 2 years ago

@helinwang Any update on including BLS signature scheme in Libp2p?

helinwang commented 2 years ago

Hi @aratz-lasa I don't have plan to spend time on this. Please feel free to use the code if you are working on this.