2024-04-11 09:36:59 +00:00
# Open quantum safe OpenSSL 1.1.1t
2024-02-10 13:40:04 +00:00
2024-04-11 09:36:59 +00:00
## :heavy_exclamation_mark: :heavy_exclamation_mark: :heavy_exclamation_mark: OpenSSL 1.1.1 End of life - https://www.openssl.org/blog/blog/2023/09/11/eol-111/ :heavy_exclamation_mark: :heavy_exclamation_mark: :heavy_exclamation_mark:
2024-02-10 13:40:04 +00:00
2024-04-11 09:36:59 +00:00
## **"The OpenSSL project has announced that its support for OpenSSL 1.1.1 will stop in September, 2023, and that all users should switch to OpenSSL 3. Consequently, the Open Quantum Safe project is discontinuing development of our OQS-OpenSSL 1.1.1 fork."** - https://github.com/open-quantum-safe/openssl
2024-02-10 13:40:04 +00:00
2024-04-11 09:36:59 +00:00
# Building
Inštalované a testované na:
| Platform | OS | compiler | cmake | ninja |
|:-----------------:|:---------------------------:|:------------------------------------------------:|:-------:|:-------:|
| Linux | Ubuntu 20.04.5 LTS < br > (GNU/Linux 5.15.133.1-microsoft-standard-WSL2 x86_64) | gcc version 11.4.0 < br > (Ubuntu 11.4.0-1ubuntu1~22.04) | version 1.10.1 | version 3.16.3 |
2024-02-10 13:40:04 +00:00
2024-04-11 09:36:59 +00:00
## LINUX
2024-02-10 13:40:04 +00:00
2024-04-11 09:36:59 +00:00
#### 1. Inštalácia potrebných nástrojov
2024-02-10 13:40:04 +00:00
2024-04-11 09:36:59 +00:00
```sudo apt install cmake gcc libtool libssl-dev make ninja-build git -y```
2024-02-10 13:40:04 +00:00
2024-04-11 09:36:59 +00:00
#### 2. Stiahnutie a inštalácia liboqs
2024-02-10 13:40:04 +00:00
```
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
```
2024-04-11 09:36:59 +00:00
#### 3. Stiahnutie a inštalácia OQS-OpenSSL
2024-02-10 13:40:04 +00:00
```
2024-04-11 09:36:59 +00:00
git clone --branch OQS-OpenSSL_1_1_1-stable https://github.com/open-quantum-safe/openssl.git
2024-02-10 13:40:04 +00:00
cd ./openssl
2024-04-11 09:36:59 +00:00
./Configure no-shared linux-x86_64 -lm
2024-02-10 13:40:04 +00:00
make -j 1
sudo make install
```
2024-04-11 09:36:59 +00:00
## WINDOWS
Inštalované a testované na:
| Platform | OS | compiler | cmake | ninja | Perl | Build Tools < / br > for Visual Studio 2022 |
|:-----------------:|:---------------------------:|:------------------------------------------------:|:-------:|:-------:|:------:|:---:|
| Windows | Windows 10.0.19043 | gcc version 13.2.0< br > (MinGW-W64 x86_64-msvcrt-posix-seh) | version 1.11.1 | version 3.27.1 | 5.32.1 | 17.5.5
2024-02-10 13:40:04 +00:00
2024-04-11 09:36:59 +00:00
#### 1. Príprava prostredia
2024-02-10 13:40:04 +00:00
2024-04-11 09:36:59 +00:00
GCC, ninja, CMake - súťasťou knižnice Winlibs - https://winlibs.com/
2024-02-10 13:40:04 +00:00
2024-04-11 09:36:59 +00:00
Perl - stiahnutie a inštalácia Perl-u strawberry-perl-5.32.1.1-64bit zo stránky https://strawberryperl.com/
2024-02-10 13:40:04 +00:00
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
```
2024-04-11 09:36:59 +00:00
V našom prípade systémová premenná nepomohla a bolo nutné ich nekonfigurovať manuálne v Powershell termináli príkazmi:
2024-02-10 13:40:04 +00:00
```
$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\`
2024-04-11 09:36:59 +00:00
#### 2. Stiahnutie OQS-OpenSSL a liboqs
2024-02-10 13:40:04 +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 >
Liboqs - stiahnutie súborov z GITu - https://github.com/open-quantum-safe/liboqs
2024-04-11 09:36:59 +00:00
#### 3. Príprava liboqs
2024-02-10 13:40:04 +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
nmake
```
2024-04-11 09:36:59 +00:00
# Launch
2024-02-10 13:40:04 +00:00
2024-04-11 09:36:59 +00:00
**1. Vytvorenie CA kľúča a certifikátu**
- v tomto príklade predstavuje *p256_dilithium2* hybridný algoritmus *dilithium2* v kombinácii si krivkou *p256* ECDSA algorimu
2024-02-10 13:40:04 +00:00
2024-04-11 09:36:59 +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
```
**2. 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
```
**3. 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
```
**4. 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
```
2024-02-10 13:40:04 +00:00
## References
[Open quantum safe OpenSSL 1.1.1t ](https://github.com/open-quantum-safe/openssl )
2024-04-11 09:36:59 +00:00
[liboqs ](https://github.com/open-quantum-safe/liboqs )
[WinLibs ](https://winlibs.com/ )
[Strawberry Perl ](https://strawberryperl.com/ )