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.
27 #include <message-buffer.h>
28 #include <protocols.h>
29 #include <ckm/ckm-type.h>
30 #include <connection-info.h>
31 #include <db-crypto.h>
32 #include <key-provider.h>
33 #include <crypto-logic.h>
34 #include <certificate-store.h>
39 KeyProvider keyProvider;
47 CKMLogic(const CKMLogic &) = delete;
48 CKMLogic(CKMLogic &&) = delete;
49 CKMLogic& operator=(const CKMLogic &) = delete;
50 CKMLogic& operator=(CKMLogic &&) = delete;
53 RawBuffer unlockUserKey(uid_t user, const Password &password);
55 RawBuffer lockUserKey(uid_t user);
57 RawBuffer removeUserData(uid_t user);
59 RawBuffer changeUserPassword(
61 const Password &oldPassword,
62 const Password &newPassword);
64 RawBuffer resetUserPassword(
66 const Password &newPassword);
68 RawBuffer removeApplicationData(const std::string &smackLabel);
76 const PolicySerializable &policy);
89 const Password &password);
91 RawBuffer getDataList(
96 RawBuffer createKeyPair(
98 LogicCommand protocol_cmd,
100 const int additional_param,
101 const Alias &aliasPrivate,
102 const Alias &alaisPublic,
103 const PolicySerializable &policyPrivate,
104 const PolicySerializable &policyPublic);
106 RawBuffer getCertificateChain(
109 const RawBuffer &certificate,
110 const RawBufferVector &untrustedCertificates);
112 RawBuffer getCertificateChain(
115 const RawBuffer &certificate,
116 const AliasVector &aliasVector);
118 RawBuffer createSignature(
121 const Alias &privateKeyAlias,
122 const Password &password, // password for private_key
123 const RawBuffer &message,
124 const HashAlgorithm hash,
125 const RSAPaddingAlgorithm padding);
127 RawBuffer verifySignature(
130 const Alias &publicKeyOrCertAlias,
131 const Password &password, // password for public_key (optional)
132 const RawBuffer &message,
133 const RawBuffer &signature,
134 const HashAlgorithm hash,
135 const RSAPaddingAlgorithm padding);
137 RawBuffer setCCModeStatus(CCModeState mode_status);
139 RawBuffer allowAccess(
143 const Alias &item_alias,
144 const std::string &accessor_label,
145 const AccessRight req_rights);
147 RawBuffer denyAccess(
151 const Alias &item_alias,
152 const std::string &accessor_label);
160 const RawBuffer &key,
161 const PolicySerializable &policy);
167 const Password &password,
170 int createKeyPairHelper(
172 const KeyType key_type,
173 const int additional_param,
174 const Alias &aliasPrivate,
175 const Alias &aliasPublic,
176 const PolicySerializable &policyPrivate,
177 const PolicySerializable &policyPublic);
181 const Alias &publicKeyOrCertAlias,
182 const Password &password, // password for public_key (optional)
183 const KeyImpl &genericKey);
185 std::map<uid_t, UserData> m_userDataMap;
186 CertificateStore m_certStore;
187 CCModeState cc_mode_status;