Starter

Encrypting Stuff

Example encrypts a std::string with AES.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
#include <Zostera/aes.h>

int main(){

    auto * aes = new Zostera::AES();
    aes->generateRandomAes(64);

    std::string message = "We will attack at dawn";

    std::string cipher = aes->encrypt(message);

}

Example encrypting with RSA.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
#include <Zostera/rsa.h>

int main(){
    auto * rsa_private = new Zostera::RSA_PRIVATE();
    Zostera::RSA_PUBLIC * rsa_public = rsa_private->generate_private_rsa(2048);

    std::string message = "We will attack at dawn";

    std::string cipher = rsa_public->encrypt(message);
    std::string recovered = rsa_private->decrypt(cipher);

}