summaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2020-06-14 22:54:42 +0200
committerlouiz’ <louiz@louiz.org>2020-06-15 00:18:51 +0200
commit2e1ddeb6547e140e9651231fedcd00e8ee4b1ccd (patch)
tree8b61842eaa892fde2b5679672de572a9ff7a4e47 /src/utils
parent655bc344d47bc79e500a351c2953f6b5003f40ec (diff)
downloadbiboumi-2e1ddeb6547e140e9651231fedcd00e8ee4b1ccd.tar.gz
biboumi-2e1ddeb6547e140e9651231fedcd00e8ee4b1ccd.tar.bz2
biboumi-2e1ddeb6547e140e9651231fedcd00e8ee4b1ccd.tar.xz
biboumi-2e1ddeb6547e140e9651231fedcd00e8ee4b1ccd.zip
Implement SASL plain authentication
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/base64.cpp19
-rw-r--r--src/utils/base64.hpp10
2 files changed, 29 insertions, 0 deletions
diff --git a/src/utils/base64.cpp b/src/utils/base64.cpp
new file mode 100644
index 0000000..350e2db
--- /dev/null
+++ b/src/utils/base64.cpp
@@ -0,0 +1,19 @@
+#include <utils/base64.hpp>
+
+#ifdef BOTAN_FOUND
+#include <botan/base64.h>
+#endif
+
+namespace base64
+{
+
+std::string encode(const std::string &input)
+{
+#ifdef BOTAN_FOUND
+ return Botan::base64_encode(reinterpret_cast<const uint8_t*>(input.data()), input.size());
+#else
+#error "base64::encode() not yet implemented without Botan."
+#endif
+}
+
+}
diff --git a/src/utils/base64.hpp b/src/utils/base64.hpp
new file mode 100644
index 0000000..1dd4a4d
--- /dev/null
+++ b/src/utils/base64.hpp
@@ -0,0 +1,10 @@
+#pragma once
+
+#include "biboumi.h"
+
+#include <string>
+
+namespace base64
+{
+std::string encode(const std::string& input);
+}