cat << 'EOF' > readme.md
This project comprises a suite of cryptographic key generation tools that utilise the natural radioactive decay of Uranium-238 (U-238) to generate randomness. This method ensures the production of highly secure and unique keys for both AES and ECC encryption systems. The suite contains a collection of C++ and Python tools designed for end-to-end file encryption and decryption using AES and ECC (Elliptic Curve Cryptography), along with utilities for generating high-quality randomness (via Von Neumann extraction) and managing cryptographic keys. A tkinter-based Python GUI (ui.py
) is also provided to streamline common operations.
The Cryptographic Suite comprises:
-
Randomness Generation (Von Neumann extractor)
von-neumann-extractor.cpp
generates unbiased random bits from raw data from the radiation measurements.- Produces 256-bit random keys stored as text files in the
Randomness
folder.
-
ECC Generator
ECC-generator.cpp
creates ECC private/public key pairs using the secp256r1 curve.- Writes the keys to the
ECC Keys
folder.
-
AES Generator
AES-generator.cpp
derives 256-bit AES keys by XORing multiple 256-bit random files from theRandomness
folder.- Outputs keys to the
AES Keys
folder.
-
Public Key Generator
public.cpp
can take an existing ECC private key and derive its public key component.
-
Encrypt/Decrypt Utilities
encrypt.cpp
compresses, optionally renames, and encrypts files using AES (for file data) and ECC (to encrypt the AES key).decrypt.cpp
reverses the process, decrypting the AES key with ECC and then the file data with AES.
-
GUI (
ui.py
)- Python-based TkinterDnD GUI for uploading files, performing encryption/decryption, generating randomness, and toggling settings.
-
Miscellaneous
test_von_neumann_extractor.cpp
includes a Catch2 test for verifying the Von Neumann extractor logic.install.bat
(Windows batch) for installing or updating dependencies needed by the project (e.g., libraries like OpenSSL, GMP, zip).
- A C++ compiler supporting C++17 or newer.
- OpenSSL (for AES, ECC, and cryptographic primitives).
- libzip (for creating and reading zip archives).
- GMP
- Catch2 (if you want to compile and run the test file,
test_von_neumann_extractor.cpp
).
- Python 3.7+
- TkinterDnD2 (for drag-and-drop file handling).
- Tkinter (GUI).
- Possibly other packages depending on your system environment.
install.bat
can help install or update libraries. Adjust its contents as needed for your environment. (Windows only)
-
Install necessary libraries:
- On Windows, run:
install.bat
- On Windows, run:
-
Compile (optional, run the .exe files instead):
- For each C++ file, you must link against OpenSSL, GMP, and libzip. Example (Windows):
Adjust library include/link paths as necessary.
g++ -std=c++17 AES-generator.cpp -lgmp -lssl -lcrypto -lzip -o AES-generator g++ -std=c++17 ECC-generator.cpp -lgmp -lssl -lcrypto -o ECC-generator g++ -std=c++17 encrypt.cpp -lssl -lcrypto -lzip -o encryptor g++ -std=c++17 decrypt.cpp -lssl -lcrypto -lzip -o decryptor g++ -std=c++17 von-neumann-extractor.cpp -lgmp -o von-neumann-extractor g++ -std=c++17 public.cpp -lssl -lcrypto -o public g++ -std=c++17 test_von_neumann_extractor.cpp -I<catch2-include> -o test_runner
- For each C++ file, you must link against OpenSSL, GMP, and libzip. Example (Windows):
-
Run (without GUI):
von-neumann-extractor.exe
: Takes your raw data fromRadiation Data/...
and outputs multiple 256-bit files inRandomness
.ECC-generator.exe
: Consumes random files fromRandomness
to generate ECC keypairs inECC Keys
.public.exe
: Derives ECC public key from an existing private key.AES-generator.exe
: Consumes random files to generate a 256-bit AES key inAES Keys
.encryptor.exe
: Encrypts files fromImport
(and outputs toExport
).decryptor.exe
: Decrypts fromExport
(and outputs toDecrypted
).
-
Testing (optional):
test_von_neumann_extractor.exe
: Runs the Catch2 test for Von Neumann extraction.
- Ensure Python 3 is installed, plus the required tkinter-based libraries:
pip install tkinterdnd2
- Launch the GUI by running the
ui.py
script.- Use the drag-and-drop interface to upload CSV or Excel files into the “Generate Randomness” panel.
- Use the menu options to generate randomness, generate ECC or AES keys, encrypt files (from
Import
toExport
), or decrypt files (fromExport
toDecrypted
). - Adjust settings such as maximum file size and temporary file deletion through the GUI.
- Place your raw data (radiation CSV files) in the
Radiation Data/
folder. - Run
von-neumann-extractor
(or use the GUI option) to create unbiased 256-bit text files in theRandomness/
folder. - Run
ECC-generator
orAES-generator
to produce ECC and AES keys, respectively. - Run
public
to produce public ECC keys. - Place the files or folders you wish to encrypt in the
Import/
folder. - Run
encryptor
(or use the GUI’s “Encrypt File” option) to create an encrypted archive in theExport/
folder. - To decrypt, run
decryptor
(or use the GUI’s “Decrypt File” option) to output the decrypted files in theDecrypted/
folder.
-
File Size Limits
- The default code is designed for small- to medium-sized files (64GB). Large files may require additional memory and disk space. Configure the maximum file size in the GUI settings or adjust the relevant sections in
encrypt.cpp
.
- The default code is designed for small- to medium-sized files (64GB). Large files may require additional memory and disk space. Configure the maximum file size in the GUI settings or adjust the relevant sections in
-
Security
- Always protect the private keys in
ECC Keys/
and the AES keys inAES Keys/
. - The software is designed to remove or overwrite randomness files after use to minimise reuse. Verify the “Deletion_Setting” in the
Settings/settings.txt
file or via the GUI toggles.
- Always protect the private keys in
-
Platform Compatibility
- Windows is the primary target environment. For macOS or Linux, adapt the compilation process (for example, by omitting the
.exe
extension and adjusting library paths) and use shell scripts instead of the provided.bat
file.
- Windows is the primary target environment. For macOS or Linux, adapt the compilation process (for example, by omitting the
-
Error Handling
- The application automatically creates missing directories when needed. If you encounter errors opening files, ensure that all required subdirectories are present and correctly named.
-
Testing
- Compile and run
test_von_neumann_extractor.cpp
with Catch2 to verify the core random extraction logic.
- Compile and run