diff options
| author | Per Larsson <[email protected]> | 2022-02-03 13:32:27 +0100 |
|---|---|---|
| committer | Per Larsson <[email protected]> | 2022-02-03 13:32:27 +0100 |
| commit | 1bf13f3c7ac64d44e13de0dcaf51036640232c8f (patch) | |
| tree | a66a643a6d81cb707eec56f87dda4e0fd893cce2 /zenserver/zenserver.cpp | |
| parent | Encrypt serialized auth state. (diff) | |
| download | zen-1bf13f3c7ac64d44e13de0dcaf51036640232c8f.tar.xz zen-1bf13f3c7ac64d44e13de0dcaf51036640232c8f.zip | |
Added AES encryption key/IV cli options.
Diffstat (limited to 'zenserver/zenserver.cpp')
| -rw-r--r-- | zenserver/zenserver.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/zenserver/zenserver.cpp b/zenserver/zenserver.cpp index 6b178ee0c..03d59ba7c 100644 --- a/zenserver/zenserver.cpp +++ b/zenserver/zenserver.cpp @@ -204,7 +204,15 @@ public: m_Http = zen::CreateHttpServer(ServerOptions.HttpServerClass); int EffectiveBasePort = m_Http->Initialize(ServerOptions.BasePort); - m_AuthMgr = MakeAuthMgr({.RootDirectory = m_DataRoot / "auth"}); + AuthEncryptionKey EncryptionKey; + + if (ServerOptions.EncryptionKey.empty() == false && ServerOptions.EncryptionIV.empty() == false) + { + EncryptionKey = AuthEncryptionKey{.Key = IoBufferBuilder::MakeCloneFromMemory(MakeMemoryView(ServerOptions.EncryptionKey)), + .IV = IoBufferBuilder::MakeCloneFromMemory(MakeMemoryView(ServerOptions.EncryptionIV))}; + }; + + m_AuthMgr = MakeAuthMgr({.RootDirectory = m_DataRoot / "auth", .EncryptionKey = EncryptionKey}); m_AuthService = std::make_unique<zen::HttpAuthService>(*m_AuthMgr); m_Http->RegisterService(*m_AuthService); |