Change user type identification from name to uid.
[platform/core/security/key-manager.git] / src / manager / service / ckm-logic.h
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.h
18  * @author      Bartlomiej Grzelewski (b.grzelewski@samsung.com)
19  * @version     1.0
20  * @brief       Sample service implementation.
21  */
22 #pragma once
23
24 #include <string>
25 #include <vector>
26
27 #include <message-buffer.h>
28 #include <protocols.h>
29 #include <ckm/ckm-type.h>
30 #include <connection-info.h>
31
32 namespace CKM {
33
34 class CKMLogic {
35 public:
36     CKMLogic();
37     CKMLogic(const CKMLogic &) = delete;
38     CKMLogic(CKMLogic &&) = delete;
39     CKMLogic& operator=(const CKMLogic &) = delete;
40     CKMLogic& operator=(CKMLogic &&) = delete;
41     virtual ~CKMLogic();
42
43     RawBuffer unlockUserKey(uid_t user, const std::string &password);
44
45     RawBuffer lockUserKey(uid_t user);
46
47     RawBuffer removeUserData(uid_t user);
48
49     RawBuffer changeUserPassword(
50         uid_t user,
51         const std::string &oldPassword,
52         const std::string &newPassword);
53
54     RawBuffer resetUserPassword(
55         uid_t user,
56         const std::string &newPassword);
57
58     RawBuffer saveData(
59         Credentials &cred,
60         int commandId,
61         DBDataType dataType,
62         const Alias &alias,
63         const RawBuffer &key,
64         const PolicySerializable &policy);
65
66     RawBuffer removeData(
67         Credentials &cred,
68         int commandId,
69         DBDataType dataType,
70         const Alias &alias);
71
72     RawBuffer getData(
73         Credentials &cred,
74         int commandId,
75         DBDataType dataType,
76         const Alias &alias,
77         const std::string &password);
78
79     RawBuffer getDataList(
80         Credentials &cred,
81         int commandId,
82         DBDataType dataType);
83         
84     RawBuffer createKeyPairRSA(
85         Credentials &cred,
86         int commandId,
87         int size,
88         const Alias &privateKeyAlias,
89         const Alias &publicKeyAlias,
90         PolicySerializable policyPrivateKey,
91         PolicySerializable policyPublicKey);
92         
93     RawBuffer createKeyPairECDSA(
94         Credentials &cred,
95         int commandId,
96         int type,
97         const Alias &privateKeyAlias,
98         const Alias &publicKeyAlias,
99         PolicySerializable policyPrivateKey,
100         PolicySerializable policyPublicKey);
101
102 private:
103
104 };
105
106 } // namespace CKM
107