--- /dev/null
+/******************************************************************
+ * Copyright 2021 Samsung Electronics All Rights Reserved.
+ *
+ * Author: Tomasz Swierczek <t.swierczek@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************/
+
+#include <string>
+#include <cstring>
+#include <device-certificate-manager-backend/dcm-ext-backend-api.h>
+
+
+int dcm_ext_backend_call_api(const std::string& method_name,
+ const std::string& input_data,
+ std::string& output_data)
+{
+ if(method_name == "square-int-method") {
+ // method expects one int 'x' and returns one int as 'x*x'
+ int x = *((int*) input_data.c_str());
+ x = x * x;
+ output_data.resize(sizeof(int));
+ memcpy(&output_data[0], &x, sizeof(int));
+ return 0;
+ }
+ if(method_name == "method-with-a-privilege-not-granted") {
+ // no-op, implemented just formally
+ return 0;
+ }
+ // no other methods
+ return -1;
+}
+
+int dcm_ext_backend_get_api_privilege(const std::string& method_name,
+ std::string& privilege)
+{
+ if(method_name == "method-with-a-privilege-not-granted") {
+ // this privilege is not granted to any label like User System::Privileged etc.
+ // so API test binary will NOT have it when executed from shell
+ privilege = "http://tizen.org/privilege/internal/sysadmin";
+ return 0;
+ }
+ if(method_name == "square-int-method") {
+ // no privileges here as an example for DCM API that does not require any privilege check
+ privilege = "";
+ return 0;
+ }
+ // no other methods
+ return -1;
+}