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 createKeyPairRSA(
100 const Alias &aliasPrivate,
101 const Alias &alaisPublic,
102 const PolicySerializable &policyPrivate,
103 const PolicySerializable &policyPublic);
105 RawBuffer createKeyPairECDSA(
109 const Alias &aliasPrivate,
110 const Alias &aliasPublic,
111 const PolicySerializable &policyPrivate,
112 const PolicySerializable &policyPublic);
114 RawBuffer getCertificateChain(
117 const RawBuffer &certificate,
118 const RawBufferVector &untrustedCertificates);
120 RawBuffer getCertificateChain(
123 const RawBuffer &certificate,
124 const AliasVector &aliasVector);
126 RawBuffer createSignature(
129 const Alias &privateKeyAlias,
130 const Password &password, // password for private_key
131 const RawBuffer &message,
132 const HashAlgorithm hash,
133 const RSAPaddingAlgorithm padding);
135 RawBuffer verifySignature(
138 const Alias &publicKeyOrCertAlias,
139 const Password &password, // password for public_key (optional)
140 const RawBuffer &message,
141 const RawBuffer &signature,
142 const HashAlgorithm hash,
143 const RSAPaddingAlgorithm padding);
151 const RawBuffer &key,
152 const PolicySerializable &policy);
158 const Password &password,
161 int createKeyPairRSAHelper(
164 const Alias &aliasPrivate,
165 const Alias &aliasPublic,
166 const PolicySerializable &policyPrivate,
167 const PolicySerializable &policyPublic);
169 int createKeyPairECDSAHelper(
172 const Alias &aliasPrivate,
173 const Alias &aliasPublic,
174 const PolicySerializable &policyPrivate,
175 const PolicySerializable &policyPublic);
179 const Alias &publicKeyOrCertAlias,
180 const Password &password, // password for public_key (optional)
181 const KeyImpl &genericKey);
183 std::map<uid_t, UserData> m_userDataMap;
184 CertificateStore m_certStore;