Skip to content

viboognesh/rust-zkp-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

Features

  • 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.

How it Works

The authentication process is based on the Chaum-Pedersen protocol and involves the following steps:

  1. Registration:

    • The client provides a username and password.
    • The client computes y1 and y2 values based on the password and sends them to the server along with the username.
    • The server stores this information for the user.
  2. Authentication Challenge:

    • The client sends its username to the server to initiate authentication.
    • The server generates a random challenge c and an auth_id and sends them back to the client.
  3. Authentication Verification:

    • The client uses its password and the received challenge to compute a solution s.
    • The client sends the auth_id and the solution s to 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.

Project Structure

  • 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.

Getting Started

Prerequisites

  • Rust
  • Protocol Buffer Compiler (protoc)

Building and Running

  1. Clone the repository:

    git clone https://github.com/viboognesh/rust-zkp-server.git
    cd rust-zkp-server
  2. Build the project:

    cargo build --release
  3. Run the server:

    cargo run --bin server
  4. Run the client in a separate terminal:

    cargo run --bin client

Using Docker

Alternatively, you can use Docker and Docker Compose to build and run the project:

docker-compose up

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published