Skip to main content


CryptoAPI is a cryptography access API following the Stratify Labs API framework. On desktop applications, it uses mbedtls under the hood for cryptography functions. On embedded, it will use whatever crypto library is provided by Stratify OS.

How to Build#

The CryptoAPI library is designed to be a CMake sub-project. To build, please use one of these projects:


Random Number Generator#

#include <crypto.hpp>
//randomize a bufferchar buffer[16]Random().seed().randomize(View(buffer))
//create a random string of 16 bytes (32 characters)const auto random_string = Random().to_string<var::GeneralString>(16)


#include <crypto.hpp>
const auto key = Key() //random key and IV
//randomize data to encrypt -- SIZE must be a multiple of 16var::Array<u8, 16> plain_bufferRandom().seed().randomize(plain_buffer)
var::Array<u8, 16> cipher_buffer
//encryptAes()  .set_key(key)  .encrypt_cbc(Aes::EncryptCbc()    .set_plain(buffer)    .set_cipher(cipher))
//decryptAes()  .set_key(key)  .decrypt_cbc(Aes::EncryptCbc()    .set_plain(buffer)    .set_cipher(cipher))

SHA256 Hash#

#include <crypto.hpp>
const auto str = "Hello World\n"printf("hash is %s\n",   Sha256().update(var::View(str)).output().to_string().cstring())