initial commit

This commit is contained in:
Jorijn van der Graaf 2026-10-06 15:39:17 +02:00
commit be13205ffd
19 changed files with 33596 additions and 0 deletions

View file

@ -0,0 +1,33 @@
//SPDX-License-Identifier: LGPL-3.0-only
//SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
module;
#ifdef NOSTRO_OPENSSL_ENABLED
#include <openssl/types.h>
#include <openssl/err.h>
#endif
export module Nostro:Crypto;
#ifdef NOSTRO_OPENSSL_ENABLED
import std;
export namespace Nostro::Crypto {
long ThrowOnOpenssl(long status);
template <typename T>
T* ThrowOnOpenssl(T* pointer) {
if(pointer == nullptr) {
ERR_print_errors_fp(stderr);
throw std::runtime_error("openssl error");
}
return pointer;
}
std::string SignBody(EVP_PKEY* privateKey, std::string_view body);
std::tuple<EVP_PKEY*, std::string> CreateKey();
EVP_PKEY* LoadKeyFromPem(std::string_view pem);
};
#endif