libp2p / libp2p/rust-libp2p

Signature verification fails on handshake if 1024 bit RSA key is used

Open
#5,304 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
5.6k
Forks
1.3k
Avg merge
8h 47m
Merged PRs (30d)
19

Description

Summary

I am trying to connects to existing js-libp2p nodes using rust-libp2p, but signature verification fails on handshake, as these nodes have 1024 bit keys, and the current rust-libp2p implementation only allows 2048 or more.
While I agree on enforcing stricter security policies to prevent users from inadvertently using weaker cryptographic standards on identity creation, shouldn't the nodes be able to verify signatures of 1024 bit RSA keys ?

Expected behavior

Signature verification during handshake not to fail.

Actual behavior

Signature verification during handshake fails.

Relevant log output
IncomingConnectionError { connection_id: ConnectionId(1), local_addr: "/ip4/127.0.0.1/tcp/49618", send_back_addr: "/ip4/127.0.0.1/tcp/49625", error: Transport(Other(Custom { kind: Other, error: Other(Left(Right(Apply(BadSignature)))) })) }
Possible Solution

Update this line to use RSA_PKCS1_1024_8192_SHA256_FOR_LEGACY_USE_ONLY instead of RSA_PKCS1_2048_8192_SHA256.

Version

0.54.0

Would you like to work on fixing this bug ?

Yes

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at identity/src/rsa.rs around line 90, where the RSA signature verification policy is selected, and reproduce the handshake failure described in the log. Done means signatures from existing 1024-bit RSA keys verify during handshakes while stricter key-creation policies remain unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cryptography, networking
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.