update
This commit is contained in:
parent
e4347bf8e1
commit
4e9e85258b
357
README.md
357
README.md
@ -1,357 +1,12 @@
|
||||
# MastersThesis
|
||||
|
||||
## Open quantum safe OpenSSL 1.1.1t
|
||||
##About
|
||||
|
||||
:red_circle: OpenSSL 1.1.1 End of life - https://www.openssl.org/blog/blog/2023/09/11/eol-111/
|
||||
##Author
|
||||
Author: Jozef Simko
|
||||
|
||||
## Building
|
||||
### LINUX
|
||||
- testované na Ubuntu 20.04.5
|
||||
School year: 5., Master study, 2023/24
|
||||
|
||||
**1. Inštalácia potrebných nástrojov**
|
||||
|
||||
```sudo apt install cmake gcc libtool libssl-dev make ninja-build git -y```
|
||||
|
||||
**2. Stiahnutie Open Quantum Safe OpenSSL repozitáru**
|
||||
|
||||
```git clone --branch OQS-OpenSSL_1_1_1-stable https://github.com/open-quantum-safe/openssl.git```
|
||||
|
||||
**3. Stiahnutie a inštalácia liboqs**
|
||||
|
||||
```
|
||||
git clone --branch main https://github.com/open-quantum-safe/liboqs.git
|
||||
cd liboqs
|
||||
mkdir build && cd build
|
||||
cmake -GNinja -DCMAKE_INSTALL_PREFIX=../../openssl/oqs ..
|
||||
ninja
|
||||
ninja install
|
||||
```
|
||||
**4. Build QS OpenSSL fork**
|
||||
|
||||
```
|
||||
cd ./openssl
|
||||
./Configure no-shared linux-x86_64 -DOQS_DEFAULT_GROUPS=\"kyber1024:p521_kyber1024:kyber90s1024:p521_kyber90s1024\" -lm
|
||||
make -j 1
|
||||
sudo make install
|
||||
```
|
||||
- prepínač `-DOQS_DEFAULT_GROUPS` umožňuje meniť key exchange algoritmy, ktoré bude server podporovať
|
||||
- zoznam všetkých podporovaných algoritmov - https://github.com/open-quantum-safe/openssl#key-exchange
|
||||
|
||||
**5. Vytvorenie CA kľúča a certifikátu**
|
||||
- v tomto príklade je *p256_dilithium2* hybridný algoritmus *dilithium2* s použitím P256 ECDH krivkou
|
||||
|
||||
```
|
||||
cd ./openssl/apps
|
||||
./openssl req -x509 -new -newkey p256_dilithium2 -keyout p256_dilithium2_CA.key -out p256_dilithium2_CA.crt -nodes -subj "/CN=oqstest CA" -days 365 -config ./openssl.cnf
|
||||
```
|
||||
**6. Vygenerovanie privátneho kľúča pre server**
|
||||
```
|
||||
./openssl req -new -newkey p256_dilithium2 -keyout p256_dilithium2_srv.key -out p256_dilithium2_srv.csr -nodes -subj "/CN=localhost" -config ./openssl.cnf
|
||||
```
|
||||
**7. Vygenerovanie certifikátu s CA podpisom pre server**
|
||||
```
|
||||
./openssl x509 -req -in p256_dilithium2_srv.csr -out p256_dilithium2_srv.crt -CA p256_dilithium2_CA.crt -CAkey p256_dilithium2_CA.key -CAcreateserial -days 365
|
||||
```
|
||||
**8. Spustenie serveru a klienta**
|
||||
- oba programy je potrebné spustiť v samostatných oknách terminálu
|
||||
```
|
||||
./openssl s_server -cert p256_dilithium2_srv.crt -key p256_dilithium2_srv.key -www -tls1_3
|
||||
./openssl s_client -groups kyber1024 -CAfile p256_dilithium2_CA.crt -connect localhost
|
||||
```
|
||||
|
||||
### WINDOWS
|
||||
- testované na Windows 10.0.19043
|
||||
|
||||
**1. Príprava prostredia**
|
||||
|
||||
Perl - stiahnutie Perl-u strawberry-perl-5.32.1.1-64bit zo stránky https://strawberryperl.com/
|
||||
|
||||
Cmake - stihnutie CMake-u cmake-3.26.3-windows-x86_64 zo stránky https://cmake.org/download/
|
||||
|
||||
NMAKE - stiahnutie a inštalácia nástrojov Build Tools for Visual Studio 2022 zo stránky https://visualstudio.microsoft.com/downloads/
|
||||
|
||||
Pridanie premenných prostredia:
|
||||
```
|
||||
D:\Strawberry\perl\bin
|
||||
D:\Program Files\CMake\bin
|
||||
D:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.35.32215\bin\Hostx86\x86\nmake.exe
|
||||
```
|
||||
pozn. v našom prípade premenná nepomohla a bolo nutné ich nekonfigurovať manuálne v Powershelli príkazmi:
|
||||
```
|
||||
$env:path += ";D:\Program Files\cmake\bin"
|
||||
$env:path += ";d:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.35.32215\bin\Hostx86\x86\"
|
||||
```
|
||||
Pre správnu funkciu NMAKE je nutné spustiť súbor vcvarsall.bat <br>
|
||||
V našom prípade sa tento súbor nachádzal na adrese `d:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\`
|
||||
|
||||
**2. Stiahnutie OpenSSL, Open Quantum Safe OpenSSL repozitáru a liboqs**
|
||||
|
||||
OpenSSL - stiahnutie OpenSSL 1.1.1t zo stránky - https://www.openssl.org/source/ <br>
|
||||
Stiahnutý súbor sme extrahovali do priečinka ProgramFiles a premenovali sme ho na openssl
|
||||
|
||||
OpenSSL OQS - stiahnutie OQS OpenSSL repozitáru z GITu - https://github.com/open-quantum-safe/openssl/tree/OQS-OpenSSL_1_1_1-stable <br>
|
||||
Presun stiahnutých súborov do openssl priečinku
|
||||
|
||||
Liboqs - stiahnutie súborov z GITu - https://github.com/open-quantum-safe/liboqs
|
||||
|
||||
**3. Príprava liboqs**
|
||||
- v prípade chyby prístupu pri príkaze cmake alebo ninja je potrebné spustiť PowerShell ako administrátor
|
||||
- v našom prípade sme použili Administrator Developer PowerShell for VS 2022
|
||||
```
|
||||
cd liboqs
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -GNinja -DCMAKE_INSTALL_PREFIX='D:\Program Files\openssl\openssl-OQS-OpenSSL_1_1_1-stable\oqs' ..
|
||||
ninja
|
||||
ninja install
|
||||
```
|
||||
|
||||
**4. Build QS OpenSSL fork**
|
||||
```
|
||||
cd ./openssl
|
||||
perl Configure VC-WIN64A no-shared
|
||||
nmake
|
||||
```
|
||||
|
||||
pozn. chyba spôsobená chýbajúcim nalinkovaním Perlu a NMAKE-u (vyriešené spustením súboru vcvarsall.bat)
|
||||
![err-code](https://ctrlv.sk/shots/2023/05/09/QHGf.png)
|
||||
|
||||
**5. Príprava certifikátu, kľúčov a spustenie programov**
|
||||
|
||||
Generovanie certifikátu, kľúčov a spustenie programov je rovnaké ako na platforme UNIX - viď. bod 5-8 <br>
|
||||
Výsledok je rovnaký
|
||||
|
||||
![final-result](https://ctrlv.sk/shots/2023/05/10/SzvJ.png)
|
||||
|
||||
## References
|
||||
[Open quantum safe OpenSSL 1.1.1t](https://github.com/open-quantum-safe/openssl)
|
||||
|
||||
---------------------------------------------------------------------------------------------
|
||||
|
||||
## TIIGER TLS
|
||||
|
||||
## Building
|
||||
### LINUX
|
||||
Systémové a softvérové špecifikácie:</br>
|
||||
- Ubuntu 20.04.6 LTS (GNU/Linux 5.4.72-microsoft-standard-WSL2 x86_64)
|
||||
- gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.2)
|
||||
- GNU Make 4.2.1 built for x86_64-pc-linux-gnu
|
||||
- Rust version 1.72.1 (d5c2e9c34 2023-09-13) [update na 1.73.0 (cc66ad468 2023-10-03)]
|
||||
- MIRACL core v4.1
|
||||
- Python 3.8.10
|
||||
- libsodium 1.0.19
|
||||
|
||||
## Server
|
||||
|
||||
```curl https://sh.rustup.rs -sSf | sh```
|
||||
- inštalácia potrebných nástrojov na kompiláciu kódu v jazyku Rust
|
||||
|
||||
```
|
||||
sudo apt install python3
|
||||
git clone https://github.com/miracl/core.git
|
||||
cd core/rust
|
||||
python3 config64.py test
|
||||
cd ../..
|
||||
```
|
||||
- inštalácia pythonu (ak sa ešte nenechádza v systéme), stiahnutie a auto-build MIRACL knižnice
|
||||
|
||||
```
|
||||
git clone https://github.com/Crypto-TII/TLS1.3.git
|
||||
cd TLS1.3/rust/server
|
||||
nano Cargo.toml
|
||||
```
|
||||
- stiahnutie TIIGER TLS knižnice
|
||||
- v súbore Cargo.toml je nutné správne nalinkovať cestu k zložke *mcore*, ktorá vznikla auto-buildom MIRACL knižnice v predošlom kroku
|
||||
|
||||
```
|
||||
cargo build
|
||||
cargo run
|
||||
```
|
||||
- príkazy na kompiláciu serveru a jeho následné spustenie
|
||||
- server je defaultne prístupný cez webový prehliadač na adrese https://127.0.0.1:4433; pripojenie vytvoreným klientom je popísané nižšie
|
||||
|
||||
TODO:</br>
|
||||
:white_square_button: doplniť popis pre zmenu podporovaných certifikátov
|
||||
|
||||
## Klient
|
||||
```
|
||||
sudo apt install python3
|
||||
git clone https://github.com/miracl/core.git
|
||||
*// môžeme preskočiť ak už máme python3 a miracl*
|
||||
cd core/cpp
|
||||
python3 config64.py test
|
||||
cd ../..
|
||||
```
|
||||
- auto-build MIRACL knižnice pre jazyk C++
|
||||
|
||||
```
|
||||
wget https://download.libsodium.org/libsodium/releases/LATEST.tar.gz
|
||||
tar xvf LATEST.tar.gz
|
||||
cd libsodium-stable/
|
||||
./configure
|
||||
make && make check
|
||||
sudo make install
|
||||
```
|
||||
- stiahnutie a inštalácia knižnice libsodium
|
||||
|
||||
```
|
||||
git clone https://github.com/Crypto-TII/TLS1.3.git
|
||||
cd TLS1.3/cpp
|
||||
mkdir -p sal/miracl/includes
|
||||
cp /core/cpp/core.a sal/miracl
|
||||
cp /core/cpp/*.h sal/miracl/includes
|
||||
```
|
||||
|
||||
```
|
||||
cmake -DSAL=MIRACL_SODIUM -D CMAKE_CXX_COMPILER=/usr/bin/gcc
|
||||
cd CMakeFiles/client.dir
|
||||
nano link.txt
|
||||
```
|
||||
- na koniec riadku za prepínač *-lsodium* pridáme prepínač *-lstdc++*
|
||||
|
||||
```
|
||||
cd ../..
|
||||
make
|
||||
./client
|
||||
```
|
||||
TODO:</br>
|
||||
:white_square_button: doplniť popis funkcií podporovaných klientom
|
||||
|
||||
### WINDOWS
|
||||
Systémové a softvérové špecifikácie:</br>
|
||||
- Microsoft Windows 10 Home, build 10.0.19045
|
||||
- gcc version 13.2.0 (MinGW-W64 x86_64-ucrt-posix-seh, built by Brecht Sanders)
|
||||
- Rust version 1.73.0
|
||||
- Python 3.10.8
|
||||
|
||||
## Server
|
||||
https://www.python.org/downloads/windows/
|
||||
- stiahnutie a inštalácia pythonu pre Windows - PATH je možné nastaviť priamo pri inštalácii (inak je nutné nastaviť ju manuálne)
|
||||
- Python3 je tiež možné záskať z Microsoft Storu
|
||||
|
||||
https://github.com/miracl/core/archive/refs/heads/master.zip
|
||||
- stiahnutie MIRACL knižnice (identická s verziou pre Linux, vrátane konfigurácie)
|
||||
|
||||
https://win.rustup.rs/
|
||||
- stiahnutie .exe súboru na rýchlu inštaláciu Rustu a ďalších nástrojov
|
||||
|
||||
```
|
||||
cd core/rust
|
||||
python config64.py test
|
||||
cd ../..
|
||||
```
|
||||
- auto-build MIRACL knižnice prostredníctvom python scriptu
|
||||
|
||||
```
|
||||
cd .\TLS1.3\rust\server\
|
||||
notepad.exe .\Cargo.toml
|
||||
```
|
||||
- v súbore Cargo.toml je nutné správne nalinkovať cestu k zložke *mcore*, ktorá vznikla auto-buildom MIRACL knižnice v predošlom kroku
|
||||
|
||||
```
|
||||
cargo build
|
||||
cargo run
|
||||
```
|
||||
- príkazy na kompiláciu serveru a jeho následné spustenie
|
||||
- správne spustenie serveru môžeme overiť na adrese https://127.0.0.1:4433
|
||||
|
||||
## Client
|
||||
|
||||
```
|
||||
cd core\cpp
|
||||
python config64.py test
|
||||
cd ../..
|
||||
```
|
||||
|
||||
- https://download.libsodium.org/libsodium/releases/libsodium-1.0.19-stable-mingw.tar.gz </br>
|
||||
:white_check_mark: doplniť postup linkovania knižnice s prekladačom gcc
|
||||
|
||||
- nájdeme miesto, kde sme uložili knižnicu WinLibs a prejdeme do zložky */mingw64/lib/gcc/x86_64-w64-mingw32/11.2.0/*
|
||||
|
||||
- do tejto zložky skopírujeme súbor libsodium.a zo stiahnutého balíka knižnice libsodium */libsodium-1.0.19-stable-mingw.tar/libsodium-win64/lib/*
|
||||
- následne skopírujeme celý obsah */libsodium-1.0.19-stable-mingw.tar/libsodium-win64/include/* do zložky */mingw64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/*
|
||||
|
||||
|
||||
```
|
||||
cd TLS1.3/cpp
|
||||
mkdir -p sal/miracl/includes
|
||||
cp /core/cpp/core.a sal/miracl
|
||||
cp /core/cpp/*.h sal/miracl/includes
|
||||
```
|
||||
|
||||
```
|
||||
cmake -DSAL=MIRACL_SODIUM -D CMAKE_CXX_COMPILER=D:/mingw64/bin/gcc.exe -G "Unix Makefiles"
|
||||
```
|
||||
|
||||
:white_square_button: doplniť úpravy v súboroch tls_sockets.h a tls_sockets.cpp
|
||||
- tls_sockets.h:22:10: fatal error: sys/socket.h: No such file or directory #include <sys/socket.h>
|
||||
- tls_sockets.cpp:31:47: error: cannot convert 'timeval*' to 'const char*' setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof(timeout));
|
||||
|
||||
```
|
||||
cd CMakeFiles/client.dir
|
||||
```
|
||||
- do súboru *linkLibs.rsp* pridáme prepínače *-lws2_32* a *-lstdc++*
|
||||
|
||||
```
|
||||
cd ../..
|
||||
make
|
||||
```
|
||||
|
||||
## References
|
||||
[Open quantum safe OpenSSL 1.1.1t](https://github.com/Crypto-TII/TLS1.3)
|
||||
|
||||
[MIRACL core](https://github.com/miracl/core)
|
||||
|
||||
[libsodium](https://github.com/jedisct1/libsodium)
|
||||
|
||||
[WinLibs](https://winlibs.com/)
|
||||
|
||||
[Rust Cargo](https://doc.rust-lang.org/cargo/index.html)
|
||||
|
||||
[Python](https://www.python.org/)
|
||||
|
||||
##
|
||||
|
||||
| | Linux rust client| Win rust client | Linux C++ client| Win C++ client | Win OpenSSL client | Linux OpenSSL client | OpenSSL client (Docker) |
|
||||
|-------------------|--------------------|------------------|-------------------|-------------------|---------------------------|----------------------|-----------------|
|
||||
|Linux Rust server | Y | Y | Y | Y |Y(2) | Y(2) |
|
||||
|Win Rust server | Y(1) | Y | Y(1) | Y | Y(2) | Y(2) |
|
||||
|OpenSSL server | Y(3) | Y(3) | Y | Y(1) | Y | Y |
|
||||
|OpenSSL server (Docker)| | | | |
|
||||
|OpenSSL server (OQS-provider)| | | | |
|
||||
|
||||
```
|
||||
Y(1)
|
||||
Hostname NOT found in certificate
|
||||
Handshake Failed
|
||||
Alert sent to Server - Bad Certificate
|
||||
```
|
||||
|
||||
```
|
||||
Y(2)
|
||||
Typical setting (not PQ)
|
||||
Signature Algorithm is RSA_PSS_RSAE_SHA256
|
||||
FULL handshake succeeded
|
||||
Sending Resumption Ticket
|
||||
Waiting for Client input
|
||||
TIME_OUT
|
||||
ssl3_read_n:unexpected eof while reading:ssl/record/rec_layer_s3.c:303:
|
||||
```
|
||||
|
||||
```
|
||||
Y(3)
|
||||
Openssl 3.0.10
|
||||
Typical setting (not PQ)
|
||||
Handshake Failed
|
||||
Missing Extension
|
||||
Resumption Ticket not found or invalid
|
||||
Attempting Full Handshake
|
||||
Key Exchange Group is X25519
|
||||
Self-signed Certificate allowed
|
||||
Signature Algorithm is RSA_PSS_RSAE_SHA256
|
||||
Server Cert Verification OK - localhost
|
||||
FULL Handshake succeeded
|
||||
SSL routines:final_sig_algs:missing sigalgs extension:ssl/statem/extensions.c:1284
|
||||
|
||||
```
|
||||
Study program: Computer Networks
|
||||
|
||||
Organization: Technical University of Kosice (TUKE), Faculty of Electrical Engineering and Informatics (FEI)
|
||||
|
Loading…
Reference in New Issue
Block a user