2 * Copyright (c) 2000 - 2015 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
17 * @file ckmc-manager.h
19 * @brief Provides management functions(storing, retrieving, and removing) for keys,
20 * certificates and data of a user and additional crypto functions.
24 #ifndef __TIZEN_CORE_CKMC_MANAGER_H
25 #define __TIZEN_CORE_CKMC_MANAGER_H
29 #include <sys/types.h>
31 #include <ckmc/ckmc-type.h>
32 #include <ckmc/ckmc-error.h>
41 * @addtogroup CAPI_KEY_MANAGER_CLIENT_MODULE
47 * @brief Stores a key inside key manager based on the provided policy.
49 * @remarks %http://tizen.org/privilege/keymanager (public level privilege) is no longer required to use this API since 3.0.
50 * @remarks Currently API supports seven types of keys. These are RSA public/private key, DSA public/private key, ECDSA public/private key, and AES symmetric key.
51 * @remarks key_type in key may be set to #CKMC_KEY_NONE as an input. key_type is determined inside key manager during storing keys.
52 * @remarks Some private key files are protected by a password. If raw_key in key read from those encrypted files is encrypted with a password, the password should be provided in the #ckmc_key_s structure.
53 * @remarks If password in policy is provided, the key is additionally encrypted with the password in the policy.
54 * @param[in] alias The name of a key to be stored
55 * @param[in] key The key's binary value to be stored
56 * @param[in] policy The policy about how to store a key securely
57 * @return @c 0 on success,
58 * otherwise a negative error value
59 * @retval #CKMC_ERROR_NONE Successful
60 * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
61 * @retval #CKMC_ERROR_DB_LOCKED A user key is not loaded in memory (a user is not logged in)
62 * @retval #CKMC_ERROR_DB_ALIAS_EXISTS Alias already exists
63 * @retval #CKMC_ERROR_INVALID_FORMAT The format of raw_key is not valid
64 * @retval #CKMC_ERROR_DB_ERROR Failed due to a database error
65 * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
66 * @pre User is already logged in and the user key is already loaded into memory in plain text form.
67 * @see ckmc_remove_alias()
69 * @see ckmc_get_key_alias_list()
73 int ckmc_save_key(const char *alias, const ckmc_key_s key, const ckmc_policy_s policy);
77 * @deprecated Deprecated since @if MOBILE 2.4. @elseif WEARABLE 3.0. @endif [Use ckmc_remove_alias() instead]
78 * @brief Removes a key from key manager.
80 * @remarks %http://tizen.org/privilege/keymanager (public level privilege) is no longer required to use this API since 3.0.
81 * @remarks To remove key, client must have remove permission to the specified key.
82 * @remarks The key owner can remove by default.
83 * @param[in] alias The name of a key to be removed
84 * @return @c 0 on success,
85 * otherwise a negative error value
86 * @retval #CKMC_ERROR_NONE Successful
87 * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
88 * @retval #CKMC_ERROR_DB_LOCKED A user key is not loaded in memory (a user is not logged in)
89 * @retval #CKMC_ERROR_DB_ERROR Failed due to a database error
90 * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN Alias does not exist
91 * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
92 * @pre User is already logged in and the user key is already loaded into memory in plain text form.
93 * @see ckmc_save_key()
95 * @see ckmc_get_key_alias_list()
97 int ckmc_remove_key(const char *alias)
102 * @brief Gets a key from key manager.
104 * @remarks %http://tizen.org/privilege/keymanager (public level privilege) is no longer required to use this API since 3.0.
105 * @remarks A client can access only data stored by the client.
106 * @remarks You must destroy the newly created @a ppkey by calling ckmc_key_free() if it is no longer needed.
107 * @param[in] alias The name of a key to retrieve
108 * @param[in] password The password used in decrypting a key value \n
109 * If password of policy is provided in ckmc_save_key(), the same password should be provided
110 * @param[out] ppkey The pointer to a newly created ckmc_key_s handle
111 * @return @c 0 on success,
112 * otherwise a negative error value
113 * @retval #CKMC_ERROR_NONE Successful
114 * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
115 * @retval #CKMC_ERROR_DB_LOCKED A user key is not loaded in memory (a user is not logged in)
116 * @retval #CKMC_ERROR_DB_ERROR Failed due to a database error
117 * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN Alias does not exist
118 * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
119 * @retval #CKMC_ERROR_AUTHENTICATION_FAILED Decryption failed because password is incorrect
120 * @pre User is already logged in and the user key is already loaded into memory in plain text form.
121 * @see ckmc_save_key()
122 * @see ckmc_remove_alias()
123 * @see ckmc_get_key_alias_list()
125 int ckmc_get_key(const char *alias, const char *password, ckmc_key_s **ppkey);
129 * @brief Gets all the alias of keys that the client can access.
131 * @remarks %http://tizen.org/privilege/keymanager (public level privilege) is no longer required to use this API since 3.0.
132 * @remarks A client can access only data stored by the client.
133 * @remarks You must destroy the newly created @a ppalias_list by calling ckmc_alias_list_all_free()
134 * if it is no longer needed.
135 * @param[out] ppalias_list The pointer to a newly created ckmc_alias_list_s handle containing all
136 * available alias of keys \n
137 * If there is no available key alias, *ppalias_list will be null
138 * @return @c 0 on success,
139 * otherwise a negative error value
140 * @retval #CKMC_ERROR_NONE Successful
141 * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
142 * @retval #CKMC_ERROR_DB_LOCKED A user key is not loaded in memory (a user is not logged in)
143 * @retval #CKMC_ERROR_DB_ERROR Failed due to a database error
144 * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN Alias does not exist
145 * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
146 * @pre User is already logged in and the user key is already loaded into memory in plain text form.
147 * @see ckmc_save_key()
148 * @see ckmc_remove_alias()
149 * @see ckmc_get_key()
151 int ckmc_get_key_alias_list(ckmc_alias_list_s **ppalias_list);
156 * @brief Stores a certificate inside key manager based on the provided policy.
158 * @remarks %http://tizen.org/privilege/keymanager (public level privilege) is no longer required to use this API since 3.0
159 * @remarks The certificate's binary value will be converted and saved as binary DER encoded certificates.
160 * @param[in] alias The name of a certificate to be stored
161 * @param[in] cert The certificate's binary value to be stored
162 * @param[in] policy The policy about how to store a certificate securely
163 * @return @c 0 on success,
164 * otherwise a negative error value
165 * @retval #CKMC_ERROR_NONE Successful
166 * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
167 * @retval #CKMC_ERROR_DB_LOCKED A user key is not loaded in memory (a user is not logged in)
168 * @retval #CKMC_ERROR_DB_ALIAS_EXISTS Alias already exists
169 * @retval #CKMC_ERROR_INVALID_FORMAT The format of raw_cert is not valid
170 * @retval #CKMC_ERROR_DB_ERROR Failed due to a database error
171 * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
172 * @pre User is already logged in and the user key is already loaded into memory in plain text form.
173 * @see ckmc_remove_alias()
174 * @see ckmc_get_cert()
175 * @see ckmc_get_cert_alias_list()
177 * @see #ckmc_policy_s
179 int ckmc_save_cert(const char *alias, const ckmc_cert_s cert, const ckmc_policy_s policy);
183 * @deprecated Deprecated since @if MOBILE 2.4. @elseif WEARABLE 3.0. @endif [Use ckmc_remove_alias() instead]
184 * @brief Removes a certificate from key manager.
186 * @remarks %http://tizen.org/privilege/keymanager (public level privilege) is no longer required to use this API since 3.0.
187 * @remarks To remove certificate, client must have remove permission to the specified certificate.
188 * @remarks The key owner can remove by default.
189 * @param[in] alias The name of a certificate to be removed
190 * @return @c 0 on success,
191 * otherwise a negative error value
192 * @retval #CKMC_ERROR_NONE Successful
193 * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
194 * @retval #CKMC_ERROR_DB_LOCKED A user key is not loaded in memory (a user is not logged in)
195 * @retval #CKMC_ERROR_DB_ERROR Failed due to a database error
196 * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN Alias does not exist
197 * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
198 * @pre User is already logged in and the user key is already loaded into memory in plain text form.
199 * @see ckmc_save_cert()
200 * @see ckmc_get_cert()
201 * @see ckmc_get_cert_alias_list()
203 int ckmc_remove_cert(const char *alias)
204 TIZEN_DEPRECATED_API;
208 * @brief Gets a certificate from key manager.
210 * @remarks %http://tizen.org/privilege/keymanager (public level privilege) is no longer required to use this API since 3.0.
211 * @remarks A client can access only certificate stored by the client.
212 * @remarks A DER encoded certificate will be returned as a return value.
213 * @remarks You must destroy the newly created @a ppcert by calling ckmc_cert_free() if it is no longer needed.
214 * @param[in] alias The name of a certificate to retrieve
215 * @param[in] password The password used in decrypting a certificate value \n
216 * If password of policy is provided in ckmc_save_cert(), the same password
218 * @param[out] ppcert The pointer to a newly created ckmc_cert_s handle
219 * @return @c 0 on success,
220 * otherwise a negative error value
221 * @retval #CKMC_ERROR_NONE Successful
222 * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
223 * @retval #CKMC_ERROR_DB_LOCKED A user key is not loaded in memory (a user is not logged in)
224 * @retval #CKMC_ERROR_DB_ERROR Failed due to a database error
225 * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN Alias does not exists
226 * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
227 * @retval #CKMC_ERROR_AUTHENTICATION_FAILED Decryption failed because password is incorrect
228 * @pre User is already logged in and the user key is already loaded into memory in plain text form.
229 * @see ckmc_save_cert()
230 * @see ckmc_remove_alias()
231 * @see ckmc_get_cert_alias_list()
233 int ckmc_get_cert(const char *alias, const char *password, ckmc_cert_s **ppcert);
237 * @brief Gets all alias of certificates which the client can access.
239 * @remarks %http://tizen.org/privilege/keymanager (public level privilege) is no longer required to use this API since 3.0.
240 * @remarks A client can access only data stored by the client.
241 * @remarks You must destroy the newly created @a ppalias_list by calling ckmc_alias_list_all_free() if it is no longer needed.
242 * @param[out] ppalias_list The pointer to a newly created ckmc_alias_list_s handle containing all available alias of keys \n
243 * If there is no available key alias, *ppalias_list will be null
244 * @return @c 0 on success,
245 * otherwise a negative error value
246 * @retval #CKMC_ERROR_NONE Successful
247 * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
248 * @retval #CKMC_ERROR_DB_LOCKED A user key is not loaded in memory (a user is not logged in)
249 * @retval #CKMC_ERROR_DB_ERROR Failed due to a database error
250 * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN Alias does not exist
251 * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
252 * @pre User is already logged in and the user key is already loaded into memory in plain text form.
253 * @see ckmc_save_cert()
254 * @see ckmc_remove_alias()
255 * @see ckmc_get_cert()
257 int ckmc_get_cert_alias_list(ckmc_alias_list_s **ppalias_list);
261 * @brief Stores PKCS12's contents inside key manager based on the provided policies. All items from the PKCS12 will use the same alias.
262 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
263 * @remarks %http://tizen.org/privilege/keymanager (public level privilege) is no longer required to use this API since 3.0.
264 * @param[in] alias The name of a data to be stored
265 * @param[in] pkcs Pointer to the pkcs12 structure to be saved
266 * @param[in] key_policy The policy about how to store pkcs's private key
267 * @param[in] cert_policy The policy about how to store pkcs's certificate
268 * @return @c 0 on success,
269 * otherwise a negative error value
270 * @retval #CKMC_ERROR_NONE Successful
271 * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
272 * @retval #CKMC_ERROR_DB_LOCKED A user key is not loaded in memory (a user is not logged in)
273 * @retval #CKMC_ERROR_DB_ALIAS_EXISTS Alias already exists
274 * @retval #CKMC_ERROR_DB_ERROR Failed due to a database error
275 * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
276 * @pre User is already logged in and the user key is already loaded into memory in plain text form.
277 * @see ckmc_remove_alias()
278 * @see ckmc_get_pkcs12()
279 * @see ckmc_get_data_alias_list()
280 * @see ckmc_pkcs12_load()
281 * @see #ckmc_pkcs12_s
282 * @see #ckmc_policy_s
284 int ckmc_save_pkcs12(const char *alias, const ckmc_pkcs12_s *pkcs, const ckmc_policy_s key_policy,const ckmc_policy_s cert_policy);
288 * @brief Gets a pkcs12 from key manager.
289 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
290 * @remarks %http://tizen.org/privilege/keymanager (public level privilege) is no longer required to use this API since 3.0.
291 * @remarks A client can access only data stored by the client.
292 * @remarks You must destroy the newly created @a pkcs12 by calling ckmc_pkcs12_free() if it is no longer needed.
293 * @param[in] alias The name of a data to retrieve
294 * @param[in] key_password Password that was used to encrypt privateKey (may be NULL)
295 * @param[in] cert_password Password used to encrypt certificates (may be NULL)
296 * @param[out] pkcs12 The pointer to a newly created ckmc_pkcs12_s handle
297 * @return @c 0 on success,
298 * otherwise a negative error value
299 * @retval #CKMC_ERROR_NONE Successful
300 * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
301 * @retval #CKMC_ERROR_DB_LOCKED A user key is not loaded in memory (a user is not logged in)
302 * @retval #CKMC_ERROR_DB_ERROR Failed due to a database error
303 * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN Alias does not exist
304 * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
305 * @retval #CKMC_ERROR_AUTHENTICATION_FAILED key_password or cert_password does not match with password used to encrypt data
306 * @pre User is already logged in and the user key is already loaded into memory in plain text form.
307 * @see ckmc_save_pkcs12()
308 * @see ckmc_remove_alias()
310 int ckmc_get_pkcs12(const char *alias, const char *key_password, const char *cert_password, ckmc_pkcs12_s **pkcs12);
314 * @brief Stores a data inside key manager based on the provided policy.
316 * @remarks %http://tizen.org/privilege/keymanager (public level privilege) is no longer required to use this API since 3.0.
317 * @param[in] alias The name of a data to be stored
318 * @param[in] data The binary value to be stored
319 * @param[in] policy The policy about how to store a data securely
320 * @return @c 0 on success,
321 * otherwise a negative error value
322 * @retval #CKMC_ERROR_NONE Successful
323 * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
324 * @retval #CKMC_ERROR_DB_LOCKED A user key is not loaded in memory (a user is not logged in)
325 * @retval #CKMC_ERROR_DB_ALIAS_EXISTS Alias already exists
326 * @retval #CKMC_ERROR_DB_ERROR Failed due to a database error
327 * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
328 * @pre User is already logged in and the user key is already loaded into memory in plain text form.
329 * @see ckmc_remove_alias()
330 * @see ckmc_get_data()
331 * @see ckmc_get_data_alias_list()
332 * @see #ckmc_raw_buffer_s
333 * @see #ckmc_policy_s
335 int ckmc_save_data(const char *alias, ckmc_raw_buffer_s data, const ckmc_policy_s policy);
339 * @deprecated Deprecated since @if MOBILE 2.4. @elseif WEARABLE 3.0. @endif [Use ckmc_remove_alias() instead]
340 * @brief Removes a data from key manager.
342 * @remarks %http://tizen.org/privilege/keymanager (public level privilege) is no longer required to use this API since 3.0.
343 * @remarks To remove data, client must have remove permission to the specified data object.
344 * @remarks The data owner can remove by default.
345 * @param[in] alias The name of a data to be removed
346 * @return @c 0 on success,
347 * otherwise a negative error value
348 * @retval #CKMC_ERROR_NONE Successful
349 * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
350 * @retval #CKMC_ERROR_DB_LOCKED A user key is not loaded in memory (a user is not logged in)
351 * @retval #CKMC_ERROR_DB_ERROR Failed due to the error with unknown reason
352 * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN Alias does not exist
353 * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
354 * @pre User is already logged in and the user key is already loaded into memory in plain text form.
355 * @see ckmc_save_data()
356 * @see ckmc_get_data()
357 * @see ckmc_get_data_alias_list()
359 int ckmc_remove_data(const char *alias)
360 TIZEN_DEPRECATED_API;
364 * @brief Gets a data from key manager.
366 * @remarks %http://tizen.org/privilege/keymanager (public level privilege) is no longer required to use this API since 3.0.
367 * @remarks A client can access only data stored by the client.
368 * @remarks You must destroy the newly created @a ppdata by calling ckmc_buffer_free() if it is no longer needed.
369 * @param[in] alias The name of a data to retrieve
370 * @param[in] password The password used in decrypting a data value \n
371 * If password of policy is provided in ckmc_save_data(), the same password
373 * @param[out] ppdata The pointer to a newly created ckmc_raw_buffer_s handle
374 * @return @c 0 on success,
375 * otherwise a negative error value
376 * @retval #CKMC_ERROR_NONE Successful
377 * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
378 * @retval #CKMC_ERROR_DB_LOCKED A user key is not loaded in memory (a user is not logged in)
379 * @retval #CKMC_ERROR_DB_ERROR Failed due to the error with unknown reason
380 * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN Alias does not exist
381 * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
382 * @retval #CKMC_ERROR_AUTHENTICATION_FAILED Decryption failed because password is incorrect
383 * @pre User is already logged in and the user key is already loaded into memory in plain text form.
384 * @see ckmc_save_data()
385 * @see ckmc_remove_alias()
386 * @see ckmc_get_data_alias_list()
388 int ckmc_get_data(const char *alias, const char *password, ckmc_raw_buffer_s **ppdata);
392 * @brief Gets all alias of data which the client can access.
394 * @remarks %http://tizen.org/privilege/keymanager (public level privilege) is no longer required to use this API since 3.0.
395 * @remarks A client can access only data stored by the client.
396 * @remarks You must destroy the newly created @a ppalias_list by calling ckmc_alias_list_all_free() if it is no longer needed.
397 * @param[out] ppalias_list The pointer to a newly created ckmc_alias_list_s handle containing all available alias of keys \n
398 * If there is no available key alias, *ppalias_list will be null
399 * @return @c 0 on success,
400 * otherwise a negative error value
401 * @retval #CKMC_ERROR_NONE Successful
402 * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
403 * @retval #CKMC_ERROR_DB_LOCKED A user key is not loaded in memory (a user is not logged in)
404 * @retval #CKMC_ERROR_DB_ERROR Failed due to the error with unknown reason
405 * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN Alias does not exist
406 * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
407 * @pre User is already logged in and the user key is already loaded into memory in plain text form.
408 * @see ckmc_save_data()
409 * @see ckmc_remove_alias()
410 * @see ckmc_get_data()
412 int ckmc_get_data_alias_list(ckmc_alias_list_s **ppalias_list);
416 * @brief Creates RSA private/public key pair and stores them inside key manager based on each policy.
418 * @remarks %http://tizen.org/privilege/keymanager (public level privilege) is no longer required to use this API since 3.0.
419 * @remarks If password in the policy is provided, the key is additionally encrypted with the password in the policy.
420 * @param[in] size The size of key strength to be created \n
421 * @c 1024, @c 2048, and @c 4096 are supported
422 * @param[in] private_key_alias The name of private key to be stored
423 * @param[in] public_key_alias The name of public key to be stored
424 * @param[in] policy_private_key The policy about how to store a private key securely
425 * @param[in] policy_public_key The policy about how to store a public key securely
426 * @return @c 0 on success,
427 * otherwise a negative error value
428 * @retval #CKMC_ERROR_NONE Successful
429 * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
430 * @retval #CKMC_ERROR_DB_LOCKED A user key is not loaded in memory (a user is not logged in)
431 * @retval #CKMC_ERROR_DB_ALIAS_EXISTS Alias already exists
432 * @retval #CKMC_ERROR_DB_ERROR Failed due to other DB transaction unexpectedly
433 * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
434 * @pre User is already logged in and the user key is already loaded into memory in plain text form.
435 * @see ckmc_create_key_pair_dsa()
436 * @see ckmc_create_key_pair_ecdsa()
437 * @see ckmc_create_signature()
438 * @see ckmc_verify_signature()
440 int ckmc_create_key_pair_rsa(const size_t size, const char *private_key_alias, const char *public_key_alias, const ckmc_policy_s policy_private_key, const ckmc_policy_s policy_public_key);
444 * @brief Creates DSA private/public key pair and stores them inside key manager based on each policy.
446 * @remarks %http://tizen.org/privilege/keymanager (public level privilege) is no longer required to use this API since 3.0.
447 * @remarks If password in the policy is provided, the key is additionally encrypted with the password in the policy.
448 * @param[in] size The size of key strength to be created \n
449 * @c 1024, @c 2048, @c 3072 and @c 4096 are supported
450 * @param[in] private_key_alias The name of private key to be stored
451 * @param[in] public_key_alias The name of public key to be stored
452 * @param[in] policy_private_key The policy about how to store a private key securely
453 * @param[in] policy_public_key The policy about how to store a public key securely
454 * @return @c 0 on success,
455 * otherwise a negative error value
456 * @retval #CKMC_ERROR_NONE Successful
457 * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
458 * @retval #CKMC_ERROR_DB_LOCKED A user key is not loaded in memory (a user is not logged in)
459 * @retval #CKMC_ERROR_DB_ALIAS_EXISTS Alias already exists
460 * @retval #CKMC_ERROR_DB_ERROR Failed due to other DB transaction unexpectedly
461 * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
462 * @pre User is already logged in and the user key is already loaded into memory in plain text form.
463 * @see ckmc_create_key_pair_rsa()
464 * @see ckmc_create_key_pair_ecdsa()
465 * @see ckmc_create_signature()
466 * @see ckmc_verify_signature()
468 int ckmc_create_key_pair_dsa(const size_t size, const char *private_key_alias, const char *public_key_alias, const ckmc_policy_s policy_private_key, const ckmc_policy_s policy_public_key);
472 * @brief Creates ECDSA private/public key pair and stores them inside key manager based on each policy.
474 * @remarks %http://tizen.org/privilege/keymanager (public level privilege) is no longer required to use this API since 3.0.
475 * @remarks If password in the policy is provided, the key is additionally encrypted with the password in the policy.
476 * @param[in] type The type of elliptic curve of ECDSA
477 * @param[in] private_key_alias The name of private key to be stored
478 * @param[in] public_key_alias The name of public key to be stored
479 * @param[in] policy_private_key The policy about how to store a private key securely
480 * @param[in] policy_public_key The policy about how to store a public key securely
481 * @return @c 0 on success,
482 * otherwise a negative error value
483 * @retval #CKMC_ERROR_NONE Successful
484 * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
485 * @retval #CKMC_ERROR_DB_LOCKED A user key is not loaded in memory (a user is not logged in)
486 * @retval #CKMC_ERROR_DB_ALIAS_EXISTS Alias already exists
487 * @retval #CKMC_ERROR_DB_ERROR Failed due to other DB transaction unexpectedly
488 * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
489 * @pre User is already logged in and the user key is already loaded into memory in plain text form.
490 * @see ckmc_create_key_pair_rsa()
491 * @see ckmc_create_key_pair_dsa()
492 * @see ckmc_create_signature()
493 * @see ckmc_verify_signature()
494 * @see #ckmc_ec_type_e
496 int ckmc_create_key_pair_ecdsa(const ckmc_ec_type_e type, const char *private_key_alias, const char *public_key_alias, const ckmc_policy_s policy_private_key, const ckmc_policy_s policy_public_key);
500 * @brief Creates AES key and stores it inside key manager based on the policy.
502 * @remarks If password in the policy is provided, the key is additionally encrypted with the password in the policy.
503 * @param[in] size The size of key strength to be created \n
504 * @c 128, @c 192 and @c 256 are supported
505 * @param[in] key_alias The name of key to be stored
506 * @param[in] key_policy The policy about how to store the key securely
507 * @return @c 0 on success,
508 * otherwise a negative error value
509 * @retval #CKMC_ERROR_NONE Successful
510 * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
511 * @retval #CKMC_ERROR_DB_LOCKED A user key is not loaded in memory (a user is not logged in)
512 * @retval #CKMC_ERROR_DB_ALIAS_EXISTS Alias already exists
513 * @retval #CKMC_ERROR_DB_ERROR Failed due to other DB transaction unexpectedly
514 * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
515 * @pre User is already logged in and the user key is already loaded into memory in plain text form.
516 * @see ckmc_create_key_pair_rsa()
517 * @see ckmc_create_key_pair_dsa()
518 * @see ckmc_create_key_pair_ecdsa()
519 * @see #ckmc_policy_s
521 int ckmc_create_key_aes(size_t size, const char *key_alias, ckmc_policy_s key_policy);
525 * @brief Creates a signature on a given message using a private key and returns the signature.
527 * @remarks %http://tizen.org/privilege/keymanager (public level privilege) is no longer required to use this API since 3.0.
528 * @remarks If password of policy is provided during storing a key, the same password should be provided.
529 * @remarks You must destroy the newly created @a ppsignature by calling ckmc_buffer_free() if it is no longer needed.
530 * @param[in] private_key_alias The name of private key
531 * @param[in] password The password used in decrypting a private key value
532 * @param[in] message The message that is signed with a private key
533 * @param[in] hash The hash algorithm used in creating signature
534 * @param[in] padding The RSA padding algorithm used in creating signature \n
535 * It is used only when the signature algorithm is RSA
536 * @param[out] ppsignature The pointer to a newly created signature \n
537 * If an error occurs, @a *ppsignature will be null
538 * @return @c 0 on success,
539 * otherwise a negative error value
540 * @retval #CKMC_ERROR_NONE Successful
541 * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
542 * @retval #CKMC_ERROR_DB_LOCKED A user key is not loaded in memory (a user is not logged in)
543 * @retval #CKMC_ERROR_DB_ERROR Failed due to the error with unknown reason
544 * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN Alias does not exist
545 * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
546 * @retval #CKMC_ERROR_AUTHENTICATION_FAILED Decryption failed because password is incorrect
547 * @pre User is already logged in and the user key is already loaded into memory in plain text form.
548 * @see ckmc_create_key_pair_rsa()
549 * @see ckmc_create_key_pair_ecdsa()
550 * @see ckmc_verify_signature()
551 * @see ckmc_buffer_free()
552 * @see #ckmc_hash_algo_e
553 * @see #ckmc_rsa_padding_algo_e
555 int ckmc_create_signature(const char *private_key_alias, const char *password, const ckmc_raw_buffer_s message, const ckmc_hash_algo_e hash, const ckmc_rsa_padding_algo_e padding, ckmc_raw_buffer_s **ppsignature);
559 * @brief Verifies a given signature on a given message using a public key and returns the signature status.
561 * @remarks %http://tizen.org/privilege/keymanager (public level privilege) is no longer required to use this API since 3.0.
562 * @remarks If password of policy is provided during storing a key, the same password should be provided.
563 * @param[in] public_key_alias The name of public key
564 * @param[in] password The password used in decrypting a public key value
565 * @param[in] message The input on which the signature is created
566 * @param[in] signature The signature that is verified with public key
567 * @param[in] hash The hash algorithm used in verifying signature
568 * @param[in] padding The RSA padding algorithm used in verifying signature \n
569 * It is used only when the signature algorithm is RSA
570 * @return @c 0 on success and the signature is valid,
571 * otherwise a negative error value
572 * @retval #CKMC_ERROR_NONE Successful
573 * @retval #CKMC_ERROR_VERIFICATION_FAILED The signature is invalid
574 * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
575 * @retval #CKMC_ERROR_DB_LOCKED A user key is not loaded in memory (a user is not logged in)
576 * @retval #CKMC_ERROR_DB_ERROR Failed due to the error with unknown reason
577 * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN Alias does not exist
578 * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
579 * @retval #CKMC_ERROR_AUTHENTICATION_FAILED Decryption failed because password is incorrect
580 * @pre User is already logged in and the user key is already loaded into memory in plain text form.
581 * @see ckmc_create_key_pair_rsa()
582 * @see ckmc_create_key_pair_ecdsa()
583 * @see ckmc_verify_signature()
584 * @see #ckmc_hash_algo_e
585 * @see #ckmc_rsa_padding_algo_e
587 int ckmc_verify_signature(const char *public_key_alias, const char *password, const ckmc_raw_buffer_s message, const ckmc_raw_buffer_s signature, const ckmc_hash_algo_e hash, const ckmc_rsa_padding_algo_e padding);
591 * @brief Verifies a certificate chain and returns that chain.
593 * @remarks %http://tizen.org/privilege/keymanager (public level privilege) is no longer required to use this API since 3.0.
594 * @remarks The trusted root certificate of the chain should exist in the system's certificate storage.
595 * @remarks You must destroy the newly created @a ppcert_chain_list by calling ckmc_cert_list_all_free() if it is no longer needed.
596 * @param[in] cert The certificate to be verified
597 * @param[in] untrustedcerts The untrusted CA certificates to be used in verifying a certificate chain
598 * @param[out] ppcert_chain_list The pointer to a newly created certificate chain's handle \n
599 * If an error occurs, @a *ppcert_chain_list will be null
600 * @return @c 0 on success and the signature is valid,
601 * otherwise a negative error value
602 * @retval #CKMC_ERROR_NONE Successful
603 * @retval #CKMC_ERROR_VERIFICATION_FAILED The certificate chain is not valid
604 * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
605 * @retval #CKMC_ERROR_DB_LOCKED A user key is not loaded in memory (a user is not logged in)
606 * @retval #CKMC_ERROR_DB_ERROR Failed due to the error with unknown reason
607 * @retval #CKMC_ERROR_INVALID_FORMAT The format of certificate is not valid
608 * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
609 * @retval #CKMC_ERROR_AUTHENTICATION_FAILED Decryption failed because password is incorrect
610 * @pre User is already logged in and the user key is already loaded into memory in plain text form.
611 * @see ckmc_cert_list_all_free()
613 int ckmc_get_cert_chain(const ckmc_cert_s *cert, const ckmc_cert_list_s *untrustedcerts, ckmc_cert_list_s **ppcert_chain_list);
617 * @deprecated Deprecated since @if MOBILE 2.4. @elseif WEARABLE 3.0. @endif [Use ckmc_get_cert_chain() instead]
618 * @brief Verifies a certificate chain using an alias list of untrusted certificates and return that chain.
620 * @remarks %http://tizen.org/privilege/keymanager (public level privilege) is no longer required to use this API since 3.0.
621 * @remarks The trusted root certificate of the chain should exist in the system's certificate storage.
622 * @remarks You must destroy the newly created @a ppcert_chain_list by calling ckmc_cert_list_all_free() if it is no longer needed.
623 * @remarks @a untrustedcerts shouldn't be protected with optional password.
624 * @param[in] cert The certificate to be verified
625 * @param[in] untrustedcerts The alias list of untrusted CA certificates stored in key manager to be used in verifying a certificate chain
626 * @param[out] ppcert_chain_list The pointer to a newly created certificate chain's handle \n
627 * If an error occurs, @a *ppcert_chain_list will be null
628 * @return @c 0 on success and the signature is valid,
629 * otherwise a negative error value
630 * @retval #CKMC_ERROR_NONE Successful
631 * @retval #CKMC_ERROR_VERIFICATION_FAILED The certificate chain is not valid
632 * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
633 * @retval #CKMC_ERROR_DB_LOCKED A user key is not loaded in memory (a user is not logged in)
634 * @retval #CKMC_ERROR_DB_ERROR Failed due to the error with unknown reason
635 * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN Alias does not exist
636 * @retval #CKMC_ERROR_INVALID_FORMAT The format of certificate is not valid
637 * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
638 * @retval #CKMC_ERROR_AUTHENTICATION_FAILED Some certificates were encrypted with password and could not be used
639 * @pre User is already logged in and the user key is already loaded into memory in plain text form.
640 * @see ckmc_get_cert_chain()
641 * @see ckmc_cert_list_all_free()
643 int ckmc_get_cert_chain_with_alias(const ckmc_cert_s *cert, const ckmc_alias_list_s *untrustedcerts, ckmc_cert_list_s **ppcert_chain_list) TIZEN_DEPRECATED_API;
647 * @brief Verifies a certificate chain and returns that chain using user-entered, trusted, and untrusted CA certificates.
648 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
649 * @remarks %http://tizen.org/privilege/keymanager (public level privilege) is no longer required to use this API since 3.0.
650 * @remarks If the trusted root certificates are provided as a user input, these certificates do not need to exist in the system's certificate storage.
651 * @remarks You must destroy the newly created @a ppcert_chain_list by calling ckmc_cert_list_all_free() if it is no longer needed.
652 * @param[in] cert The certificate to be verified
653 * @param[in] untrustedcerts The untrusted CA certificates to be used in verifying a certificate chain
654 * @param[in] trustedcerts The trusted CA certificates to be used in verifying a certificate chain
655 * @param[in] use_trustedsystemcerts The flag indicating the use of the trusted root certificates in the system's certificate storage
656 * @param[out] ppcert_chain_list The pointer to a newly created certificate chain's handle \n
657 * If an error occurs, @a *ppcert_chain_list will be null
658 * @return @c 0 on success and the signature is valid,
659 * otherwise a negative error value
660 * @retval #CKMC_ERROR_NONE Successful
661 * @retval #CKMC_ERROR_VERIFICATION_FAILED The certificate chain is not valid
662 * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
663 * @retval #CKMC_ERROR_DB_LOCKED A user key is not loaded in memory (a user is not logged in)
664 * @retval #CKMC_ERROR_DB_ERROR Failed due to the error with unknown reason
665 * @retval #CKMC_ERROR_INVALID_FORMAT The format of certificate is not valid
666 * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
667 * @pre User is already logged in and the user key is already loaded into memory in plain text form.
668 * @see ckmc_cert_list_all_free()
670 int ckmc_get_cert_chain_with_trustedcert(const ckmc_cert_s *cert, const ckmc_cert_list_s *untrustedcerts, const ckmc_cert_list_s *trustedcerts, const bool use_trustedsystemcerts, ckmc_cert_list_s **ppcert_chain_list);
674 * @brief Perform OCSP that checks certificate is whether revoked or not.
675 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
677 * @privilege %http://tizen.org/privilege/internet
678 * @remarks %http://tizen.org/privilege/internet (public level privilege) is required to use this API instead of %http://tizen.org/privilege/keymanager (public level privilege) since 3.0.
679 * @param[in] pcert_chain_list Valid certificate chain to perform OCSP check
680 * @param[out] ocsp_status The pointer to status result of OCSP check
681 * @return @c 0 on success,
682 * otherwise a negative error value
683 * @retval #CKMC_ERROR_NONE Successful
684 * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
685 * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
686 * @retval #CKMC_ERROR_NOT_SUPPORTED Device needed to run API is not supported
687 * @pre User is already logged in and the user key is already loaded into memory in plain text form.
688 * @pre @a pcert_chain_list is created with ckmc_get_certificate_chain() or
689 * ckmc_get_certificate_chain_with_alias().
690 * @see ckmc_get_cert_chain())
691 * @see ckmc_cert_list_all_free()
693 int ckmc_ocsp_check(const ckmc_cert_list_s *pcert_chain_list, ckmc_ocsp_status_e *ocsp_status);
697 * @deprecated Deprecated since @if MOBILE 2.4. @elseif WEARABLE 3.0. @endif [Use ckmc_set_permission() instead]
698 * @brief Allows another application to access client's application data.
700 * @remarks %http://tizen.org/privilege/keymanager (public level privilege) is no longer required to use this API since 3.0.
701 * @remarks Data identified by @a alias should exist.
702 * @param[in] alias Data alias for which access will be granted
703 * @param[in] accessor Package id of the application that will gain access rights
704 * @param[in] granted Rights granted for @a accessor application
705 * @return @c 0 on success,
706 * otherwise a negative error value
707 * @retval #CKMC_ERROR_NONE Successful
708 * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
709 * @retval #CKMC_ERROR_DB_LOCKED A user key is not loaded in memory (a user is not logged in)
710 * @retval #CKMC_ERROR_DB_ERROR Failed due to the error with unknown reason
711 * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN Alias does not exist
712 * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
713 * @pre User is already logged in and the user key is already loaded into memory in plain text form.
714 * @see ckmc_deny_access()
716 int ckmc_allow_access(const char *alias, const char *accessor, ckmc_access_right_e granted) TIZEN_DEPRECATED_API;
720 * @brief Allows another application to access client's application data.
721 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
722 * @remarks %http://tizen.org/privilege/keymanager (public level privilege) is no longer required to use this API since 3.0.
723 * @remarks Data identified by @a alias should exist.
724 * @param[in] alias Data alias for which access will be granted
725 * @param[in] accessor Package id of the application that will gain access rights
726 * @param[in] permissions Mask of permissions granted for @a accessor application
727 * (#ckmc_permission_e)
728 * (previous permission mask will be replaced with the new mask value)
729 * @return @c 0 on success,
730 * otherwise a negative error value
731 * @retval #CKMC_ERROR_NONE Successful
732 * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
733 * @retval #CKMC_ERROR_DB_LOCKED A user key is not loaded in memory (a user is not logged in)
734 * @retval #CKMC_ERROR_DB_ERROR Failed due to the error with unknown reason
735 * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN Alias does not exist
736 * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
737 * @pre User is already logged in and the user key is already loaded into memory in plain text form.
739 int ckmc_set_permission(const char *alias, const char *accessor, int permissions);
743 * @deprecated Deprecated since @if MOBILE 2.4. @elseif WEARABLE 3.0. @endif [Use ckmc_set_permission() instead]
744 * @brief Revokes another application's access to client's application data.
746 * @remarks %http://tizen.org/privilege/keymanager (public level privilege) is no longer required to use this API since 3.0.
747 * @remarks Data identified by @a alias should exist.
748 * @remarks Only access previously granted with ckmc_allow_access can be revoked.
749 * @param[in] alias Data alias for which access will be revoked
750 * @param[in] accessor Package id of the application that will lose access rights
751 * @return @c 0 on success,
752 * otherwise a negative error value
753 * @retval #CKMC_ERROR_NONE Successful
754 * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid or the @a accessor doesn't have access to @a alias
755 * @retval #CKMC_ERROR_DB_LOCKED A user key is not loaded in memory (a user is not logged in)
756 * @retval #CKMC_ERROR_DB_ERROR Failed due to the error with unknown reason
757 * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN Alias does not exist
758 * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
759 * @pre User is already logged in and the user key is already loaded into memory in plain text form.
760 * @see ckmc_allow_access()
761 * @see ckmc_set_permission()
763 int ckmc_deny_access(const char *alias, const char *accessor) TIZEN_DEPRECATED_API;
767 * @brief Removes an entry (no matter of type) from the key manager.
768 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
769 * @remarks %http://tizen.org/privilege/keymanager (public level privilege) is no longer required to use this API since 3.0.
770 * @remarks To remove item, client must have remove permission to the specified item.
771 * @remarks The item owner can remove by default.
772 * @param[in] alias Item alias to be removed
773 * @return @c 0 on success,
774 * otherwise a negative error value
775 * @retval #CKMC_ERROR_NONE Successful
776 * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
777 * @retval #CKMC_ERROR_DB_LOCKED A user key is not loaded in memory (a user is not logged in)
778 * @retval #CKMC_ERROR_DB_ERROR Failed due to a database error
779 * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN Alias does not exist
780 * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
781 * @pre User is already logged in and the user key is already loaded into memory in plain text form.
782 * @see ckmc_save_key()
783 * @see ckmc_save_cert()
784 * @see ckmc_save_data()
785 * @see ckmc_save_pkcs12()
786 * @see ckmc_create_key_pair_rsa()
787 * @see ckmc_create_key_pair_dsa()
788 * @see ckmc_create_key_pair_ecdsa()
790 int ckmc_remove_alias(const char *alias);
794 * @brief Encrypts data using selected key and algorithm.
796 * @remarks Key identified by @a key_alias should exist.
797 * @param[in] params Algorithm parameter list handle. See #ckmc_param_list_h and
798 * #ckmc_algo_type_e for details
799 * @param[in] key_alias Alias of the key to be used for encryption
800 * @param[in] password The password used in decrypting a key value \n
801 * If password of the policy is provided in ckmc_save_key(), the same
802 * password should be provided
803 * @param[in] decrypted Data to be encrypted. In case of AES algorithm there are no restrictions on the size of data.
804 * For RSA the size must be smaller or equal to key size in bytes - 42.
805 * Example: for 1024 RSA key the maximum data size is 1024/8 - 42 = 86
806 * @param[out] ppencrypted Encrypted data (some algorithms may return additional information embedded in encrypted data.
807 * AES GCM is an example) \n
808 * The caller is responsible for freeing @a encrypted with ckmc_buffer_free()
809 * @return @c 0 on success,
810 * otherwise a negative error value
811 * @retval #CKMC_ERROR_NONE Successful
812 * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid (missing or invalid
813 * mandatory algorithm parameter, decrypted = NULL,
814 * ppencrypted = NULL)
815 * @retval #CKMC_ERROR_DB_LOCKED A user key is not loaded in memory (a user is not logged in)
816 * @retval #CKMC_ERROR_DB_ERROR Failed due to the error with unknown reason
817 * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN Key with given alias does not exist
818 * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
819 * @retval #CKMC_ERROR_AUTHENTICATION_FAILED Key decryption failed because password is incorrect
820 * @pre User is already logged in and the user key is already loaded into memory in plain text form.
821 * @see ckmc_buffer_free()
822 * @see ckmc_param_list_new()
823 * @see ckmc_param_list_free()
824 * @see ckmc_param_list_set_integer()
825 * @see ckmc_param_list_set_buffer()
826 * @see ckmc_generate_new_params()
827 * @see #ckmc_param_list_h
828 * @see #ckmc_param_name_e
829 * @see #ckmc_algo_type_e
831 int ckmc_encrypt_data(ckmc_param_list_h params, const char *key_alias, const char *password, const ckmc_raw_buffer_s decrypted, ckmc_raw_buffer_s **ppencrypted);
835 * @brief Decrypts data using selected key and algorithm.
837 * @remarks Key identified by @a key_alias should exist.
838 * @param[in] params Algorithm parameter list handle. You should use the same parameters that were used for encryption.
839 * See #ckmc_param_list_h and #ckmc_algo_type_e for details
840 * @param[in] key_alias Alias of the key to be used for encryption
841 * @param[in] password The password used in decrypting a key value \n
842 * If password of the policy is provided in ckmc_save_key(), the same password should be provided
843 * @param[in] encrypted Data to be decrypted (some algorithms may require additional information embedded in encrypted data. AES GCM is an example)
844 * @param[out] ppdecrypted Decrypted data \n
845 * The caller is responsible for freeing @a decrypted with ckmc_buffer_free()
846 * @return @c 0 on success,
847 * otherwise a negative error value
848 * @retval #CKMC_ERROR_NONE Successful
849 * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid (missing or invalid
850 * mandatory algorithm parameter, encrypted = NULL,
851 * ppdecrypted = NULL)
852 * @retval #CKMC_ERROR_DB_LOCKED A user key is not loaded in memory (a user is not logged in)
853 * @retval #CKMC_ERROR_DB_ERROR Failed due to the error with unknown reason
854 * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN Key with given alias does not exist
855 * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
856 * @retval #CKMC_ERROR_AUTHENTICATION_FAILED Key decryption failed because password is incorrect
857 * @pre User is already logged in and the user key is already loaded into memory in plain text form.
858 * @see ckmc_buffer_free()
859 * @see ckmc_param_list_new()
860 * @see ckmc_param_list_free()
861 * @see ckmc_param_list_set_integer()
862 * @see ckmc_param_list_set_buffer()
863 * @see ckmc_generate_new_params()
864 * @see #ckmc_param_list_h
865 * @see #ckmc_param_name_e
866 * @see #ckmc_algo_type_e
868 int ckmc_decrypt_data(ckmc_param_list_h params, const char *key_alias, const char *password, const ckmc_raw_buffer_s encrypted, ckmc_raw_buffer_s **ppdecrypted);
881 #endif /* __TIZEN_CORE_CKMC_MANAGER_H */