GuillaumeDorschner / ESILV-Cryptography-S8-2

A student project on cryptography featuring a securely authenticating users without transmitting passwords in cleartext.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

image

Project CryptoGraphie - 2

Guillaume Dorschner & Jules Deleuse

A4 - CCC

Introduction

This project is a comprehensive exploration of cryptographic principles and their application in securing user data. Through a two-part implementation focusing on password storage see her and Password-Authenticated Key Exchange (PAKE), this project demonstrates robust security practices in application development.

Project Implementation

The second part of your project involves Password-Authenticated Key Exchange (PAKE), focusing on securely authenticating users without transmitting passwords in cleartext, even without an encrypted channel. This part delves into Asymmetric PAKE, a method to store user secrets on a server without giving the server access to those secrets. It employs a cryptographic exchange allowing the server to store a "locked" secret envelope, which the user can unlock using their password and a server-known secret key. The process involves Oblivious Pseudo-Random Functions (OPRF) for secure exchanges and outlines steps for registration and login phases, emphasizing the importance of not revealing any additional information beyond whether the password matches the expected value.

Getting Started

Installation

Warning

For running the project locally in an easier-to-debug manner, follow the order below. In the future, we will use Docker-compose for project execution. Respect the following order:

  1. docker compose up
     docker compose up
    
  2. terminal 2
     flask run --host=0.0.0.0 --port=80
    
  3. terminal 1
     python -m client.main
    

Here the documentation of the EndPoint API.

What we will be using

All the code is written in Python, and we will be using the following libraries:

graph LR
    Client[Client terminal] <--> Server
    Server[Backend] --> Postgres[PostgreSQL database]
    Server --> cryptography[cryptography.io]
Loading

Diagrams and Explanations

Example of Sequence Diagram.

  1. Registration Phase
        sequenceDiagram
        participant U as User (Alice)
        participant S as Server (Bob)
    
        Note over U,S: Registration Phase
            Note over U: User chooses a password, tells its username
            U->>U: Initiate OPRF (deterministic) flow
            U->>U: Get Password (pwd) from client in OPRF exchange
            U->>+S: current state of OPRF : F (pwd, ?)
            Note over S: Generates a user specific OPRF key for the user
            S->>S: Completes OPRF using the user-specific key
            S->>-U: current state of OPRF : F (pwd, key) && server's public key (OPAQUE identity)
            U->>U: Generates the client's key pair (public U/private U) (OPAQUE identity)
            U->>U: Computes random key (rwd) from OPRF output
            U->>U: Encrypts CLIENT private Key & SERVER public key S with rwd -> encrypted envelope
            U->>+S: Sends encrypted envelope + client unencrypted public key
            S->>-S: Stores the envelope, U public key, OPRF user specific key, indexed by username
        Note over U,S: AKE phase
    
    Loading
  2. Login Phase
    sequenceDiagram
    participant U as User (Alice)
    participant S as Server (Bob)
    
    Note over U,S: Login Phase
        U->>U: Initiate OPRF (deterministic) flow
        U->>+S: Requests connection (provides username) <br> Current state of OPRF : F (pwd, ?)
        S->>S: Fetch Client related data using Username
        S->>S: Completes OPRF using the client specific key
        S->>-U: Sends back encrypted envelope <br> Current state of OPRF : F (pwd, key)
        U->>U: Decrypts envelope using OPRF result
        U->>U: If decryption fails, abort login (cause : wrong password or server spoofing)
        U->>U: Has : client secret key, server public key
    
    Note over U,S: AKE phase
    
    Loading
  3. AKE phase
    sequenceDiagram
    participant U as User (Alice)
    participant S as Server (Bob)
    
    Note over U,S: AKE Phase <br> Both sides have: their private key, the other side's pubblic key, and the shared key
        U->>+S: AKE : Inputs client's private key + server public key
        S->>-U: AKE : Inputs server's private key + client public key
        U->>U: receives fresh shared key from AKE
        S->>S: receives fresh shared key from AKE
        U->>U: Hashes shared key (K) using SHA256
        U->>U: Signs the hash with client private key
        U->>S: Sends the signed hash to server
        S->>S: Verifies the signature using Client public key
        S->>S: Verifies the hash using shared key (K)
    
    Loading

About

A student project on cryptography featuring a securely authenticating users without transmitting passwords in cleartext.

License:MIT License


Languages

Language:Python 91.7%Language:HTML 8.3%