2 * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License
18 * @author Bartlomiej Grzelewski (b.grzelewski@samsung.com)
20 * @brief Sample service implementation.
22 #include <dpl/serialization.h>
24 #include <ckm/ckm-error.h>
25 #include <ckm/ckm-type.h>
27 #include <ckm-logic.h>
30 CKMLogic::CKMLogic(){}
31 CKMLogic::~CKMLogic(){}
33 RawBuffer CKMLogic::unlockUserKey(const std::string &user, const std::string &password) {
37 MessageBuffer response;
38 Serialization::Serialize(response, static_cast<int>(KEY_MANAGER_API_SUCCESS));
39 return response.Pop();
42 RawBuffer CKMLogic::lockUserKey(const std::string &user) {
45 MessageBuffer response;
46 Serialization::Serialize(response, static_cast<int>(KEY_MANAGER_API_SUCCESS));
47 return response.Pop();
50 RawBuffer CKMLogic::removeUserData(const std::string &user) {
53 MessageBuffer response;
54 Serialization::Serialize(response, static_cast<int>(KEY_MANAGER_API_SUCCESS));
55 return response.Pop();
58 RawBuffer CKMLogic::changeUserPassword(
59 const std::string &user,
60 const std::string &oldPassword,
61 const std::string &newPassword)
67 MessageBuffer response;
68 Serialization::Serialize(response, static_cast<int>(KEY_MANAGER_API_SUCCESS));
69 return response.Pop();
72 RawBuffer CKMLogic::resetUserPassword(
73 const std::string &user,
74 const std::string &newPassword)
79 MessageBuffer response;
80 Serialization::Serialize(response, static_cast<int>(KEY_MANAGER_API_SUCCESS));
81 return response.Pop();
84 RawBuffer CKMLogic::saveData(
90 const PolicySerializable &policy)
97 MessageBuffer response;
98 Serialization::Serialize(response, static_cast<int>(LogicCommand::SAVE));
99 Serialization::Serialize(response, commandId);
100 Serialization::Serialize(response, static_cast<int>(KEY_MANAGER_API_SUCCESS));
101 Serialization::Serialize(response, static_cast<int>(dataType));
103 return response.Pop();
106 RawBuffer CKMLogic::removeData(
115 MessageBuffer response;
116 Serialization::Serialize(response, static_cast<int>(LogicCommand::REMOVE));
117 Serialization::Serialize(response, commandId);
118 Serialization::Serialize(response, static_cast<int>(KEY_MANAGER_API_SUCCESS));
119 Serialization::Serialize(response, static_cast<int>(dataType));
121 return response.Pop();
124 RawBuffer CKMLogic::getData(
129 const std::string &password)
135 MessageBuffer response;
136 Serialization::Serialize(response, static_cast<int>(LogicCommand::GET));
137 Serialization::Serialize(response, commandId);
138 Serialization::Serialize(response, static_cast<int>(KEY_MANAGER_API_SUCCESS));
139 Serialization::Serialize(response, static_cast<int>(dataType));
140 Serialization::Serialize(response, RawBuffer());
141 return response.Pop();