From b482420d3a2772cdd21cb7b55f118bdc895d66a4 Mon Sep 17 00:00:00 2001 From: Persson-dev Date: Sat, 1 Mar 2025 20:01:05 +0100 Subject: [PATCH] begin ssl support --- include/sp/extensions/Encrypt.h | 41 +++++++++++++++++++++++++++++++++ src/sp/extensions/Encrypt.cpp | 3 +++ xmake.lua | 9 ++++++-- 3 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 include/sp/extensions/Encrypt.h create mode 100644 src/sp/extensions/Encrypt.cpp diff --git a/include/sp/extensions/Encrypt.h b/include/sp/extensions/Encrypt.h new file mode 100644 index 0000000..b7196a0 --- /dev/null +++ b/include/sp/extensions/Encrypt.h @@ -0,0 +1,41 @@ +#pragma once + +/** + * \file Encrypt.h + * \brief File containing encrypt utilities + */ + +#include + +namespace sp { +namespace option { + +struct TlsEncrypt { + bool m_Enabled = true; +}; + +} // namespace option +} // namespace sp + +#include + +namespace sp { +namespace ssl { + +// encrypt + +// decrypt + +} // namespace ssl + +namespace io { + +template <> +class MessageEncapsulator { + public: + static DataBuffer Encapsulate(const DataBuffer& a_Data, const option::TlsEncrypt& a_Option); + static DataBuffer Decapsulate(DataBuffer& a_Data, const option::TlsEncrypt& a_Option); +}; + +} // namespace io +} // namespace sp diff --git a/src/sp/extensions/Encrypt.cpp b/src/sp/extensions/Encrypt.cpp new file mode 100644 index 0000000..6fe75f1 --- /dev/null +++ b/src/sp/extensions/Encrypt.cpp @@ -0,0 +1,3 @@ +#include + +#include \ No newline at end of file diff --git a/xmake.lua b/xmake.lua index 2012f06..1b120b4 100644 --- a/xmake.lua +++ b/xmake.lua @@ -6,9 +6,14 @@ local modules = { Compression = { Option = "zlib", Deps = {"zlib"}, - Packages = {"zlib"}, Includes = {"include/(sp/extensions/Compress.h)"}, Sources = {"src/sp/extensions/Compress.cpp"} + }, + Encryption = { + Option = "ssl", + Deps = {"openssl"}, + Includes = {"include/(sp/extensions/Encrypt.h)"}, + Sources = {"src/sp/extensions/Encrypt.cpp"} } } @@ -37,7 +42,7 @@ for name, module in table.orderpairs(modules) do for _, source in table.orderpairs(module.Sources) do add_files(source) end - for _, package in table.orderpairs(module.Packages) do + for _, package in table.orderpairs(module.Deps) do add_packages(package) end set_group("Library")