Stroika Library 3.0d16
 
Loading...
Searching...
No Matches
AES.h
Go to the documentation of this file.
1/*
2 * Copyright(c) Sophist Solutions, Inc. 1990-2025. All rights reserved
3 */
4#ifndef _Stroika_Foundation_Cryptography_AES_h_
5#define _Stroika_Foundation_Cryptography_AES_h_ 1
6
7#include "Stroika/Foundation/StroikaPreComp.h"
8
9#include "Stroika/Foundation/Common/Common.h"
14
15/**
16 * \file
17 *
18 * TODO:
19 * @todo REDO THIS API - USELESS AS IS. Pass in DervivedKey object - but only after I've made it
20 * more portable.
21 *
22 */
23
24namespace Stroika::Foundation::Cryptography::Encoding::Algorithm {
25
26 /**
27 */
28 enum class AESOptions {
29 e128_CBC,
30 e128_ECB,
31 e128_OFB,
32 e128_CFB1,
33 e128_CFB8,
34 e128_CFB128,
35 e192_CBC,
36 e192_ECB,
37 e192_OFB,
38 e192_CFB1,
39 e192_CFB8,
40 e192_CFB128,
41 e256_CBC,
42 e256_ECB,
43 e256_OFB,
44 e256_CFB1,
45 e256_CFB8,
46 e256_CFB128,
47
48 eDEFAULT = e256_CBC,
49
50 Stroika_Define_Enum_Bounds (e128_CBC, e256_CFB128)
51 };
52
53#if qStroika_HasComponent_OpenSSL
54 /**
55 */
56 Streams::InputStream::Ptr<byte> DecodeAES (const Providers::OpenSSL::DerivedKey& key, const Streams::InputStream::Ptr<byte>& in,
57 AESOptions options = AESOptions::eDEFAULT);
58 Memory::BLOB DecodeAES (const Providers::OpenSSL::DerivedKey& key, const Memory::BLOB& in, AESOptions options = AESOptions::eDEFAULT);
59#endif
60
61#if qStroika_HasComponent_OpenSSL
62 /**
63 */
64 Streams::InputStream::Ptr<byte> EncodeAES (const Providers::OpenSSL::DerivedKey& key, const Streams::InputStream::Ptr<byte>& in,
65 AESOptions options = AESOptions::eDEFAULT);
66 Memory::BLOB EncodeAES (const Providers::OpenSSL::DerivedKey& key, const Memory::BLOB& in, AESOptions options = AESOptions::eDEFAULT);
67#endif
68
69#if qStroika_HasComponent_OpenSSL
70 /**
71 * Taken an existing binary output stream, and wrap it with decryption, so that stuff written
72 * to the returned output stream is decrypted before being passed to the argument output stream.
73 */
74 Streams::OutputStream::Ptr<byte> AESDecoder (const Providers::OpenSSL::DerivedKey& key, const Streams::OutputStream::Ptr<byte>& out,
75 AESOptions options = AESOptions::eDEFAULT);
76#endif
77
78#if qStroika_HasComponent_OpenSSL
79 /**
80 * Taken an existing binary output stream, and wrap it with encpytion, so that stuff written
81 * to the returned output stream is encrpted before being passed to the argument output stream.
82 */
83 Streams::OutputStream::Ptr<byte> AESEncoder (const Providers::OpenSSL::DerivedKey& key, const Streams::OutputStream::Ptr<byte>& out,
84 AESOptions options = AESOptions::eDEFAULT);
85#endif
86
87}
88
89/*
90 ********************************************************************************
91 ***************************** Implementation Details ***************************
92 ********************************************************************************
93 */
94
95#endif /*_Stroika_Foundation_Cryptography_AES_h_*/
#define Stroika_Define_Enum_Bounds(FIRST_ITEM, LAST_ITEM)