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

381 wire authentication #402

Merged

Conversation

NhoxxKienn
Copy link
Contributor

Description

This PR serves to fix the #381 issue of Wire Authentication.

TLS Connection

Location: wire/net/simple

Issue: currently using TCP without TLS for communication.

Solution: Implement a simple mutual TLS Dialer and TLS Listener in the simple package, the default net wire for go-perun.

Bonus: A simple connection test has also been set up with self-signed Certificates in dialer_internal_test.go

Wire identity authentication

Location: wire/address.go, wire/account.go, and wire/net/exchange_addr.go, wire.proto

Issue: While each message currently contains a sender and recipient wire address in its Envelope, those are not yet authenticated; there is no signature in the wire.proto. This means anyone can send a message coming from SENDER, without needing the private key, thus allowing to spoof any wire identity.

Solution: Add Signing and Verifying for Account and Address. Like Wallet, the Account is expected to hold the private key, and the Address serves as the Public Key. Wire Authentication can be achieved by including a signature signed by the account in the AuthResponseMsg. Recipient can check the validity of this signature using the Sender Address (Public Key) to decrypt the signature.

Wire Authentication Implementation

Location: backend/sim/wire and wire/net/simple

Description: A simple implementation for the integration of key-pair to be used for wire authentication has been implemented in the testing and default wire.

For backend/sim/wire: This simple signing and verification of signature, independent from the given message.

For wire/net/simple: RSA-2048 Random-generated Key-Pair for (Account, Address), Signing of a given message by hashing and encrypting. Signature length: 256 Bits.

An address exchange test has also been added to the package to test the authentication function.

Visualization

NhoxxKienn and others added 7 commits February 16, 2024 12:44
Signed-off-by: Minh Huy Tran <[email protected]>
…ple, update interface of wire.Account/Address to allow signing/verification

Signed-off-by: Minh Huy Tran <[email protected]>
Signed-off-by: Minh Huy Tran <[email protected]>
Signed-off-by: Minh Huy Tran <[email protected]>
Copy link
Contributor

@DragonDev1906 DragonDev1906 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't fully get why we need a separate field for the signature size, which is already in the byte slice and is encoded in protobuf. We can do it that way, I just don't see why we need/want an extra field.

wallet/test/address.go Outdated Show resolved Hide resolved
wire/account.go Outdated Show resolved Hide resolved
wire/account.go Outdated Show resolved Hide resolved
wire/cache_internal_test.go Outdated Show resolved Hide resolved
wire/net/exchange_addr.go Outdated Show resolved Hide resolved
wire/net/exchange_addr.go Outdated Show resolved Hide resolved
wire/net/exchange_addr.go Outdated Show resolved Hide resolved
wire/net/simple/account.go Show resolved Hide resolved
wire/net/simple/address.go Show resolved Hide resolved
wire/net/simple/address.go Show resolved Hide resolved
@NhoxxKienn NhoxxKienn merged commit 61ed2dc into hyperledger-labs:main Mar 11, 2024
6 checks passed
@NhoxxKienn NhoxxKienn deleted the 381_wire_authentication branch March 11, 2024 09:26
@NhoxxKienn NhoxxKienn restored the 381_wire_authentication branch April 16, 2024 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants