Skip to content

Commit 0fa5136

Browse files
author
Levent KARAGÖL
committed
generateRSAKeyPair function has been added
1 parent 33c9542 commit 0fa5136

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ project(myProject)
4343
4444
find_package(OpenSSL REQUIRED)
4545
46-
add_executable(myProject main.cpp)
46+
add_executable(myProject main.cpp libcpp-crypto.hpp)
4747
48-
target_link_libraries(myProject PRIVATE libcpp-crypto OpenSSL::SSL OpenSSL::Crypto)
48+
target_link_libraries(myProject PRIVATE OpenSSL::SSL OpenSSL::Crypto)
4949
5050
```
5151

@@ -176,10 +176,10 @@ You have two different options to create a Public and Private key pair. The firs
176176
generateRSAKeyPair function in the library, passing the desired key length as a parameter. Below is a sample code for this usage.
177177

178178
```cpp
179-
auto keyPair = CryptoService::generateRSAKeyPair(2048);
179+
auto keyPair = CryptoService::generateRSAKeyPair(2048);
180180

181-
std::cout << "2048 bit Public RSA Key:" << std::endl << keyPair.publicKey << std::endl;
182-
std::cout << "2048 bit Private RSA Key:" << std::endl << keyPair.privateKey << std::endl;
181+
std::cout << "2048 bit Public RSA Key:" << std::endl << keyPair.publicKey << std::endl;
182+
std::cout << "2048 bit Private RSA Key:" << std::endl << keyPair.privateKey << std::endl;
183183
```
184184

185185
> [!TIP]
@@ -190,14 +190,14 @@ Optionally, you can also pass a passphrase as follows to the generateRSAKeyPair
190190
you will need to pass this passphrase to the decryptWithRSA function to decrypt the text.
191191

192192
```cpp
193-
auto keyPair = CryptoService::generateRSAKeyPair(2048, "myPassphrase");
193+
auto keyPair = CryptoService::generateRSAKeyPair(2048, "myPassphrase");
194194

195-
std::cout << "2048 bit Public RSA Key (with passphrase):" << std::endl << keyPair.publicKey << std::endl;
196-
std::cout << "2048 bit Private RSA Key (with passphrase):" << std::endl << keyPair.privateKey << std::endl;
195+
std::cout << "2048 bit Public RSA Key:" << std::endl << keyPair.publicKey << std::endl;
196+
std::cout << "2048 bit Private RSA Key:" << std::endl << keyPair.privateKey << std::endl;
197197
```
198198

199-
As a second option, if OpenSSL is installed on your system, you can use the necessary OpenSSL commands from the
200-
command line to create a Public and Private key pair. As the first step in this option, when you run it by typing
199+
As a second option, if OpenSSL is installed on your system, you can use the necessary OpenSSL commands from the
200+
command line to create a Public and Private key pair. As the first step in this option, when you run it by typing
201201
the following line on the command line, a text file named "private_key.pem" will be created containing the private
202202
key information.
203203

@@ -234,7 +234,7 @@ character sets can take up twice. I am sharing the table below for a quick refer
234234
> time and requires a lot of patience, even for a high-end computer.
235235
236236
> [!CAUTION]
237-
> 1024-bit RSA keys are not secure in the face of today's increasing computing power and advanced factorization algorithms.
237+
> 1024-bit RSA keys are not secure in the face of today's increasing computing power and advanced factorization algorithms.
238238
> Please use keys of at least 2048 bits.
239239
240240
## How to handle Exceptions (AES)?

0 commit comments

Comments
 (0)