2023-03-25 12:29:09 +00:00
|
|
|
# MastersThesis
|
|
|
|
|
2023-10-09 14:10:17 +00:00
|
|
|
## Open quantum safe OpenSSL 1.1.1t
|
|
|
|
|
|
|
|
:red_circle: OpenSSL 1.1.1 End of life - https://www.openssl.org/blog/blog/2023/09/11/eol-111/
|
|
|
|
|
2023-03-25 12:29:09 +00:00
|
|
|
## Building
|
|
|
|
### LINUX
|
|
|
|
- testované na Ubuntu 20.04.5
|
|
|
|
|
2023-03-25 12:44:02 +00:00
|
|
|
**1. Inštalácia potrebných nástrojov**
|
2023-03-25 12:29:09 +00:00
|
|
|
|
2023-03-25 12:44:02 +00:00
|
|
|
```sudo apt install cmake gcc libtool libssl-dev make ninja-build git -y```
|
2023-03-25 12:29:09 +00:00
|
|
|
|
2023-03-25 12:44:02 +00:00
|
|
|
**2. Stiahnutie Open Quantum Safe OpenSSL repozitáru**
|
2023-03-25 12:29:09 +00:00
|
|
|
|
2023-03-25 12:44:02 +00:00
|
|
|
```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
|
2023-03-25 12:29:09 +00:00
|
|
|
cd liboqs
|
|
|
|
mkdir build && cd build
|
|
|
|
cmake -GNinja -DCMAKE_INSTALL_PREFIX=../../openssl/oqs ..
|
|
|
|
ninja
|
2023-03-25 12:44:02 +00:00
|
|
|
ninja install
|
|
|
|
```
|
|
|
|
**4. Build QS OpenSSL fork**
|
2023-03-25 12:29:09 +00:00
|
|
|
|
2023-03-25 12:44:02 +00:00
|
|
|
```
|
|
|
|
cd ./openssl
|
2023-03-25 12:29:09 +00:00
|
|
|
./Configure no-shared linux-x86_64 -DOQS_DEFAULT_GROUPS=\"kyber1024:p521_kyber1024:kyber90s1024:p521_kyber90s1024\" -lm
|
|
|
|
make -j 1
|
|
|
|
sudo make install
|
2023-03-25 12:44:02 +00:00
|
|
|
```
|
2023-03-28 09:08:06 +00:00
|
|
|
- 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
|
|
|
|
|
2023-03-25 12:44:02 +00:00
|
|
|
**5. Vytvorenie CA kľúča a certifikátu**
|
2023-03-28 09:08:06 +00:00
|
|
|
- v tomto príklade je *p256_dilithium2* hybridný algoritmus *dilithium2* s použitím P256 ECDH krivkou
|
2023-03-25 12:29:09 +00:00
|
|
|
|
2023-03-25 12:44:02 +00:00
|
|
|
```
|
2023-03-25 12:29:09 +00:00
|
|
|
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
|
2023-03-25 12:44:02 +00:00
|
|
|
```
|
|
|
|
**6. Vygenerovanie privátneho kľúča pre server**
|
|
|
|
```
|
2023-03-25 12:29:09 +00:00
|
|
|
./openssl req -new -newkey p256_dilithium2 -keyout p256_dilithium2_srv.key -out p256_dilithium2_srv.csr -nodes -subj "/CN=localhost" -config ./openssl.cnf
|
2023-03-25 12:44:02 +00:00
|
|
|
```
|
|
|
|
**7. Vygenerovanie certifikátu s CA podpisom pre server**
|
|
|
|
```
|
2023-03-25 12:29:09 +00:00
|
|
|
./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
|
2023-03-25 12:44:02 +00:00
|
|
|
```
|
|
|
|
**8. Spustenie serveru a klienta**
|
2023-03-28 09:08:06 +00:00
|
|
|
- oba programy je potrebné spustiť v samostatných oknách terminálu
|
2023-03-25 12:44:02 +00:00
|
|
|
```
|
2023-03-25 12:29:09 +00:00
|
|
|
./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
|
2023-03-25 12:44:02 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
### WINDOWS
|
|
|
|
- testované na Windows 10.0.19043
|
2023-05-09 15:59:42 +00:00
|
|
|
|
2023-05-10 10:31:57 +00:00
|
|
|
**1. Príprava prostredia**
|
2023-05-09 15:59:42 +00:00
|
|
|
|
|
|
|
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/
|
|
|
|
|
2023-05-10 13:58:44 +00:00
|
|
|
NMAKE - stiahnutie a inštalácia nástrojov Build Tools for Visual Studio 2022 zo stránky https://visualstudio.microsoft.com/downloads/
|
2023-05-09 16:05:13 +00:00
|
|
|
|
2023-05-09 15:59:42 +00:00
|
|
|
Pridanie premenných prostredia:
|
|
|
|
```
|
|
|
|
D:\Strawberry\perl\bin
|
|
|
|
D:\Program Files\CMake\bin
|
2023-05-09 16:05:13 +00:00
|
|
|
D:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.35.32215\bin\Hostx86\x86\nmake.exe
|
2023-05-09 15:59:42 +00:00
|
|
|
```
|
2023-05-10 10:31:57 +00:00
|
|
|
pozn. v našom prípade premenná nepomohla a bolo nutné ich nekonfigurovať manuálne v Powershelli príkazmi:
|
|
|
|
```
|
2023-05-09 15:59:42 +00:00
|
|
|
$env:path += ";D:\Program Files\cmake\bin"
|
2023-05-09 16:05:13 +00:00
|
|
|
$env:path += ";d:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.35.32215\bin\Hostx86\x86\"
|
2023-05-10 10:31:57 +00:00
|
|
|
```
|
2023-05-10 13:58:44 +00:00
|
|
|
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\`
|
2023-05-09 15:59:42 +00:00
|
|
|
|
|
|
|
**2. Stiahnutie OpenSSL, Open Quantum Safe OpenSSL repozitáru a liboqs**
|
2023-05-10 10:31:57 +00:00
|
|
|
|
|
|
|
OpenSSL - stiahnutie OpenSSL 1.1.1t zo stránky - https://www.openssl.org/source/ <br>
|
2023-05-09 15:59:42 +00:00
|
|
|
Stiahnutý súbor sme extrahovali do priečinka ProgramFiles a premenovali sme ho na openssl
|
|
|
|
|
2023-05-10 10:31:57 +00:00
|
|
|
OpenSSL OQS - stiahnutie OQS OpenSSL repozitáru z GITu - https://github.com/open-quantum-safe/openssl/tree/OQS-OpenSSL_1_1_1-stable <br>
|
2023-05-09 15:59:42 +00:00
|
|
|
Presun stiahnutých súborov do openssl priečinku
|
|
|
|
|
|
|
|
Liboqs - stiahnutie súborov z GITu - https://github.com/open-quantum-safe/liboqs
|
|
|
|
|
2023-05-10 10:31:57 +00:00
|
|
|
**3. Príprava liboqs**
|
|
|
|
- v prípade chyby prístupu pri príkaze cmake alebo ninja je potrebné spustiť PowerShell ako administrátor
|
2023-05-10 13:58:44 +00:00
|
|
|
- v našom prípade sme použili Administrator Developer PowerShell for VS 2022
|
2023-05-09 15:59:42 +00:00
|
|
|
```
|
|
|
|
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
|
2023-05-10 10:31:57 +00:00
|
|
|
nmake
|
2023-05-09 15:59:42 +00:00
|
|
|
```
|
2023-03-25 12:44:02 +00:00
|
|
|
|
2023-05-10 14:19:24 +00:00
|
|
|
pozn. chyba spôsobená chýbajúcim nalinkovaním Perlu a NMAKE-u (vyriešené spustením súboru vcvarsall.bat)
|
2023-05-09 16:08:22 +00:00
|
|
|
![err-code](https://ctrlv.sk/shots/2023/05/09/QHGf.png)
|
|
|
|
|
2023-05-10 13:58:44 +00:00
|
|
|
**5. Príprava certifikátu, kľúčov a spustenie programov**
|
2023-05-10 14:19:24 +00:00
|
|
|
|
|
|
|
Generovanie certifikátu, kľúčov a spustenie programov je rovnaké ako na platforme UNIX - viď. bod 5-8 <br>
|
|
|
|
Výsledok je rovnaký
|
2023-05-10 13:58:44 +00:00
|
|
|
|
|
|
|
![final-result](https://ctrlv.sk/shots/2023/05/10/SzvJ.png)
|
|
|
|
|
2023-03-25 12:44:02 +00:00
|
|
|
## References
|
2023-05-09 15:59:42 +00:00
|
|
|
[Open quantum safe OpenSSL 1.1.1t](https://github.com/open-quantum-safe/openssl)
|
2023-10-09 14:10:17 +00:00
|
|
|
|
|
|
|
---------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
## TIIGER TLS
|
|
|
|
|
|
|
|
## Building
|
|
|
|
### LINUX
|
2023-10-11 23:22:52 +00:00
|
|
|
Systémové špecifikácie:</br>
|
2023-10-09 14:10:17 +00:00
|
|
|
- Ubuntu 20.04.5
|
|
|
|
- gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.2)
|
2023-10-11 23:22:52 +00:00
|
|
|
- Rust version 1.72.1 (d5c2e9c34 2023-09-13) [update na 1.73.0 (cc66ad468 2023-10-03)]
|
2023-10-09 14:10:17 +00:00
|
|
|
- MIRACL core v4.1
|
|
|
|
- Python 3.8.10
|
2023-10-11 23:22:52 +00:00
|
|
|
- libsodium 1.0.19
|
2023-10-09 14:10:17 +00:00
|
|
|
|
2023-10-11 23:22:52 +00:00
|
|
|
## Server
|
2023-10-09 14:10:17 +00:00
|
|
|
|
|
|
|
```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
|
|
|
|
|
2023-10-11 23:22:52 +00:00
|
|
|
TODO:</br>
|
|
|
|
:white_square_button: doplniť popis pre zmenu podporovaných certifikátov
|
2023-10-09 14:10:17 +00:00
|
|
|
|
2023-10-11 23:22:52 +00:00
|
|
|
## 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é š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
|
|
|
|
|
|
|
|
## Server
|
|
|
|
- tbd
|
2023-10-09 14:10:17 +00:00
|
|
|
|
|
|
|
## References
|
|
|
|
[Open quantum safe OpenSSL 1.1.1t](https://github.com/Crypto-TII/TLS1.3)
|
2023-10-11 23:22:52 +00:00
|
|
|
[MIRACL core](https://github.com/miracl/core)
|
|
|
|
[libsodium](https://github.com/jedisct1/libsodium)
|
|
|
|
[WinLibs](https://winlibs.com/)
|