Add support for UserData in client library.
[platform/core/security/key-manager.git] / src / manager / service / ckm-logic.cpp
1 /*
2  *  Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
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
15  *
16  *
17  * @file        ckm-logic.cpp
18  * @author      Bartlomiej Grzelewski (b.grzelewski@samsung.com)
19  * @version     1.0
20  * @brief       Sample service implementation.
21  */
22 #include <ckm/ckm-error.h>
23 #include <ckm/ckm-type.h>
24
25 #include <ckm-logic.h>
26 namespace CKM {
27
28 CKMLogic::CKMLogic(){}
29 CKMLogic::~CKMLogic(){}
30
31 RawBuffer CKMLogic::unlockUserKey(const std::string &user, const RawBuffer &password) {
32     (void)user;
33     (void)password;
34     return RawBuffer();
35 }
36
37 RawBuffer CKMLogic::lockUserKey(const std::string &user) {
38     (void)user;
39     return RawBuffer();
40 }
41
42 RawBuffer CKMLogic::removeUserData(const std::string &user) {
43     (void)user;
44     return RawBuffer();
45 }
46
47 RawBuffer CKMLogic::changeUserPassword(
48     const std::string &user,
49     const RawBuffer &oldPassword,
50     const RawBuffer &newPassword)
51 {
52     (void)user;
53     (void)oldPassword;
54     (void)newPassword;
55     return RawBuffer();
56 }
57
58 RawBuffer CKMLogic::resetUserPassword(
59     const std::string &user,
60     const RawBuffer &newPassword)
61 {
62     (void)user;
63     (void)newPassword;
64     return RawBuffer();
65 }
66
67 RawBuffer CKMLogic::saveData(
68     Credentials &cred,
69     int commandId,
70     DBDataType dataType,
71     const Alias &alias,
72     const RawData &key,
73     const PolicySerializable &policy)
74 {
75     (void)cred;
76     (void)alias;
77     (void)key;
78     (void)policy;
79
80     MessageBuffer response;
81     Serialization::Serialize(response, static_cast<int>(LogicCommand::SAVE));
82     Serialization::Serialize(response, commandId);
83     Serialization::Serialize(response, static_cast<int>(KEY_MANAGER_API_SUCCESS));
84     Serialization::Serialize(response, static_cast<int>(dataType));
85
86     return response.Pop();
87 }
88
89 RawBuffer CKMLogic::removeData(
90     Credentials &cred,
91     int commandId,
92     DBDataType dataType,
93     const Alias &alias)
94 {
95     (void)cred;
96     (void)alias;
97
98     MessageBuffer response;
99     Serialization::Serialize(response, static_cast<int>(LogicCommand::REMOVE));
100     Serialization::Serialize(response, commandId);
101     Serialization::Serialize(response, static_cast<int>(KEY_MANAGER_API_SUCCESS));
102     Serialization::Serialize(response, static_cast<int>(dataType));
103
104     return response.Pop();
105 }
106
107 RawBuffer CKMLogic::getData(
108     Credentials &cred,
109     int commandId,
110     DBDataType dataType,
111     const Alias &alias,
112     const RawData &password)
113 {
114     (void)cred;
115     (void)alias;
116     (void)password;
117
118     MessageBuffer response;
119     Serialization::Serialize(response, static_cast<int>(LogicCommand::GET));
120     Serialization::Serialize(response, commandId);
121     Serialization::Serialize(response, static_cast<int>(KEY_MANAGER_API_SUCCESS));
122     Serialization::Serialize(response, static_cast<int>(dataType));
123     Serialization::Serialize(response, RawData());
124     return response.Pop();
125 }
126
127 } // namespace CKM
128