4#include "Stroika/Foundation/StroikaPreComp.h"
14using namespace Stroika::Foundation::Cryptography;
15using namespace Stroika::Foundation::Cryptography::Providers;
16using namespace Stroika::Foundation::Cryptography::Encoding;
17using namespace Stroika::Foundation::Cryptography::Encoding::Algorithm;
18#if qStroika_HasComponent_OpenSSL
19using namespace Stroika::Foundation::Cryptography::Providers::OpenSSL;
21using namespace Stroika::Foundation::Streams;
25#if qStroika_HasComponent_OpenSSL
27 OpenSSLCryptoParams cvt_ (
const OpenSSL::DerivedKey& key, AESOptions options)
30 case AESOptions::e128_CBC:
31 return OpenSSLCryptoParams{CipherAlgorithms::kAES_128_CBC, key};
32 case AESOptions::e128_ECB:
33 return OpenSSLCryptoParams{CipherAlgorithms::kAES_128_ECB, key};
34 case AESOptions::e128_OFB:
35 return OpenSSLCryptoParams{CipherAlgorithms::kAES_128_OFB, key};
36 case AESOptions::e128_CFB1:
37 return OpenSSLCryptoParams{CipherAlgorithms::kAES_128_CFB1, key};
38 case AESOptions::e128_CFB8:
39 return OpenSSLCryptoParams{CipherAlgorithms::kAES_128_CFB8, key};
40 case AESOptions::e128_CFB128:
41 return OpenSSLCryptoParams{CipherAlgorithms::kAES_128_CFB128, key};
42 case AESOptions::e192_CBC:
43 return OpenSSLCryptoParams{CipherAlgorithms::kAES_192_CBC, key};
44 case AESOptions::e192_ECB:
45 return OpenSSLCryptoParams{CipherAlgorithms::kAES_192_ECB, key};
46 case AESOptions::e192_OFB:
47 return OpenSSLCryptoParams{CipherAlgorithms::kAES_192_OFB, key};
48 case AESOptions::e192_CFB1:
49 return OpenSSLCryptoParams{CipherAlgorithms::kAES_192_CFB1, key};
50 case AESOptions::e192_CFB8:
51 return OpenSSLCryptoParams{CipherAlgorithms::kAES_192_CFB8, key};
52 case AESOptions::e192_CFB128:
53 return OpenSSLCryptoParams{CipherAlgorithms::kAES_192_CFB128, key};
54 case AESOptions::e256_CBC:
55 return OpenSSLCryptoParams{CipherAlgorithms::kAES_256_CBC, key};
56 case AESOptions::e256_ECB:
57 return OpenSSLCryptoParams{CipherAlgorithms::kAES_256_ECB, key};
58 case AESOptions::e256_OFB:
59 return OpenSSLCryptoParams{CipherAlgorithms::kAES_256_OFB, key};
60 case AESOptions::e256_CFB1:
61 return OpenSSLCryptoParams{CipherAlgorithms::kAES_256_CFB1, key};
62 case AESOptions::e256_CFB8:
63 return OpenSSLCryptoParams{CipherAlgorithms::kAES_256_CFB8, key};
64 case AESOptions::e256_CFB128:
65 return OpenSSLCryptoParams{CipherAlgorithms::kAES_256_CFB128, key};
68 return OpenSSLCryptoParams{CipherAlgorithms::kAES_256_CFB128, key};
74#if qStroika_HasComponent_OpenSSL
82 return OpenSSLInputStream::New (cvt_ (key, options), Direction::eDecrypt, in);
90#if qStroika_HasComponent_OpenSSL
98 return OpenSSLInputStream::New (cvt_ (key, options), Direction::eEncrypt, in);
106#if qStroika_HasComponent_OpenSSL
114 return OpenSSLOutputStream::New (cvt_ (key, options), Direction::eDecrypt, out);
118#if qStroika_HasComponent_OpenSSL
126 return OpenSSLOutputStream::New (cvt_ (key, options), Direction::eEncrypt, out);
#define RequireNotReached()
OutputStream<>::Ptr is Smart pointer to a stream-based sink of data.