This project implements a client-server authentication system using Zero-Knowledge Proof (ZKP). It allows users to register and authenticate with a server without revealing their passwords.
- Zero-Knowledge Proof Authentication: Users can authenticate with the server without sending their passwords over the network.
- gRPC Communication: The client and server communicate using gRPC, with protocol buffers defining the service and message formats.
- Rust Implementation: The entire project is written in Rust, ensuring performance and safety.
The authentication process is based on the Chaum-Pedersen protocol and involves the following steps:
-
Registration:
- The client provides a username and password.
- The client computes
y1andy2values based on the password and sends them to the server along with the username. - The server stores this information for the user.
-
Authentication Challenge:
- The client sends its username to the server to initiate authentication.
- The server generates a random challenge
cand anauth_idand sends them back to the client.
-
Authentication Verification:
- The client uses its password and the received challenge to compute a solution
s. - The client sends the
auth_idand the solutionsto the server. - The server verifies the solution. If the verification is successful, the server sends a session ID back to the client, confirming successful authentication.
- The client uses its password and the received challenge to compute a solution
src/server.rs: Implements the gRPC server, handling user registration and authentication logic.src/client.rs: Implements a command-line client for interacting with the server, allowing users to register and log in.src/lib.rs: Contains the core ZKP logic, including the implementation of the Chaum-Pedersen protocol.proto/zkp_auth.proto: Defines the gRPC service and message formats using protocol buffers.build.rs: Compiles the protocol buffer definitions into Rust code.Cargo.toml: The package manifest for the Rust project, defining dependencies and project structure.Dockerfile: A Dockerfile is provided for building and running the project in a containerized environment.
- Rust
- Protocol Buffer Compiler (
protoc)
-
Clone the repository:
git clone https://github.com/viboognesh/rust-zkp-server.git cd rust-zkp-server -
Build the project:
cargo build --release
-
Run the server:
cargo run --bin server
-
Run the client in a separate terminal:
cargo run --bin client
Alternatively, you can use Docker and Docker Compose to build and run the project:
docker-compose up