# vien2024/nt219-project architecture

> Architecture diagram of the GitHub repository vien2024/nt219-project, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vien2024/nt219-project
- Repository: https://github.com/vien2024/nt219-project

## Overview

##### Project type and purpose
- This is a command-line cryptanalysis toolkit for RSA‐based algorithms.
- It bundles scripts and modules implementing factorization attacks (Pollard’s Rho, Quadratic Sieve, Fermat’s method), low‐exponent and broadcast attacks (Håstad, Wiener, small-d), Coppersmith‐style attacks (Boneh–Durfee), and even quantum-oriented algorithms (Shor’s).
- It also includes an RSA key generator based on Crypto++ for producing test keys.

##### File structure
- Top-level directories each encapsulate one attack or utility:
– Pollard_Rho/
– Quadratic_sieve/
– fermat_factorization/
– chinese_remainder_theorem/
– hastad’s_broadcast/
– small_d_attack/
– wiener_attack/
– boneh_durfee/
– Shor’s_algorithm/
– RSAKeyGen/
- RSAKeyGen/ contains a C++ implementation linking against Crypto++ (include/, lib/) to produce RSA key pairs and PEM files.
- Other directories are pure Python (and .sage) scripts for analysis, with sample inputs/outputs.
- README.md outlines the VPN+TLS scenario and motivates evaluating the security of the RSA setup by running these attacks.

##### README for additional insights
- The architecture section is blank—so we need to infer how these pieces fit.
- Intended use: a security analyst runs the RSAKeyGen module to create keys, then feeds public keys or ciphertext into one or more attack modules to test vulnerability.

##### Elements
- Clear labels: “RSAKeyGen (C++/Crypto++)”, “Pollard_Rho (Python)”, etc.
– from Orchestrator to KeyGen, Attack Modules;
– from Attack Modules to Data Store;
– C++ modules in blue, Python modules in green, Sage modules in orange.
– Data Store in grey, Orchestrator in purple, External Dependencies as hexagons.

##### Detailed capturing of essential elements
- Attack directory as an individual component.
- That RSAKeyGen produces both public and private keys.
- That the Orchestrator can selectively invoke attacks in parallel or sequence.

## Diagram (Mermaid)

```mermaid
flowchart TD
    User["User"]:::external
    subgraph "Orchestrator"
        Orchestrator["CLI Orchestrator"]:::orchestrator
    end

    subgraph "Key Generation Service"
        RSAKeyGen["RSAKeyGen (C++/Crypto++)"]:::cpp
    end

    subgraph "Attack Modules"
        PR["Pollard_Rho (Python)"]:::python
        QS["Quadratic_Sieve (Python)"]:::python
        FM["Fermat_Factorization (Python)"]:::python
        CRT["Chinese_Remainder_Theorem (Python)"]:::python
        HB["Hastad_Broadcast (Python)"]:::python
        SD["Small_d_Attack (Python)"]:::python
        WI["Wiener_Attack (Python/Sage)"]:::sage
        BD["Boneh_Durfee (Sage)"]:::sage
        SH["Shor_Algorithm (Jupyter/Python)"]:::jupyter
    end

    DataStore["File System Data Store"]:::store

    subgraph "External Dependencies"
        Py["Python 3"]:::ext
        Sage["SageMath"]:::ext
        CryptoPP["Crypto++"]:::ext
    end

    User -->|"runs"| Orchestrator
    Orchestrator -->|"invokes"| RSAKeyGen
    Orchestrator -->|"invokes"| PR
    Orchestrator -->|"invokes"| QS
    Orchestrator -->|"invokes"| FM
    Orchestrator -->|"invokes"| CRT
    Orchestrator -->|"invokes"| HB
    Orchestrator -->|"invokes"| SD
    Orchestrator -->|"invokes"| WI
    Orchestrator -->|"invokes"| BD
    Orchestrator -->|"invokes"| SH

    RSAKeyGen -->|"writes keys"| DataStore
    PR -->|"reads/writes data"| DataStore
    QS -->|"reads/writes data"| DataStore
    FM -->|"reads/writes data"| DataStore
    CRT -->|"reads/writes data"| DataStore
    HB -->|"reads/writes data"| DataStore
    SD -->|"reads/writes data"| DataStore
    WI -->|"reads/writes data"| DataStore
    BD -->|"reads/writes data"| DataStore
    SH -->|"reads/writes data"| DataStore

    CryptoPP -->|"linked by"| RSAKeyGen
    Py -->|"runtime for"| Orchestrator
    Py -->|"runtime for"| PR
    Py -->|"runtime for"| QS
    Py -->|"runtime for"| FM
    Py -->|"runtime for"| CRT
    Py -->|"runtime for"| HB
    Py -->|"runtime for"| SD
    Sage -->|"runtime for"| WI
    Sage -->|"runtime for"| BD
    Sage -->|"runtime for"| SH

    click RSAKeyGen "https://github.com/vien2024/nt219-project/blob/main/RSAKeyGen/rsa-key-gen.exe"
    click RSAKeyGen "https://github.com/vien2024/nt219-project/blob/main/RSAKeyGen/rsa-key-gen.cpp"
    click RSAKeyGen "https://github.com/vien2024/nt219-project/tree/main/RSAKeyGen/include/"
    click RSAKeyGen "https://github.com/vien2024/nt219-project/blob/main/RSAKeyGen/lib/libcryptopp.a"
    click PR "https://github.com/vien2024/nt219-project/blob/main/Pollard_Rho/Pollard_Rho.py"
    click PR "https://github.com/vien2024/nt219-project/blob/main/Pollard_Rho/genkey.py"
    click QS "https://github.com/vien2024/nt219-project/blob/main/Quadratic_sieve/quadratic_sieve.py"
    click QS "https://github.com/vien2024/nt219-project/blob/main/Quadratic_sieve/basicRSA.py"
    click FM "https://github.com/vien2024/nt219-project/blob/main/fermat_factorization/fermat.py"
    click FM "https://github.com/vien2024/nt219-project/blob/main/fermat_factorization/task.py"
    click CRT "https://github.com/vien2024/nt219-project/blob/main/chinese_remainder_theorem/chinese_remainder_theorem.py"
    click HB "https://github.com/vien2024/nt219-project/blob/main/hastad's_broadcast/hastad_broadcast.py"
    click HB "https://github.com/vien2024/nt219-project/blob/main/hastad's_broadcast/generate.py"
    click SD "https://github.com/vien2024/nt219-project/blob/main/small_d_attack/small_d_attack.py"
    click SD "https://github.com/vien2024/nt219-project/blob/main/small_d_attack/generate.py"
    click WI "https://github.com/vien2024/nt219-project/blob/main/wiener_attack/wiener.py"
    click WI "https://github.com/vien2024/nt219-project/blob/main/wiener_attack/wiener.sage"
    click WI "https://github.com/vien2024/nt219-project/blob/main/wiener_attack/wiener.sage.py"
    click BD "https://github.com/vien2024/nt219-project/blob/main/boneh_durfee/boneh.sage"
    click BD "https://github.com/vien2024/nt219-project/blob/main/boneh_durfee/boneh.sage.py"
    click SH "https://github.com/vien2024/nt219-project/blob/main/Shor's_algorithm/shor.ipynb"

    classDef orchestrator fill:#D8BFD8,stroke:#000;
    classDef cpp fill:#ADD8E6,stroke:#000;
    classDef python fill:#90EE90,stroke:#000;
    classDef sage fill:#FFA500,stroke:#000;
    classDef jupyter fill:#DDA0DD,stroke:#000;
    classDef store fill:#D3D3D3,stroke:#000;
    classDef ext fill:#FFE4B5,stroke:#000;
    classDef external fill:#FFFFFF,stroke:#000;
```
