This is a bare-bones mathematical encryption library for educational purposes only. It processes data and implements basic encryption protocols
This implementation is NOT secure and should NOT be used for actual encryption. It lacks:
- Proper padding (vulnerable to padding oracle attacks)
- Adequate key sizes (uses small keys that can be broken)
For real applications, use cryptographic libraries like OpenSSL, Libsodium, among others.
// Generate key pair
auto keys = crypto::rsa::generate_keypair();
// Original message
std::string message = "Test Message 123";
std::vector<uint8_t> data(message.begin(), message.end());
// Encrypt
auto encrypted = crypto::rsa::encrypt(data, keys.public_key);
// Decrypt
auto decrypted = crypto::rsa::decrypt(data, keys.private_key);
// Print decrypted message
std::cout << std::string(decrypted.begin(), decrypted.end());A test script is located in src/main.cpp