RSA is an educational C++20 library for RSA-style encryption and decryption primitives.
Important
This project is experimental and intended for learning/library exploration. The goal is to become production-ready in the future.
- RSA-style encryption and decryption APIs
- Public and private key structs with serialization helpers
- Base64 helper functions for encoded key or byte-vector data
Clone the repository with its submodules:
git clone --recurse-submodules https://github.com/ParallelEngineering/RSA-Encryptor.gitTo integrate the library into another CMake project, add this repository as a
subdirectory and link against the RSA target:
add_subdirectory(path/to/RSA-Encryptor)
target_link_libraries(YourTarget PRIVATE RSA)You can also build the library directly with CMake:
cmake -S . -B build
cmake --build build#include "decrypt.h"
#include "encrypt.h"
#include "keyPair.h"
#include <cstdint>
#include <string>
#include <vector>
int main() {
keyPair keys;
PublicKey publicKey = keys.getPublicKey();
PrivateKey privateKey = keys.getPrivateKey();
core::Encryptor encryptor(publicKey);
core::Decryptor decryptor(privateKey);
const std::string message = "hello";
ByteArray ciphertext = encryptor.encrypt(message);
std::string plaintext = decryptor.decrypt(ciphertext);
}