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
28 #include <sys/types.h>
30 #include <ckmc/ckmc-type.h>
31 #include <ckmc/ckmc-error.h>
38 * @addtogroup CAPI_KEY_MANAGER_CLIENT_MODULE
44 * @brief Stores a key inside key manager based on the provided policy.
48 * @privilege %http://tizen.org/privilege/keymanager
50 * @remarks Currently API supports seven types of keys. These are RSA public/private key,
51 * DSA public/private key, ECDSA public/private key and AES symmetric key.
52 * @remarks key_type in key may be set to #CKMC_KEY_NONE as an input. key_type is determined inside
53 * key manager during storing keys.
54 * @remarks Some private key files are protected by a password. If raw_key in key read from those
55 * encrypted files is encrypted with a password, the password should be provided in the
56 * #ckmc_key_s structure.
57 * @remarks If password in policy is provided, the key is additionally encrypted with the password
60 * @param[in] alias The name of a key to be stored
61 * @param[in] key The key's binary value to be stored
62 * @param[in] policy The policy about how to store a key securely
64 * @return @c 0 on success,
65 * otherwise a negative error value
67 * @retval #CKMC_ERROR_NONE Successful
68 * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
69 * @retval #CKMC_ERROR_DB_LOCKED A user key is not loaded in memory (a user is not logged
71 * @retval #CKMC_ERROR_DB_ALIAS_EXISTS Alias already exists
72 * @retval #CKMC_ERROR_INVALID_FORMAT The format of raw_key is not valid
73 * @retval #CKMC_ERROR_DB_ERROR Failed due to a database error
74 * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
76 * @pre User is already logged in and the user key is already loaded into memory in plain text form.
78 * @see ckmc_remove_alias()
80 * @see ckmc_get_key_alias_list()
84 int ckmc_save_key(const char *alias, const ckmc_key_s key, const ckmc_policy_s policy);
87 * @deprecated Deprecated since 2.4. [Use ckmc_remove_alias() instead]
88 * @brief Removes a key from key manager.
92 * @privilege %http://tizen.org/privilege/keymanager
94 * @remarks To remove key, client must have remove permission to the specified key.
95 * @remarks The key owner can remove by default.
97 * @param[in] alias The name of a key to be removed
99 * @return @c 0 on success,
100 * otherwise a negative error value
102 * @retval #CKMC_ERROR_NONE Successful
103 * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
104 * @retval #CKMC_ERROR_DB_LOCKED A user key is not loaded in memory (a user is not logged
106 * @retval #CKMC_ERROR_DB_ERROR Failed due to a database error
107 * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN Alias does not exist
108 * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
110 * @pre User is already logged in and the user key is already loaded into memory in plain text form.
112 * @see ckmc_save_key()
113 * @see ckmc_get_key()
114 * @see ckmc_get_key_alias_list()
116 int ckmc_remove_key(const char *alias);
119 * @brief Gets a key from key manager.
123 * @privilege %http://tizen.org/privilege/keymanager
125 * @remarks A client can access only data stored by the client.
126 * @remarks You must destroy the newly created @a ppkey by calling ckmc_key_free() if it is no
129 * @param[in] alias The name of a key to retrieve
130 * @param[in] password The password used in decrypting a key value \n
131 * If password of policy is provided in ckmc_save_key(), the same password
132 * should be provided.
133 * @param[out] ppkey The pointer to a newly created ckmc_key_s handle
135 * @return @c 0 on success,
136 * otherwise a negative error value
138 * @retval #CKMC_ERROR_NONE Successful
139 * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
140 * @retval #CKMC_ERROR_DB_LOCKED A user key is not loaded in memory (a user is not logged
142 * @retval #CKMC_ERROR_DB_ERROR Failed due to a database error
143 * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN Alias does not exist
144 * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
145 * @retval #CKMC_ERROR_AUTHENTICATION_FAILED
146 * Decryption failed because password is incorrect.
148 * @pre User is already logged in and the user key is already loaded into memory in plain text form.
150 * @see ckmc_save_key()
151 * @see ckmc_remove_alias()
152 * @see ckmc_get_key_alias_list()
154 int ckmc_get_key(const char *alias, const char *password, ckmc_key_s **ppkey);
157 * @brief Gets all the alias of keys that the client can access.
161 * @privilege %http://tizen.org/privilege/keymanager
163 * @remarks A client can access only data stored by the client.
164 * @remarks You must destroy the newly created @a ppalias_list by calling ckmc_alias_list_all_free()
165 * if it is no longer needed.
167 * @param[out] ppalias_list The pointer to a newly created ckmc_alias_list_s handle containing all
168 * available alias of keys \n
169 * If there is no available key alias, *ppalias_list will be null.
171 * @return @c 0 on success,
172 * otherwise a negative error value
174 * @retval #CKMC_ERROR_NONE Successful
175 * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
176 * @retval #CKMC_ERROR_DB_LOCKED A user key is not loaded in memory (a user is not logged
178 * @retval #CKMC_ERROR_DB_ERROR Failed due to a database error
179 * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN Alias does not exist
180 * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
182 * @pre User is already logged in and the user key is already loaded into memory in plain text form.
184 * @see ckmc_save_key()
185 * @see ckmc_remove_alias()
186 * @see ckmc_get_key()
188 int ckmc_get_key_alias_list(ckmc_alias_list_s** ppalias_list);
194 * @brief Stores a certificate inside key manager based on the provided policy.
198 * @privilege %http://tizen.org/privilege/keymanager
200 * @remarks the certificate's binary value will be converted and saved as binary DER encoded
203 * @param[in] alias The name of a certificate to be stored
204 * @param[in] cert The certificate's binary value to be stored
205 * @param[in] policy The policy about how to store a certificate securely
207 * @return @c 0 on success,
208 * otherwise a negative error value
210 * @retval #CKMC_ERROR_NONE Successful
211 * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
212 * @retval #CKMC_ERROR_DB_LOCKED A user key is not loaded in memory (a user is not logged
214 * @retval #CKMC_ERROR_DB_ALIAS_EXISTS Alias already exists
215 * @retval #CKMC_ERROR_INVALID_FORMAT The format of raw_cert is not valid
216 * @retval #CKMC_ERROR_DB_ERROR Failed due to a database error
217 * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
219 * @pre User is already logged in and the user key is already loaded into memory in plain text form.
221 * @see ckmc_remove_alias()
222 * @see ckmc_get_cert()
223 * @see ckmc_get_cert_alias_list()
225 * @see #ckmc_policy_s
227 int ckmc_save_cert(const char *alias, const ckmc_cert_s cert, const ckmc_policy_s policy);
230 * @deprecated Deprecated since 2.4. [Use ckmc_remove_alias() instead]
231 * @brief Removes a certificate from key manager.
235 * @privilege %http://tizen.org/privilege/keymanager
237 * @remarks To remove certificate, client must have remove permission to the specified certificate.
238 * @remarks The key owner can remove by default.
240 * @param[in] alias The name of a certificate to be removed
242 * @return @c 0 on success,
243 * otherwise a negative error value
245 * @retval #CKMC_ERROR_NONE Successful
246 * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
247 * @retval #CKMC_ERROR_DB_LOCKED A user key is not loaded in memory (a user is not logged
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
253 * @pre User is already logged in and the user key is already loaded into memory in plain text form.
255 * @see ckmc_save_cert()
256 * @see ckmc_get_cert()
257 * @see ckmc_get_cert_alias_list()
259 int ckmc_remove_cert(const char *alias);
262 * @brief Gets a certificate from key manager.
266 * @privilege %http://tizen.org/privilege/keymanager
268 * @remarks A client can access only certificate stored by the client.
269 * @remarks A DER encoded certificate will be returned as a return value.
270 * @remarks You must destroy the newly created @a ppcert by calling ckmc_cert_free() if it is no
273 * @param[in] alias The name of a certificate to retrieve
274 * @param[in] password The password used in decrypting a certificate value \n
275 * If password of policy is provided in ckmc_save_cert(), the same password
276 * should be provided.
277 * @param[out] ppcert The pointer to a newly created ckmc_cert_s handle
279 * @return @c 0 on success,
280 * otherwise a negative error value
282 * @retval #CKMC_ERROR_NONE Successful
283 * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
284 * @retval #CKMC_ERROR_DB_LOCKED A user key is not loaded in memory (a user is not logged
286 * @retval #CKMC_ERROR_DB_ERROR Failed due to a database error
287 * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN Alias does not exists
288 * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
289 * @retval #CKMC_ERROR_AUTHENTICATION_FAILED
290 * Decryption failed because password is incorrect.
292 * @pre User is already logged in and the user key is already loaded into memory in plain text form.
294 * @see ckmc_save_cert()
295 * @see ckmc_remove_alias()
296 * @see ckmc_get_cert_alias_list()
298 int ckmc_get_cert(const char *alias, const char *password, ckmc_cert_s **ppcert);
301 * @brief Gets all alias of certificates which the client can access.
305 * @privilege %http://tizen.org/privilege/keymanager
307 * @remarks A client can access only data stored by the client.
308 * @remarks You must destroy the newly created @a ppalias_list by calling ckmc_alias_list_all_free()
309 * if it is no longer needed.
311 * @param[out] ppalias_list The pointer to a newly created ckmc_alias_list_s handle containing all
312 * available alias of keys \n
313 * If there is no available key alias, *ppalias_list will be null.
315 * @return @c 0 on success,
316 * otherwise a negative error value
318 * @retval #CKMC_ERROR_NONE Successful
319 * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
320 * @retval #CKMC_ERROR_DB_LOCKED A user key is not loaded in memory (a user is not logged
322 * @retval #CKMC_ERROR_DB_ERROR Failed due to a database error
323 * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN Alias does not exist
324 * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
326 * @pre User is already logged in and the user key is already loaded into memory in plain text form.
328 * @see ckmc_save_cert()
329 * @see ckmc_remove_alias()
330 * @see ckmc_get_cert()
332 int ckmc_get_cert_alias_list(ckmc_alias_list_s** ppalias_list);
338 * @brief Stores PKCS12's contents inside key manager based on the provided policies.
339 * All items from the PKCS12 will use the same alias.
343 * @privilege %http://tizen.org/privilege/keymanager
345 * @param[in] alias The name of a data to be stored
346 * @param[in] pkcs Pointer to the pkcs12 structure to be saved
347 * @param[in] key_policy The policy about how to store pkcs's private key
348 * @param[in] cert_policy The policy about how to store pkcs's certificate
350 * @return @c 0 on success,
351 * otherwise a negative error value
353 * @retval #CKMC_ERROR_NONE Successful
354 * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
355 * @retval #CKMC_ERROR_DB_LOCKED A user key is not loaded in memory (a user is not logged
357 * @retval #CKMC_ERROR_DB_ALIAS_EXISTS Alias already exists
358 * @retval #CKMC_ERROR_DB_ERROR Failed due to a database error
359 * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
361 * @pre User is already logged in and the user key is already loaded into memory in plain text form.
363 * @see ckmc_remove_alias()
364 * @see ckmc_get_pkcs12()
365 * @see ckmc_get_data_alias_list()
366 * @see ckmc_pkcs12_load()
367 * @see #ckmc_pkcs12_s
368 * @see #ckmc_policy_s
370 int ckmc_save_pkcs12(const char *alias,
371 const ckmc_pkcs12_s *pkcs,
372 const ckmc_policy_s key_policy,
373 const ckmc_policy_s cert_policy);
376 * @brief Gets a pkcs12 from key manager.
380 * @privilege %http://tizen.org/privilege/keymanager
382 * @remarks A client can access only data stored by the client.
383 * @remarks You must destroy the newly created @a pkcs12 by calling ckmc_pkcs12_free() if it is no
386 * @param[in] alias The name of a data to retrieve
387 * @param[in] key_password Password that was used to encrypt privateKey (may be NULL)
388 * @param[in] cert_password Password used to encrypt certificates (may be NULL)
389 * @param[out] pkcs12 The pointer to a newly created ckmc_pkcs12_s handle
391 * @return @c 0 on success,
392 * otherwise a negative error value
394 * @retval #CKMC_ERROR_NONE Successful
395 * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
396 * @retval #CKMC_ERROR_DB_LOCKED A user key is not loaded in memory (a user is not logged
398 * @retval #CKMC_ERROR_DB_ERROR Failed due to a database error
399 * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN Alias does not exist
400 * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
401 * @retval #CKMC_ERROR_AUTHENTICATION_FAILED
402 * key_password or cert_password does not match with password
403 * used to encrypt data
405 * @pre User is already logged in and the user key is already loaded into memory in plain text form.
407 * @see ckmc_save_pkcs12()
408 * @see ckmc_remove_alias()
410 int ckmc_get_pkcs12(const char *alias, const char *key_password, const char *cert_password, ckmc_pkcs12_s **pkcs12);
413 * @brief Stores a data inside key manager based on the provided policy.
417 * @privilege %http://tizen.org/privilege/keymanager
419 * @param[in] alias The name of a data to be stored
420 * @param[in] data The binary value to be stored
421 * @param[in] policy The policy about how to store a data securely
423 * @return @c 0 on success,
424 * otherwise a negative error value
426 * @retval #CKMC_ERROR_NONE Successful
427 * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
428 * @retval #CKMC_ERROR_DB_LOCKED A user key is not loaded in memory (a user is not logged
430 * @retval #CKMC_ERROR_DB_ALIAS_EXISTS Alias already exists
431 * @retval #CKMC_ERROR_DB_ERROR Failed due to a database error
432 * @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.
436 * @see ckmc_remove_alias()
437 * @see ckmc_get_data()
438 * @see ckmc_get_data_alias_list()
439 * @see #ckmc_raw_buffer_s
440 * @see #ckmc_policy_s
442 int ckmc_save_data(const char *alias, ckmc_raw_buffer_s data, const ckmc_policy_s policy);
445 * @deprecated Deprecated since 2.4. [Use ckmc_remove_alias() instead]
446 * @brief Removes a data from key manager.
450 * @privilege %http://tizen.org/privilege/keymanager
452 * @remarks To remove data, client must have remove permission to the specified data object.
453 * @remarks The data owner can remove by default.
455 * @param[in] alias The name of a data to be removed
457 * @return @c 0 on success,
458 * otherwise a negative error value
460 * @retval #CKMC_ERROR_NONE Successful
461 * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
462 * @retval #CKMC_ERROR_DB_LOCKED A user key is not loaded in memory (a user is not logged
464 * @retval #CKMC_ERROR_DB_ERROR Failed due to the error with unknown reason
465 * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN Alias does not exist
466 * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
468 * @pre User is already logged in and the user key is already loaded into memory in plain text form.
470 * @see ckmc_save_data()
471 * @see ckmc_get_data()
472 * @see ckmc_get_data_alias_list()
474 int ckmc_remove_data(const char *alias);
477 * @brief Gets a data from key manager.
481 * @privilege %http://tizen.org/privilege/keymanager
483 * @remarks A client can access only data stored by the client.
484 * @remarks You must destroy the newly created @a ppdata by calling ckmc_buffer_free() if it is no
487 * @param[in] alias The name of a data to retrieve
488 * @param[in] password The password used in decrypting a data value \n
489 * If password of policy is provided in ckmc_save_data(), the same password
490 * should be provided.
491 * @param[out] ppdata The pointer to a newly created ckmc_raw_buffer_s handle
493 * @return @c 0 on success,
494 * otherwise a negative error value
496 * @retval #CKMC_ERROR_NONE Successful
497 * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
498 * @retval #CKMC_ERROR_DB_LOCKED A user key is not loaded in memory (a user is not logged
500 * @retval #CKMC_ERROR_DB_ERROR Failed due to the error with unknown reason
501 * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN Alias does not exist
502 * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
503 * @retval #CKMC_ERROR_AUTHENTICATION_FAILED
504 * Decryption failed because password is incorrect.
505 * @pre User is already logged in and the user key is already loaded into memory in plain text form.
507 * @see ckmc_save_data()
508 * @see ckmc_remove_alias()
509 * @see ckmc_get_data_alias_list()
511 int ckmc_get_data(const char *alias, const char *password, ckmc_raw_buffer_s **ppdata);
514 * @brief Gets all alias of data which the client can access.
518 * @privilege %http://tizen.org/privilege/keymanager
520 * @remarks A client can access only data stored by the client.
521 * @remarks You must destroy the newly created @a ppalias_list by calling ckmc_alias_list_all_free()
522 * if it is no longer needed.
524 * @param[out] ppalias_list The pointer to a newly created ckmc_alias_list_s handle containing all
525 * available alias of keys \n
526 * If there is no available key alias, *ppalias_list will be null.
528 * @return @c 0 on success,
529 * otherwise a negative error value
531 * @retval #CKMC_ERROR_NONE Successful
532 * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
533 * @retval #CKMC_ERROR_DB_LOCKED A user key is not loaded in memory (a user is not logged
535 * @retval #CKMC_ERROR_DB_ERROR Failed due to the error with unknown reason
536 * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN Alias does not exist
537 * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
539 * @pre User is already logged in and the user key is already loaded into memory in plain text form.
541 * @see ckmc_save_data()
542 * @see ckmc_remove_alias()
543 * @see ckmc_get_data()
545 int ckmc_get_data_alias_list(ckmc_alias_list_s** ppalias_list);
551 * @brief Creates RSA private/public key pair and stores them inside key manager based on each
556 * @privilege %http://tizen.org/privilege/keymanager
558 * @remarks If password in policy is provided, the key is additionally encrypted with the password
561 * @param[in] size The size of key strength to be created \n
562 * @c 1024, @c 2048, and @c 4096 are supported.
563 * @param[in] private_key_alias The name of private key to be stored
564 * @param[in] public_key_alias The name of public key to be stored
565 * @param[in] policy_private_key The policy about how to store a private key securely
566 * @param[in] policy_public_key The policy about how to store a public key securely
568 * @return @c 0 on success,
569 * otherwise a negative error value
571 * @retval #CKMC_ERROR_NONE Successful
572 * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
573 * @retval #CKMC_ERROR_DB_LOCKED A user key is not loaded in memory (a user is not logged
575 * @retval #CKMC_ERROR_DB_ALIAS_EXISTS Alias already exists
576 * @retval #CKMC_ERROR_DB_ERROR Failed due to other DB transaction unexpectedly
577 * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
579 * @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_dsa()
582 * @see ckmc_create_key_pair_ecdsa()
583 * @see ckmc_create_signature()
584 * @see ckmc_verify_signature()
586 int ckmc_create_key_pair_rsa(const size_t size,
587 const char *private_key_alias,
588 const char *public_key_alias,
589 const ckmc_policy_s policy_private_key,
590 const ckmc_policy_s policy_public_key);
593 * @brief Creates DSA private/public key pair and stores them inside key manager based on each
598 * @privilege %http://tizen.org/privilege/keymanager
600 * @remarks If password in policy is provided, the key is additionally encrypted with the password
603 * @param[in] size The size of key strength to be created \n
604 * @c 1024, @c 2048, @c 3072 and @c 4096 are supported.
605 * @param[in] private_key_alias The name of private key to be stored
606 * @param[in] public_key_alias The name of public key to be stored
607 * @param[in] policy_private_key The policy about how to store a private key securely
608 * @param[in] policy_public_key The policy about how to store a public key securely
610 * @return @c 0 on success,
611 * otherwise a negative error value
613 * @retval #CKMC_ERROR_NONE Successful
614 * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
615 * @retval #CKMC_ERROR_DB_LOCKED A user key is not loaded in memory (a user is not logged
617 * @retval #CKMC_ERROR_DB_ALIAS_EXISTS Alias already exists
618 * @retval #CKMC_ERROR_DB_ERROR Failed due to other DB transaction unexpectedly
619 * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
621 * @pre User is already logged in and the user key is already loaded into memory in plain text form.
623 * @see ckmc_create_key_pair_rsa()
624 * @see ckmc_create_key_pair_ecdsa()
625 * @see ckmc_create_signature()
626 * @see ckmc_verify_signature()
628 int ckmc_create_key_pair_dsa(const size_t size,
629 const char *private_key_alias,
630 const char *public_key_alias,
631 const ckmc_policy_s policy_private_key,
632 const ckmc_policy_s policy_public_key);
635 * @brief Creates ECDSA private/public key pair and stores them inside key manager based on each
640 * @privilege %http://tizen.org/privilege/keymanager
642 * @remarks If password in policy is provided, the key is additionally encrypted with the password
645 * @param[in] type The type of elliptic curve of ECDSA
646 * @param[in] private_key_alias The name of private key to be stored
647 * @param[in] public_key_alias The name of public key to be stored
648 * @param[in] policy_private_key The policy about how to store a private key securely
649 * @param[in] policy_public_key The policy about how to store a public key securely
651 * @return @c 0 on success,
652 * otherwise a negative error value
654 * @retval #CKMC_ERROR_NONE Successful
655 * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
656 * @retval #CKMC_ERROR_DB_LOCKED A user key is not loaded in memory (a user is not logged
658 * @retval #CKMC_ERROR_DB_ALIAS_EXISTS Alias already exists
659 * @retval #CKMC_ERROR_DB_ERROR Failed due to other DB transaction unexpectedly
660 * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
662 * @pre User is already logged in and the user key is already loaded into memory in plain text form.
664 * @see ckmc_create_key_pair_rsa()
665 * @see ckmc_create_key_pair_dsa()
666 * @see ckmc_create_signature()
667 * @see ckmc_verify_signature()
668 * @see #ckmc_ec_type_e
670 int ckmc_create_key_pair_ecdsa(const ckmc_ec_type_e type,
671 const char *private_key_alias,
672 const char *public_key_alias,
673 const ckmc_policy_s policy_private_key,
674 const ckmc_policy_s policy_public_key);
677 * @brief Creates AES key and stores it inside key manager based on the policy.
681 * @privilege %http://tizen.org/privilege/keymanager
683 * @remarks If password in policy is provided, the key is additionally encrypted with the password
686 * @param[in] size The size of key strength to be created. \n
687 * @c 128, @c 192 and @c 256 are supported.
688 * @param[in] key_alias The name of key to be stored
689 * @param[in] key_policy The policy about how to store the key securely
691 * @return @c 0 on success,
692 * otherwise a negative error value
694 * @retval #CKMC_ERROR_NONE Successful
695 * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
696 * @retval #CKMC_ERROR_DB_LOCKED A user key is not loaded in memory (a user is not logged
698 * @retval #CKMC_ERROR_DB_ALIAS_EXISTS Alias already exists
699 * @retval #CKMC_ERROR_DB_ERROR Failed due to other DB transaction unexpectedly
700 * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
702 * @pre User is already logged in and the user key is already loaded into memory in plain text form.
704 * @see ckmc_create_key_pair_rsa()
705 * @see ckmc_create_key_pair_dsa()
706 * @see ckmc_create_key_pair_ecdsa()
708 int ckmc_create_key_aes(const size_t size,
709 const char *key_alias,
710 const ckmc_policy_s key_policy);
713 * @brief Creates a signature on a given message using a private key and returns the signature.
717 * @privilege %http://tizen.org/privilege/keymanager
719 * @remarks If password of policy is provided during storing a key, the same password should be
721 * @remarks You must destroy the newly created @a ppsignature by calling ckmc_buffer_free() if it is
724 * @param[in] private_key_alias The name of private key
725 * @param[in] password The password used in decrypting a private key value
726 * @param[in] message The message that is signed with a private key
727 * @param[in] hash The hash algorithm used in creating signature
728 * @param[in] padding The RSA padding algorithm used in creating signature \n
729 * It is used only when the signature algorithm is RSA.
730 * @param[out] ppsignature The pointer to a newly created signature \n
731 * If an error occurs, @a *ppsignature will be null.
733 * @return @c 0 on success,
734 * otherwise a negative error value
736 * @retval #CKMC_ERROR_NONE Successful
737 * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
738 * @retval #CKMC_ERROR_DB_LOCKED A user key is not loaded in memory (a user is not logged
740 * @retval #CKMC_ERROR_DB_ERROR Failed due to the error with unknown reason
741 * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN Alias does not exist
742 * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
743 * @retval #CKMC_ERROR_AUTHENTICATION_FAILED
744 * Decryption failed because password is incorrect.
746 * @pre User is already logged in and the user key is already loaded into memory in plain text form.
748 * @see ckmc_create_key_pair_rsa()
749 * @see ckmc_create_key_pair_ecdsa()
750 * @see ckmc_verify_signature()
751 * @see ckmc_buffer_free()
752 * @see #ckmc_hash_algo_e
753 * @see #ckmc_rsa_padding_algo_e
755 int ckmc_create_signature(const char *private_key_alias,
756 const char *password,
757 const ckmc_raw_buffer_s message,
758 const ckmc_hash_algo_e hash,
759 const ckmc_rsa_padding_algo_e padding,
760 ckmc_raw_buffer_s **ppsignature);
763 * @brief Verifies a given signature on a given message using a public key and returns the signature
768 * @privilege %http://tizen.org/privilege/keymanager
770 * @remarks If password of policy is provided during storing a key, the same password should be
773 * @param[in] public_key_alias The name of public key
774 * @param[in] password The password used in decrypting a public key value
775 * @param[in] message The input on which the signature is created
776 * @param[in] signature The signature that is verified with public key
777 * @param[in] hash The hash algorithm used in verifying signature
778 * @param[in] padding The RSA padding algorithm used in verifying signature \n
779 * It is used only when the signature algorithm is RSA.
781 * @return @c 0 on success and the signature is valid,
782 * otherwise a negative error value
784 * @retval #CKMC_ERROR_NONE Successful
785 * @retval #CKMC_ERROR_VERIFICATION_FAILED The signature is invalid
786 * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
787 * @retval #CKMC_ERROR_DB_LOCKED A user key is not loaded in memory (a user is not logged
789 * @retval #CKMC_ERROR_DB_ERROR Failed due to the error with unknown reason
790 * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN Alias does not exist
791 * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
792 * @retval #CKMC_ERROR_AUTHENTICATION_FAILED
793 * Decryption failed because password is incorrect.
795 * @pre User is already logged in and the user key is already loaded into memory in plain text form.
797 * @see ckmc_create_key_pair_rsa()
798 * @see ckmc_create_key_pair_ecdsa()
799 * @see ckmc_verify_signature()
800 * @see #ckmc_hash_algo_e
801 * @see #ckmc_rsa_padding_algo_e
803 int ckmc_verify_signature(const char *public_key_alias,
804 const char *password,
805 const ckmc_raw_buffer_s message,
806 const ckmc_raw_buffer_s signature,
807 const ckmc_hash_algo_e hash,
808 const ckmc_rsa_padding_algo_e padding);
811 * @brief Verifies a certificate chain and returns that chain.
815 * @privilege %http://tizen.org/privilege/keymanager
817 * @remarks The trusted root certificate of the chain should exist in the system's certificate
819 * @remarks You must destroy the newly created @a ppcert_chain_list by calling
820 * ckmc_cert_list_all_free() if it is no longer needed.
822 * @param[in] cert The certificate to be verified
823 * @param[in] untrustedcerts The untrusted CA certificates to be used in verifying a certificate
825 * @param[out] ppcert_chain_list The pointer to a newly created certificate chain's handle \n
826 * If an error occurs, @a *ppcert_chain_list will be null.
828 * @return @c 0 on success and the signature is valid,
829 * otherwise a negative error value
831 * @retval #CKMC_ERROR_NONE Successful
832 * @retval #CKMC_ERROR_VERIFICATION_FAILED The certificate chain is not valid
833 * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
834 * @retval #CKMC_ERROR_DB_LOCKED A user key is not loaded in memory (a user is not logged
836 * @retval #CKMC_ERROR_DB_ERROR Failed due to the error with unknown reason
837 * @retval #CKMC_ERROR_INVALID_FORMAT The format of certificate is not valid
838 * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
839 * @retval #CKMC_ERROR_AUTHENTICATION_FAILED
840 * Decryption failed because password is incorrect.
842 * @pre User is already logged in and the user key is already loaded into memory in plain text form.
844 * @see ckmc_get_cert_chain_with_alias())
845 * @see ckmc_cert_list_all_free()
847 int ckmc_get_cert_chain(const ckmc_cert_s *cert,
848 const ckmc_cert_list_s *untrustedcerts,
849 ckmc_cert_list_s **ppcert_chain_list);
852 * @brief Verifies a certificate chain using an alias list of untrusted certificates and return that
857 * @privilege %http://tizen.org/privilege/keymanager
859 * @remarks The trusted root certificate of the chain should exist in the system's certificate
861 * @remarks You must destroy the newly created @a ppcert_chain_list by calling
862 * ckmc_cert_list_all_free() if it is no longer needed.
864 * @param[in] cert The certificate to be verified
865 * @param[in] untrustedcerts The alias list of untrusted CA certificates stored in key manager
866 * to be used in verifying a certificate chain
867 * @param[out] ppcert_chain_list The pointer to a newly created certificate chain's handle \n
868 * If an error occurs, @a *ppcert_chain_list will be null.
870 * @return @c 0 on success and the signature is valid,
871 * otherwise a negative error value
873 * @retval #CKMC_ERROR_NONE Successful
874 * @retval #CKMC_ERROR_VERIFICATION_FAILED The certificate chain is not valid
875 * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
876 * @retval #CKMC_ERROR_DB_LOCKED A user key is not loaded in memory (a user is not logged
878 * @retval #CKMC_ERROR_DB_ERROR Failed due to the error with unknown reason
879 * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN Alias does not exist
880 * @retval #CKMC_ERROR_INVALID_FORMAT The format of certificate is not valid
881 * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
882 * @retval #CKMC_ERROR_AUTHENTICATION_FAILED
883 * Some certificates were encrypted with password and could not
886 * @pre User is already logged in and the user key is already loaded into memory in plain text form.
888 * @see ckmc_get_cert_chain()
889 * @see ckmc_cert_list_all_free()
891 int ckmc_get_cert_chain_with_alias(const ckmc_cert_s *cert,
892 const ckmc_alias_list_s *untrustedcerts,
893 ckmc_cert_list_s **ppcert_chain_list);
896 * @brief Verifies a certificate chain and returns that chain using user entered trusted and
897 * untrusted CA certificates
901 * @privilege %http://tizen.org/privilege/keymanager
903 * @remarks If the trusted root certificates are provided as a user input, these certificates do not
904 * need to exist in the system's certificate storage.
905 * @remarks You must destroy the newly created @a ppcert_chain_list by calling
906 * ckmc_cert_list_all_free() if it is no longer needed.
908 * @param[in] cert The certificate to be verified
909 * @param[in] untrustedcerts The untrusted CA certificates to be used in verifying a
911 * @param[in] trustedcerts The trusted CA certificates to be used in verifying a
913 * @param[in] use_trustedsystemcerts The flag indicating the use of the trusted root certificates
914 * in the system's certificate storage.
915 * @param[out] ppcert_chain_list The pointer to a newly created certificate chain's handle \n
916 * If an error occurs, @a *ppcert_chain_list will be null.
918 * @return @c 0 on success and the signature is valid,
919 * otherwise a negative error value
921 * @retval #CKMC_ERROR_NONE Successful
922 * @retval #CKMC_ERROR_VERIFICATION_FAILED The certificate chain is not valid
923 * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
924 * @retval #CKMC_ERROR_DB_LOCKED A user key is not loaded in memory (a user is not logged
926 * @retval #CKMC_ERROR_DB_ERROR Failed due to the error with unknown reason
927 * @retval #CKMC_ERROR_INVALID_FORMAT The format of certificate is not valid
928 * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
930 * @pre User is already logged in and the user key is already loaded into memory in plain text form.
932 * @see ckmc_get_cert_chain_with_trustedcert_alias()
933 * @see ckmc_cert_list_all_free()
935 int ckmc_get_cert_chain_with_trustedcert(const ckmc_cert_s *cert,
936 const ckmc_cert_list_s *untrustedcerts,
937 const ckmc_cert_list_s *trustedcerts,
938 const bool use_trustedsystemcerts,
939 ckmc_cert_list_s **ppcert_chain_list);
942 * @brief Verifies a certificate chain and returns that chain using alias lists of untrusted and
943 * trusted certificates
947 * @privilege %http://tizen.org/privilege/keymanager
949 * @remarks If the alias list of trusted root certificates is provided as a user input, these
950 * certificates do not need to exist in the system's certificate storage.
951 * @remarks You must destroy the newly created @a ppcert_chain_list by calling
952 * ckmc_cert_list_all_free() if it is no longer needed.
954 * @param[in] cert The certificate to be verified
955 * @param[in] untrustedcerts The alias list of untrusted CA certificates stored in key
956 * manager to be used in verifying a certificate chain
957 * @param[in] trustedcerts The alias list of trusted CA certificates stored in key
958 * manager to be used in verifying a certificate chain
959 * @param[in] use_trustedsystemcerts The flag indicating the use of the trusted root certificates
960 * in the system's certificate storage.
961 * @param[out] ppcert_chain_list The pointer to a newly created certificate chain's handle \n
962 * If an error occurs, @a *ppcert_chain_list will be null.
964 * @return @c 0 on success and the signature is valid,
965 * otherwise a negative error value
967 * @retval #CKMC_ERROR_NONE Successful
968 * @retval #CKMC_ERROR_VERIFICATION_FAILED The certificate chain is not valid
969 * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
970 * @retval #CKMC_ERROR_DB_LOCKED A user key is not loaded in memory (a user is not logged
972 * @retval #CKMC_ERROR_DB_ERROR Failed due to the error with unknown reason
973 * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN Alias does not exist
974 * @retval #CKMC_ERROR_INVALID_FORMAT The format of certificate is not valid
975 * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
976 * @retval #CKMC_ERROR_AUTHENTICATION_FAILED
977 * Some certificates were encrypted with password and could not
980 * @pre User is already logged in and the user key is already loaded into memory in plain text form.
982 * @see ckmc_get_cert_chain_with_trustedcert()
983 * @see ckmc_cert_list_all_free()
985 int ckmc_get_cert_chain_with_trustedcert_alias(const ckmc_cert_s *cert,
986 const ckmc_alias_list_s *untrustedcerts,
987 const ckmc_alias_list_s *trustedcerts,
988 const bool use_trustedsystemcerts,
989 ckmc_cert_list_s **ppcert_chain_list);
992 * @brief Perform OCSP which checks certificate is whether revoked or not
996 * @privilege %http://tizen.org/privilege/keymanager
998 * @param[in] pcert_chain_list Valid certificate chain to perform OCSP check
999 * @param[out] ocsp_status The pointer to status result of OCSP check
1001 * @return @c 0 on success, otherwise a negative error value
1003 * @retval #CKMC_ERROR_NONE Successful
1004 * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
1005 * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
1006 * @retval #CKMC_ERROR_NOT_SUPPORTED Device needed to run API is not supported
1008 * @pre User is already logged in and the user key is already loaded into memory in plain text form.
1009 * @pre @a pcert_chain_list is created with ckmc_get_certificate_chain() or
1010 * ckmc_get_certificate_chain_with_alias()
1012 * @see ckmc_get_cert_chain())
1013 * @see ckmc_cert_list_all_free()
1015 int ckmc_ocsp_check(const ckmc_cert_list_s *pcert_chain_list, ckmc_ocsp_status_e *ocsp_status);
1018 * @deprecated Deprecated since 2.4. [Use ckmc_set_permission() instead]
1019 * @brief Allows another application to access client's application data
1023 * @privilege %http://tizen.org/privilege/keymanager
1025 * @remarks Data identified by @a alias should exist
1027 * @param[in] alias Data alias for which access will be granted
1028 * @param[in] accessor Package id of the application that will gain access rights
1029 * @param[in] granted Rights granted for @a accessor application
1031 * @return @c 0 on success, otherwise a negative error value
1033 * @retval #CKMC_ERROR_NONE Successful
1034 * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
1035 * @retval #CKMC_ERROR_DB_LOCKED A user key is not loaded in memory (a user is not logged
1037 * @retval #CKMC_ERROR_DB_ERROR Failed due to the error with unknown reason
1038 * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN Alias does not exist
1039 * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
1041 * @pre User is already logged in and the user key is already loaded into memory in plain text form.
1043 * @see ckmc_deny_access()
1045 int ckmc_allow_access(const char *alias, const char *accessor, ckmc_access_right_e granted);
1048 * @brief Allows another application to access client's application data
1052 * @privilege %http://tizen.org/privilege/keymanager
1054 * @remarks Data identified by @a alias should exist
1056 * @param[in] alias Data alias for which access will be granted
1057 * @param[in] accessor Package id of the application that will gain access rights
1058 * @param[in] permissions Mask of permissions granted for @a accessor application
1059 * (@a ckmc_permission_e)
1060 * (previous permission mask will be replaced with the new mask value)
1062 * @return @c 0 on success, otherwise a negative error value
1064 * @retval #CKMC_ERROR_NONE Successful
1065 * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
1066 * @retval #CKMC_ERROR_DB_LOCKED A user key is not loaded in memory (a user is not logged
1068 * @retval #CKMC_ERROR_DB_ERROR Failed due to the error with unknown reason
1069 * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN Alias does not exist
1070 * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
1072 * @pre User is already logged in and the user key is already loaded into memory in plain text form.
1074 int ckmc_set_permission(const char *alias, const char *accessor, int permissions);
1077 * @deprecated Deprecated since 2.4. [Use ckmc_set_permission() instead]
1078 * @brief Revokes another application's access to client's application data
1082 * @privilege %http://tizen.org/privilege/keymanager
1084 * @remarks Data identified by @a alias should exist
1085 * @remarks Only access previously granted with ckmc_allow_access can be revoked.
1087 * @param[in] alias Data alias for which access will be revoked
1088 * @param[in] accessor Package id of the application that will lose access rights
1090 * @return @c 0 on success, otherwise a negative error value
1092 * @retval #CKMC_ERROR_NONE Successful
1093 * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid or the @a accessor doesn't
1094 * have access to @a alias
1095 * @retval #CKMC_ERROR_DB_LOCKED A user key is not loaded in memory (a user is not logged
1097 * @retval #CKMC_ERROR_DB_ERROR Failed due to the error with unknown reason
1098 * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN Alias does not exist
1099 * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
1101 * @pre User is already logged in and the user key is already loaded into memory in plain text form.
1103 * @see ckmc_allow_access()
1104 * @see ckmc_set_permission()
1106 int ckmc_deny_access(const char *alias, const char *accessor);
1109 * @brief Removes a an entry (no matter of type) from the key manager.
1113 * @privilege %http://tizen.org/privilege/keymanager
1115 * @remarks To remove item, client must have remove permission to the specified item.
1116 * @remarks The item owner can remove by default.
1118 * @param[in] alias Item alias to be removed
1120 * @return @c 0 on success,
1121 * otherwise a negative error value
1123 * @retval #CKMC_ERROR_NONE Successful
1124 * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
1125 * @retval #CKMC_ERROR_DB_LOCKED A user key is not loaded in memory (a user is not logged
1127 * @retval #CKMC_ERROR_DB_ERROR Failed due to a database error
1128 * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN Alias does not exist
1129 * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
1131 * @pre User is already logged in and the user key is already loaded into memory in plain text form.
1133 * @see ckmc_save_key()
1134 * @see ckmc_save_cert()
1135 * @see ckmc_save_data()
1136 * @see ckmc_save_pkcs12()
1137 * @see ckmc_create_key_pair_rsa()
1138 * @see ckmc_create_key_pair_dsa()
1139 * @see ckmc_create_key_pair_ecdsa()
1141 int ckmc_remove_alias(const char *alias);
1144 * @brief Encrypts data using selected key and algorithm.
1148 * @privilege %http://tizen.org/privilege/keymanager
1150 * @remarks Key identified by @a key_alias should exist.
1152 * @param[in] params Algorithm parameters
1153 * @param[in] key_alias Alias of the key to be used for encryption
1154 * @param[in] password The password used in decrypting a key value \n
1155 * If password of policy is provided in ckmc_save_key(), the same
1156 * password should be provided
1157 * @param[in] decrypted Data to be encrypted
1158 * @param[out] ppencrypted Encrypted data (some algorithms may return additional information
1159 * embedded in encrypted data. AES GCM is an example) \n
1160 * The caller is responsible for freeing ppencrypted with
1161 * ckmc_buffer_free()
1163 * @return @c 0 on success, otherwise a negative error value
1165 * @retval #CKMC_ERROR_NONE Successful
1166 * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
1167 * @retval #CKMC_ERROR_DB_LOCKED A user key is not loaded in memory (a user is not logged
1169 * @retval #CKMC_ERROR_DB_ERROR Failed due to the error with unknown reason
1170 * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN Key with given alias does not exist
1171 * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
1172 * @retval #CKMC_ERROR_AUTHENTICATION_FAILED
1173 * Key decryption failed because password is incorrect
1175 * @pre User is already logged in and the user key is already loaded into memory in plain text form.
1177 * @see ckmc_buffer_free()
1178 * @see ckmc_param_list_new()
1179 * @see ckmc_param_list_free()
1180 * @see ckmc_param_list_add_integer()
1181 * @see ckmc_param_list_add_buffer()
1182 * @see ckmc_generate_params()
1183 * @see #ckmc_param_list_s
1184 * @see #ckmc_param_name_e
1186 int ckmc_encrypt_data(const ckmc_param_list_s *params,
1187 const char *key_alias,
1188 const char *password,
1189 const ckmc_raw_buffer_s decrypted,
1190 ckmc_raw_buffer_s **ppencrypted);
1193 * @brief Decrypts data using selected key and algorithm.
1197 * @privilege %http://tizen.org/privilege/keymanager
1199 * @remarks Key identified by @a key_alias should exist.
1201 * @param[in] params Algorithm parameters
1202 * @param[in] key_alias Alias of the key to be used for encryption
1203 * @param[in] password The password used in decrypting a key value \n
1204 * If password of policy is provided in ckmc_save_key(), the same
1205 * password should be provided
1206 * @param[in] encrypted Data to be decrypted (some algorithms may require additional
1207 * information embedded in encrypted data. AES GCM is an example)
1208 * @param[out] ppdecrypted Decrypted data \n
1209 * The caller is responsible for freeing ppdecrypted with
1210 * ckmc_buffer_free()
1212 * @return @c 0 on success, otherwise a negative error value
1214 * @retval #CKMC_ERROR_NONE Successful
1215 * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
1216 * @retval #CKMC_ERROR_DB_LOCKED A user key is not loaded in memory (a user is not logged
1218 * @retval #CKMC_ERROR_DB_ERROR Failed due to the error with unknown reason
1219 * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN Key with given alias does not exist
1220 * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
1221 * @retval #CKMC_ERROR_AUTHENTICATION_FAILED
1222 * Key decryption failed because password is incorrect
1224 * @pre User is already logged in and the user key is already loaded into memory in plain text form.
1226 * @see ckmc_buffer_free()
1227 * @see ckmc_param_list_new()
1228 * @see ckmc_param_list_free()
1229 * @see ckmc_param_list_add_integer()
1230 * @see ckmc_param_list_add_buffer()
1231 * @see ckmc_generate_params()
1232 * @see #ckmc_param_list_s
1233 * @see #ckmc_param_name_e
1235 int ckmc_decrypt_data(const ckmc_param_list_s *params,
1236 const char *key_alias,
1237 const char *password,
1238 const ckmc_raw_buffer_s encrypted,
1239 ckmc_raw_buffer_s **ppdecrypted);
1250 #endif /* __TIZEN_CORE_CKMC_MANAGER_H */