4#ifndef _Stroika_Foundation_Cryptography_OpenSSLCryptoStream_h_
5#define _Stroika_Foundation_Cryptography_OpenSSLCryptoStream_h_ 1
7#include "Stroika/Foundation/StroikaPreComp.h"
9#if qStroika_HasComponent_OpenSSL
10using EVP_CIPHER_CTX =
struct evp_cipher_ctx_st;
13#include "Stroika/Foundation/Common/Common.h"
18#include "Stroika/Foundation/Cryptography/SSL/Common.h"
19#include "Stroika/Foundation/Execution/Exceptions.h"
22#include "Stroika/Foundation/Memory/Common.h"
64namespace Stroika::Foundation::Cryptography::Encoding {
68#if qStroika_HasComponent_OpenSSL
71 enum class Direction {
76 using Cryptography::Providers::OpenSSL::CipherAlgorithm;
77 using Cryptography::Providers::OpenSSL::DerivedKey;
78 using Cryptography::Providers::OpenSSL::DigestAlgorithm;
80 class OpenSSLCryptoParams {
83 OpenSSLCryptoParams (
const function<
void (::EVP_CIPHER_CTX*, Direction d)>& f);
85 OpenSSLCryptoParams (CipherAlgorithm alg,
const BLOB& key,
const BLOB& initialIV);
86 OpenSSLCryptoParams (CipherAlgorithm alg,
const DerivedKey& derivedKey);
89 function<void (::EVP_CIPHER_CTX*, Direction)> fInitializer;
105 namespace OpenSSLInputStream {
108 Streams::InputStream::Ptr<byte> New (
const OpenSSLCryptoParams& cryptoParams, Direction direction,
const Streams::InputStream::Ptr<byte>& realIn);
109 Streams::InputStream::Ptr<byte> New (Execution::InternallySynchronized internallySynchronized,
const OpenSSLCryptoParams& cryptoParams,
110 Direction direction,
const Streams::InputStream::Ptr<byte>& realIn);
129 namespace OpenSSLOutputStream {
133 Streams::OutputStream::Ptr<byte> New (
const OpenSSLCryptoParams& cryptoParams, Direction direction,
134 const Streams::OutputStream::Ptr<byte>& realOut);
135 Streams::OutputStream::Ptr<byte> New (Execution::InternallySynchronized internallySynchronized,
const OpenSSLCryptoParams& cryptoParams,
136 Direction direction,
const Streams::OutputStream::Ptr<byte>& realOut);
148#include "OpenSSLCryptoStream.inl"