E2EE: Key agreement API implementation
[platform/core/test/security-tests.git] / src / ckm / ckm-common.h
index 77631e9..9e9204d 100644 (file)
@@ -28,6 +28,7 @@
 #include <ckm/ckm-manager-async.h>
 #include <ckmc/ckmc-type.h>
 #include <ckmc/ckmc-error.h>
+#include <ckmc/ckmc-manager.h>
 #include <tests_common.h>
 #include <sys/types.h>
 
@@ -218,3 +219,28 @@ void test_no_observer(F&& func, Args... args)
         RUNNER_ASSERT_MSG(false, "Unexpected exception");
     }
 }
+
+class AliasRemover
+{
+public:
+    AliasRemover(const char* alias) : alias(alias) {}
+    ~AliasRemover() {
+        ckmc_remove_alias(alias);
+    }
+
+    AliasRemover(AliasRemover&& other) {
+        alias = other.alias;
+        other.alias = nullptr;
+    }
+
+    AliasRemover& operator=(AliasRemover&& other) {
+        if (&other == this)
+            return *this;
+
+        alias = other.alias;
+        other.alias = nullptr;
+    }
+
+private:
+    const char* alias;
+};