Skip to content

Repository files navigation

Tancrypt

  • Simple cryptographic C++ library based on OpenSSL for C++11
  • Wraps around the EVP C api to allow easy keypair generation with simplfied API

Features

  • RSA keyc container and management
  • RSA encrypt, decrypt, sign and verify
  • AES key container
  • AES encrypt, decrypt
  • Custom data buffer

Documentation

https://sora3e8.github.io/tancrypt

Dependencies

  • OpenSSL3.0+

Build

git clone https://github.com/Sora3e8/tancrypt && cd build
cmake -DCMAKE_BUILD_TYPE=Release .. && cmake --build .

Example usage

#include <iostream>
#include "tancrypt/rsa.hpp"

int main()
{
  // Makes life easier 
  using namespace tancrypt;

  // Keypair generation
  RSA::pkic key;
  key.generate_keypair(2048);

  // Preparing example buffer from string
  dutils::dbuffer data_in("Hewwo, I am secret ^.^");

  // Encrypting data
  dutils::dbuffer encrypted_buffer = RSA::encrypt(key,data_in);

  // You can check the results via helper function dutils::hexStr
  std::cout << "Original:" << data_in.toStr()<< std::endl;
  std::cout << "Original(hex):" << dutils::hexStr(data_in) << std::endl;
  std::cout << "Encrypted:" << encrypted_buffer.toStr() << std::endl;
  std::cout << "Encrypted(hex):" << dutils::hexStr(encrypted_buffer) << std::endl;

  return 0;
}

About

Simple C++ cryptographic library based on OpenSSL

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages