Certificate chain in OCSP is assumed to be valid
[platform/core/security/key-manager.git] / src / include / ckmc / ckmc-manager.h
1 /*
2  *  Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  *  Licensed under the Apache License, Version 2.0 (the "License");
5  *  you may not use this file except in compliance with the License.
6  *  You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  *  Unless required by applicable law or agreed to in writing, software
11  *  distributed under the License is distributed on an "AS IS" BASIS,
12  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  *  See the License for the specific language governing permissions and
14  *  limitations under the License
15  *
16  *
17  * @file        ckmc-manager.h
18  * @version     1.0
19  * @brief       Provides management functions(storing, retrieving, and removing) for keys,
20  *              certificates and data of a user and additional crypto functions.
21  */
22
23
24 #ifndef __TIZEN_CORE_CKMC_MANAGER_H
25 #define __TIZEN_CORE_CKMC_MANAGER_H
26
27 #include <stddef.h>
28 #include <sys/types.h>
29 #include <tizen.h>
30 #include <ckmc/ckmc-type.h>
31 #include <ckmc/ckmc-error.h>
32
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36
37 /**
38  * @addtogroup CAPI_KEY_MANAGER_CLIENT_MODULE
39  * @{
40  */
41
42
43 /**
44  * @brief Stores a key inside key manager based on the provided policy.
45  *
46  * @since_tizen 2.3
47  * @privlevel public
48  * @privilege %http://tizen.org/privilege/keymanager
49  *
50  * @remarks Currently only six types of keys are supported for this API. These are RSA
51  *          public/private key, DSA public/private key and ECDSA public/private 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
58  *          in policy.
59  *
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
63  *
64  * @return @c 0 on success,
65  *         otherwise a negative error value
66  *
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
70  *                                       in)
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
75  *
76  * @pre User is already logged in and the user key is already loaded into memory in plain text form.
77  *
78  * @see ckmc_remove_key()
79  * @see ckmc_get_key()
80  * @see ckmc_get_key_alias_list()
81  * @see #ckmc_key_s
82  * @see #ckmc_policy_s
83  */
84 int ckmc_save_key(const char *alias, const ckmc_key_s key, const ckmc_policy_s policy);
85
86 /**
87  * @brief Removes a key from key manager.
88  *
89  * @since_tizen 2.3
90  * @privlevel public
91  * @privilege %http://tizen.org/privilege/keymanager
92  *
93  * @remarks To remove key, client must have remove permission to the specified key.
94  * @remarks The key owner can remove by default.
95  *
96  * @param[in] alias The name of a key to be removed
97  *
98  * @return @c 0 on success,
99  *         otherwise a negative error value
100  *
101  * @retval #CKMC_ERROR_NONE              Successful
102  * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
103  * @retval #CKMC_ERROR_DB_LOCKED         A user key is not loaded in memory (a user is not logged
104  *                                       in)
105  * @retval #CKMC_ERROR_DB_ERROR          Failed due to a database error
106  * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN  Alias does not exist
107  * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
108  *
109  * @pre User is already logged in and the user key is already loaded into memory in plain text form.
110  *
111  * @see ckmc_save_key()
112  * @see ckmc_get_key()
113  * @see ckmc_get_key_alias_list()
114  */
115 int ckmc_remove_key(const char *alias);
116
117 /**
118  * @brief Gets a key from key manager.
119  *
120  * @since_tizen 2.3
121  * @privlevel public
122  * @privilege %http://tizen.org/privilege/keymanager
123  *
124  * @remarks A client can access only data stored by the client.
125  * @remarks You must destroy the newly created @a ppkey by calling ckmc_key_free() if it is no
126  *          longer needed.
127  *
128  * @param[in] alias     The name of a key to retrieve
129  * @param[in] password  The password used in decrypting a key value \n
130  *                      If password of policy is provided in ckmc_save_key(), the same password
131  *                      should be provided.
132  * @param[out] ppkey    The pointer to a newly created ckmc_key_s handle
133  *
134  * @return @c 0 on success,
135  *         otherwise a negative error value
136  *
137  * @retval #CKMC_ERROR_NONE              Successful
138  * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
139  * @retval #CKMC_ERROR_DB_LOCKED         A user key is not loaded in memory (a user is not logged
140  *                                       in)
141  * @retval #CKMC_ERROR_DB_ERROR          Failed due to a database error
142  * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN  Alias does not exist
143  * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
144  *
145  * @pre User is already logged in and the user key is already loaded into memory in plain text form.
146  *
147  * @see ckmc_save_key()
148  * @see ckmc_remove_key()
149  * @see ckmc_get_key_alias_list()
150  */
151 int ckmc_get_key(const char *alias, const char *password, ckmc_key_s **ppkey);
152
153 /**
154  * @brief Gets all the alias of keys that the client can access.
155  *
156  * @since_tizen 2.3
157  * @privlevel public
158  * @privilege %http://tizen.org/privilege/keymanager
159  *
160  * @remarks A client can access only data stored by the client.
161  * @remarks You must destroy the newly created @a ppalias_list by calling ckmc_alias_list_all_free()
162  *          if it is no longer needed.
163  *
164  * @param[out] ppalias_list  The pointer to a newly created ckmc_alias_list_s handle containing all
165  *                           available alias of keys \n
166  *                           If there is no available key alias, *ppalias_list will be null.
167  *
168  * @return @c 0 on success,
169  *         otherwise a negative error value
170  *
171  * @retval #CKMC_ERROR_NONE              Successful
172  * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
173  * @retval #CKMC_ERROR_DB_LOCKED         A user key is not loaded in memory (a user is not logged
174  *                                       in)
175  * @retval #CKMC_ERROR_DB_ERROR          Failed due to a database error
176  * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN  Alias does not exist
177  * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
178  *
179  * @pre User is already logged in and the user key is already loaded into memory in plain text form.
180  *
181  * @see ckmc_save_key()
182  * @see ckmc_remove_key()
183  * @see ckmc_get_key()
184  */
185 int ckmc_get_key_alias_list(ckmc_alias_list_s** ppalias_list);
186
187
188
189
190 /**
191  * @brief Stores a certificate inside key manager based on the provided policy.
192  *
193  * @since_tizen 2.3
194  * @privlevel public
195  * @privilege %http://tizen.org/privilege/keymanager
196  *
197  * @remarks the certificate's binary value will be converted and saved as binary DER encoded
198  *          certificates.
199  *
200  * @param[in] alias  The name of a certificate to be stored
201  * @param[in] cert   The certificate's binary value to be stored
202  * @param[in] policy The policy about how to store a certificate securely
203  *
204  * @return @c 0 on success,
205  *         otherwise a negative error value
206  *
207  * @retval #CKMC_ERROR_NONE               Successful
208  * @retval #CKMC_ERROR_INVALID_PARAMETER  Input parameter is invalid
209  * @retval #CKMC_ERROR_DB_LOCKED          A user key is not loaded in memory (a user is not logged
210  *                                        in)
211  * @retval #CKMC_ERROR_DB_ALIAS_EXISTS    Alias already exists
212  * @retval #CKMC_ERROR_INVALID_FORMAT     The format of raw_cert is not valid
213  * @retval #CKMC_ERROR_DB_ERROR           Failed due to a database error
214  * @retval #CKMC_ERROR_PERMISSION_DENIED  Failed to access key manager
215  *
216  * @pre User is already logged in and the user key is already loaded into memory in plain text form.
217  *
218  * @see ckmc_remove_cert()
219  * @see ckmc_get_cert()
220  * @see ckmc_get_cert_alias_list()
221  * @see #ckmc_cert_s
222  * @see #ckmc_policy_s
223  */
224 int ckmc_save_cert(const char *alias, const ckmc_cert_s cert, const ckmc_policy_s policy);
225
226 /**
227  * @brief Removes a certificate from key manager.
228  *
229  * @since_tizen 2.3
230  * @privlevel public
231  * @privilege %http://tizen.org/privilege/keymanager
232  *
233  * @remarks To remove certificate, client must have remove permission to the specified certificate.
234  * @remarks The key owner can remove by default.
235  *
236  * @param[in] alias The name of a certificate to be removed
237  *
238  * @return @c 0 on success,
239  *         otherwise a negative error value
240  *
241  * @retval #CKMC_ERROR_NONE               Successful
242  * @retval #CKMC_ERROR_INVALID_PARAMETER  Input parameter is invalid
243  * @retval #CKMC_ERROR_DB_LOCKED          A user key is not loaded in memory (a user is not logged
244  *                                        in)
245  * @retval #CKMC_ERROR_DB_ERROR           Failed due to a database error
246  * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN   Alias does not exist
247  * @retval #CKMC_ERROR_PERMISSION_DENIED  Failed to access key manager
248  *
249  * @pre User is already logged in and the user key is already loaded into memory in plain text form.
250  *
251  * @see ckmc_save_cert()
252  * @see ckmc_get_cert()
253  * @see ckmc_get_cert_alias_list()
254  */
255 int ckmc_remove_cert(const char *alias);
256
257 /**
258  * @brief Gets a certificate from key manager.
259  *
260  * @since_tizen 2.3
261  * @privlevel public
262  * @privilege %http://tizen.org/privilege/keymanager
263  *
264  * @remarks A client can access only certificate stored by the client.
265  * @remarks A DER encoded certificate will be returned as a return value.
266  * @remarks You must destroy the newly created @a ppcert by calling ckmc_cert_free() if it is no
267  *          longer needed.
268  *
269  * @param[in] alias    The name of a certificate to retrieve
270  * @param[in] password The password used in decrypting a certificate value \n
271  *                     If password of policy is provided in ckmc_save_cert(), the same password
272  *                     should be provided.
273  * @param[out] ppcert  The pointer to a newly created ckmc_cert_s handle
274  *
275  * @return @c 0 on success,
276  *         otherwise a negative error value
277  *
278  * @retval #CKMC_ERROR_NONE               Successful
279  * @retval #CKMC_ERROR_INVALID_PARAMETER  Input parameter is invalid
280  * @retval #CKMC_ERROR_DB_LOCKED          A user key is not loaded in memory (a user is not logged
281  *                                        in)
282  * @retval #CKMC_ERROR_DB_ERROR           Failed due to a database error
283  * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN   Alias does not exists
284  * @retval #CKMC_ERROR_PERMISSION_DENIED  Failed to access key manager
285  *
286  * @pre User is already logged in and the user key is already loaded into memory in plain text form.
287  *
288  * @see ckmc_save_cert()
289  * @see ckmc_remove_cert()
290  * @see ckmc_get_cert_alias_list()
291  */
292 int ckmc_get_cert(const char *alias, const char *password, ckmc_cert_s **ppcert);
293
294 /**
295  * @brief Gets all alias of certificates which the client can access.
296  *
297  * @since_tizen 2.3
298  * @privlevel public
299  * @privilege %http://tizen.org/privilege/keymanager
300  *
301  * @remarks A client can access only data stored by the client.
302  * @remarks You must destroy the newly created @a ppalias_list by calling ckmc_alias_list_all_free()
303  *          if it is no longer needed.
304  *
305  * @param[out] ppalias_list The pointer to a newly created ckmc_alias_list_s handle containing all
306  *                          available alias of keys \n
307  *                          If there is no available key alias, *ppalias_list will be null.
308  *
309  * @return @c 0 on success,
310  *         otherwise a negative error value
311  *
312  * @retval #CKMC_ERROR_NONE               Successful
313  * @retval #CKMC_ERROR_INVALID_PARAMETER  Input parameter is invalid
314  * @retval #CKMC_ERROR_DB_LOCKED          A user key is not loaded in memory (a user is not logged
315  *                                        in)
316  * @retval #CKMC_ERROR_DB_ERROR           Failed due to a database error
317  * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN   Alias does not exist
318  * @retval #CKMC_ERROR_PERMISSION_DENIED  Failed to access key manager
319  *
320  * @pre User is already logged in and the user key is already loaded into memory in plain text form.
321  *
322  * @see ckmc_save_cert()
323  * @see ckmc_remove_cert()
324  * @see ckmc_get_cert()
325  */
326 int ckmc_get_cert_alias_list(ckmc_alias_list_s** ppalias_list);
327
328
329
330
331 /**
332  * @brief Stores PKCS12's contents inside key manager based on the provided policies.
333  * All items from the PKCS12 will use the same alias.
334  *
335  * @since_tizen 2.3
336  * @privlevel public
337  * @privilege %http://tizen.org/privilege/keymanager
338  *
339  * @param[in] alias         The name of a data to be stored
340  * @param[in] pkcs          Pointer to the pkcs12 structure to be saved
341  * @param[in] key_policy    The policy about how to store pkcs's private key
342  * @param[in] cert_policy   The policy about how to store pkcs's certificate
343  *
344  * @return @c 0 on success,
345  *         otherwise a negative error value
346  *
347  * @retval #CKMC_ERROR_NONE               Successful
348  * @retval #CKMC_ERROR_INVALID_PARAMETER  Input parameter is invalid
349  * @retval #CKMC_ERROR_DB_LOCKED          A user key is not loaded in memory (a user is not logged
350  *                                        in)
351  * @retval #CKMC_ERROR_DB_ALIAS_EXISTS    Alias already exists
352  * @retval #CKMC_ERROR_DB_ERROR           Failed due to a database error
353  * @retval #CKMC_ERROR_PERMISSION_DENIED  Failed to access key manager
354  *
355  * @pre User is already logged in and the user key is already loaded into memory in plain text form.
356  *
357  * @see ckmc_remove_pkcs12()
358  * @see ckmc_get_pkcs12()
359  * @see ckmc_get_data_alias_list()
360  * @see ckmc_load_from_pkcs12_file2()
361  * @see #ckmc_pkcs12_s
362  * @see #ckmc_policy_s
363  */
364 int ckmc_save_pkcs12(const char *alias,
365                      const ckmc_pkcs12_s *pkcs,
366                      const ckmc_policy_s key_policy,
367                      const ckmc_policy_s cert_policy);
368
369 /**
370  * @brief Removes all PKCS12 contents from key manager.
371  *
372  * @since_tizen 2.3
373  * @privlevel public
374  * @privilege %http://tizen.org/privilege/keymanager
375  *
376  * @remarks To remove PKCS12, client must have remove permission to the specified PKCS12 object.
377  * @remarks The key owner can remove by default.
378  *
379  * @param[in] alias The name of PKCS12 to be removed
380  *
381  * @return @c 0 on success,
382  *         otherwise a negative error value
383  *
384  * @retval #CKMC_ERROR_NONE               Successful
385  * @retval #CKMC_ERROR_INVALID_PARAMETER  Input parameter is invalid
386  * @retval #CKMC_ERROR_DB_LOCKED          A user key is not loaded in memory (a user is not logged
387  *                                        in)
388  * @retval #CKMC_ERROR_DB_ERROR           Failed due to a database error
389  * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN   Alias does not exist
390  * @retval #CKMC_ERROR_PERMISSION_DENIED  Failed to access key manager
391  *
392  * @pre User is already logged in and the user key is already loaded into memory in plain text form.
393  *
394  * @see ckmc_save_pkcs12()
395  * @see ckmc_get_pkcs12()
396  */
397 int ckmc_remove_pkcs12(const char *alias);
398
399 /**
400  * @brief Gets a pkcs12 from key manager.
401  *
402  * @since_tizen 2.3
403  * @privlevel public
404  * @privilege %http://tizen.org/privilege/keymanager
405  *
406  * @remarks A client can access only data stored by the client.
407  * @remarks You must destroy the newly created @a pkcs12 by calling ckmc_pkcs12_free() if it is no
408  *          longer needed.
409  *
410  * @param[in]  alias     The name of a data to retrieve
411  * @param[out] pkcs12    The pointer to a newly created ckmc_pkcs12_s handle
412  *
413  * @return @c 0 on success,
414  *         otherwise a negative error value
415  *
416  * @retval #CKMC_ERROR_NONE               Successful
417  * @retval #CKMC_ERROR_INVALID_PARAMETER  Input parameter is invalid
418  * @retval #CKMC_ERROR_DB_LOCKED          A user key is not loaded in memory (a user is not logged
419  *                                        in)
420  * @retval #CKMC_ERROR_DB_ERROR           Failed due to a database error
421  * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN   Alias does not exist
422  * @retval #CKMC_ERROR_PERMISSION_DENIED  Failed to access key manager
423  *
424  * @pre User is already logged in and the user key is already loaded into memory in plain text form.
425  *
426  * @see ckmc_save_pkcs12()
427  * @see ckmc_remove_pkcs12()
428  */
429 int ckmc_get_pkcs12(const char *alias, ckmc_pkcs12_s **pkcs12);
430
431
432
433
434 /**
435  * @brief Stores a data inside key manager based on the provided policy.
436  *
437  * @since_tizen 2.3
438  * @privlevel public
439  * @privilege %http://tizen.org/privilege/keymanager
440  *
441  * @param[in] alias  The name of a data to be stored
442  * @param[in] data   The binary value to be stored
443  * @param[in] policy The policy about how to store a data securely
444  *
445  * @return @c 0 on success,
446  *         otherwise a negative error value
447  *
448  * @retval #CKMC_ERROR_NONE               Successful
449  * @retval #CKMC_ERROR_INVALID_PARAMETER  Input parameter is invalid
450  * @retval #CKMC_ERROR_DB_LOCKED          A user key is not loaded in memory (a user is not logged
451  *                                        in)
452  * @retval #CKMC_ERROR_DB_ALIAS_EXISTS    Alias already exists
453  * @retval #CKMC_ERROR_DB_ERROR           Failed due to a database error
454  * @retval #CKMC_ERROR_PERMISSION_DENIED  Failed to access key manager
455  *
456  * @pre User is already logged in and the user key is already loaded into memory in plain text form.
457  *
458  * @see ckmc_remove_data()
459  * @see ckmc_get_data()
460  * @see ckmc_get_data_alias_list()
461  * @see #ckmc_raw_buffer_s
462  * @see #ckmc_policy_s
463  */
464 int ckmc_save_data(const char *alias, ckmc_raw_buffer_s data, const ckmc_policy_s policy);
465
466 /**
467  * @brief Removes a data from key manager.
468  *
469  * @since_tizen 2.3
470  * @privlevel public
471  * @privilege %http://tizen.org/privilege/keymanager
472  *
473  * @remarks To remove data, client must have remove permission to the specified data object.
474  * @remarks The data owner can remove by default.
475  *
476  * @param[in] alias The name of a data to be removed
477  *
478  * @return @c 0 on success,
479  *         otherwise a negative error value
480  *
481  * @retval #CKMC_ERROR_NONE               Successful
482  * @retval #CKMC_ERROR_INVALID_PARAMETER  Input parameter is invalid
483  * @retval #CKMC_ERROR_DB_LOCKED          A user key is not loaded in memory (a user is not logged
484  *                                        in)
485  * @retval #CKMC_ERROR_DB_ERROR           Failed due to the error with unknown reason
486  * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN   Alias does not exist
487  * @retval #CKMC_ERROR_PERMISSION_DENIED  Failed to access key manager
488  *
489  * @pre User is already logged in and the user key is already loaded into memory in plain text form.
490  *
491  * @see ckmc_save_data()
492  * @see ckmc_get_data()
493  * @see ckmc_get_data_alias_list()
494  */
495 int ckmc_remove_data(const char *alias);
496
497 /**
498  * @brief Gets a data from key manager.
499  *
500  * @since_tizen 2.3
501  * @privlevel public
502  * @privilege %http://tizen.org/privilege/keymanager
503  *
504  * @remarks A client can access only data stored by the client.
505  * @remarks You must destroy the newly created @a ppdata by calling ckmc_buffer_free() if it is no
506  *          longer needed.
507  *
508  * @param[in]  alias     The name of a data to retrieve
509  * @param[in]  password  The password used in decrypting a data value \n
510  *                       If password of policy is provided in ckmc_save_data(), the same password
511  *                       should be provided.
512  * @param[out] ppdata    The pointer to a newly created ckmc_raw_buffer_s handle
513  *
514  * @return @c 0 on success,
515  *         otherwise a negative error value
516  *
517  * @retval #CKMC_ERROR_NONE               Successful
518  * @retval #CKMC_ERROR_INVALID_PARAMETER  Input parameter is invalid
519  * @retval #CKMC_ERROR_DB_LOCKED          A user key is not loaded in memory (a user is not logged
520  *                                        in)
521  * @retval #CKMC_ERROR_DB_ERROR           Failed due to the error with unknown reason
522  * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN   Alias does not exist
523  * @retval #CKMC_ERROR_PERMISSION_DENIED  Failed to access key manager
524  *
525  * @pre User is already logged in and the user key is already loaded into memory in plain text form.
526  *
527  * @see ckmc_save_data()
528  * @see ckmc_remove_data()
529  * @see ckmc_get_data_alias_list()
530  */
531 int ckmc_get_data(const char *alias, const char *password, ckmc_raw_buffer_s **ppdata);
532
533 /**
534  * @brief Gets all alias of data which the client can access.
535  *
536  * @since_tizen 2.3
537  * @privlevel public
538  * @privilege %http://tizen.org/privilege/keymanager
539  *
540  * @remarks A client can access only data stored by the client.
541  * @remarks You must destroy the newly created @a ppalias_list by calling ckmc_alias_list_all_free()
542  *          if it is no longer needed.
543  *
544  * @param[out] ppalias_list The pointer to a newly created ckmc_alias_list_s handle containing all
545  *                          available alias of keys \n
546  *                          If there is no available key alias, *ppalias_list will be null.
547  *
548  * @return @c 0 on success,
549  *         otherwise a negative error value
550  *
551  * @retval #CKMC_ERROR_NONE               Successful
552  * @retval #CKMC_ERROR_INVALID_PARAMETER  Input parameter is invalid
553  * @retval #CKMC_ERROR_DB_LOCKED          A user key is not loaded in memory (a user is not logged
554  *                                        in)
555  * @retval #CKMC_ERROR_DB_ERROR           Failed due to the error with unknown reason
556  * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN   Alias does not exist
557  * @retval #CKMC_ERROR_PERMISSION_DENIED  Failed to access key manager
558  *
559  * @pre User is already logged in and the user key is already loaded into memory in plain text form.
560  *
561  * @see ckmc_save_data()
562  * @see ckmc_remove_data()
563  * @see ckmc_get_data()
564  */
565 int ckmc_get_data_alias_list(ckmc_alias_list_s** ppalias_list);
566
567
568
569
570 /**
571  * @brief Creates RSA private/public key pair and stores them inside key manager based on each
572  *        policy.
573  *
574  * @since_tizen 2.3
575  * @privlevel public
576  * @privilege %http://tizen.org/privilege/keymanager
577  *
578  * @remarks If password in policy is provided, the key is additionally encrypted with the password
579  *          in policy.
580  *
581  * @param[in] size                The size of key strength to be created \n
582  *                                @c 1024, @c 2048, and @c 4096 are supported.
583  * @param[in] private_key_alias   The name of private key to be stored
584  * @param[in] public_key_alias    The name of public key to be stored
585  * @param[in] policy_private_key  The policy about how to store a private key securely
586  * @param[in] policy_public_key   The policy about how to store a public key securely
587  *
588  * @return @c 0 on success,
589  *         otherwise a negative error value
590  *
591  * @retval #CKMC_ERROR_NONE               Successful
592  * @retval #CKMC_ERROR_INVALID_PARAMETER  Input parameter is invalid
593  * @retval #CKMC_ERROR_DB_LOCKED          A user key is not loaded in memory (a user is not logged
594  *                                        in)
595  * @retval #CKMC_ERROR_DB_ALIAS_EXISTS    Alias already exists
596  * @retval #CKMC_ERROR_DB_ERROR           Failed due to other DB transaction unexpectedly
597  * @retval #CKMC_ERROR_PERMISSION_DENIED  Failed to access key manager
598  *
599  * @pre User is already logged in and the user key is already loaded into memory in plain text form.
600  *
601  * @see ckmc_create_key_pair_dsa()
602  * @see ckmc_create_key_pair_ecdsa()
603  * @see ckmc_create_signature()
604  * @see ckmc_verify_signature()
605  */
606 int ckmc_create_key_pair_rsa(const size_t size,
607                              const char *private_key_alias,
608                              const char *public_key_alias,
609                              const ckmc_policy_s policy_private_key,
610                              const ckmc_policy_s policy_public_key);
611
612 /**
613  * @brief Creates DSA private/public key pair and stores them inside key manager based on each
614  *        policy.
615  *
616  * @since_tizen 2.3
617  * @privlevel public
618  * @privilege %http://tizen.org/privilege/keymanager
619  *
620  * @remarks If password in policy is provided, the key is additionally encrypted with the password
621  *          in policy.
622  *
623  * @param[in] size                The size of key strength to be created \n
624  *                                @c 1024, @c 2048, @c 3072 and @c 4096 are supported.
625  * @param[in] private_key_alias   The name of private key to be stored
626  * @param[in] public_key_alias    The name of public key to be stored
627  * @param[in] policy_private_key  The policy about how to store a private key securely
628  * @param[in] policy_public_key   The policy about how to store a public key securely
629  *
630  * @return @c 0 on success,
631  *         otherwise a negative error value
632  *
633  * @retval #CKMC_ERROR_NONE               Successful
634  * @retval #CKMC_ERROR_INVALID_PARAMETER  Input parameter is invalid
635  * @retval #CKMC_ERROR_DB_LOCKED          A user key is not loaded in memory (a user is not logged
636  *                                        in)
637  * @retval #CKMC_ERROR_DB_ALIAS_EXISTS    Alias already exists
638  * @retval #CKMC_ERROR_DB_ERROR           Failed due to other DB transaction unexpectedly
639  * @retval #CKMC_ERROR_PERMISSION_DENIED  Failed to access key manager
640  *
641  * @pre User is already logged in and the user key is already loaded into memory in plain text form.
642  *
643  * @see ckmc_create_key_pair_rsa()
644  * @see ckmc_create_key_pair_ecdsa()
645  * @see ckmc_create_signature()
646  * @see ckmc_verify_signature()
647  */
648 int ckmc_create_key_pair_dsa(const size_t size,
649                              const char *private_key_alias,
650                              const char *public_key_alias,
651                              const ckmc_policy_s policy_private_key,
652                              const ckmc_policy_s policy_public_key);
653
654 /**
655  * @brief Creates ECDSA private/public key pair and stores them inside key manager based on each
656  *        policy.
657  *
658  * @since_tizen 2.3
659  * @privlevel public
660  * @privilege %http://tizen.org/privilege/keymanager
661  *
662  * @remarks If password in policy is provided, the key is additionally encrypted with the password
663  *          in policy.
664  *
665  * @param[in] type                The type of elliptic curve of ECDSA
666  * @param[in] private_key_alias   The name of private key to be stored
667  * @param[in] public_key_alias    The name of public key to be stored
668  * @param[in] policy_private_key  The policy about how to store a private key securely
669  * @param[in] policy_public_key   The policy about how to store a public key securely
670  *
671  * @return @c 0 on success,
672  *         otherwise a negative error value
673  *
674  * @retval #CKMC_ERROR_NONE               Successful
675  * @retval #CKMC_ERROR_INVALID_PARAMETER  Input parameter is invalid
676  * @retval #CKMC_ERROR_DB_LOCKED          A user key is not loaded in memory (a user is not logged
677  *                                        in)
678  * @retval #CKMC_ERROR_DB_ALIAS_EXISTS    Alias already exists
679  * @retval #CKMC_ERROR_DB_ERROR           Failed due to other DB transaction unexpectedly
680  * @retval #CKMC_ERROR_PERMISSION_DENIED  Failed to access key manager
681  *
682  * @pre User is already logged in and the user key is already loaded into memory in plain text form.
683  *
684  * @see ckmc_create_key_pair_rsa()
685  * @see ckmc_create_key_pair_dsa()
686  * @see ckmc_create_signature()
687  * @see ckmc_verify_signature()
688  * @see #ckmc_ec_type_e
689  */
690 int ckmc_create_key_pair_ecdsa(const ckmc_ec_type_e type,
691                                const char *private_key_alias,
692                                const char *public_key_alias,
693                                const ckmc_policy_s policy_private_key,
694                                const ckmc_policy_s policy_public_key);
695
696 /**
697  * @brief Creates a signature on a given message using a private key and returns the signature.
698  *
699  * @since_tizen 2.3
700  * @privlevel public
701  * @privilege %http://tizen.org/privilege/keymanager
702  *
703  * @remarks If password of policy is provided during storing a key, the same password should be
704  *          provided.
705  * @remarks You must destroy the newly created @a ppsignature by calling ckmc_buffer_free() if it is
706  *          no longer needed.
707  *
708  * @param[in]  private_key_alias  The name of private key
709  * @param[in]  password           The password used in decrypting a private key value
710  * @param[in]  message            The message that is signed with a private key
711  * @param[in]  hash               The hash algorithm used in creating signature
712  * @param[in]  padding            The RSA padding algorithm used in creating signature \n
713  *                                It is used only when the signature algorithm is RSA.
714  * @param[out] ppsignature        The pointer to a newly created signature \n
715  *                                If an error occurs, @a *ppsignature will be null.
716  *
717  * @return @c 0 on success,
718  *         otherwise a negative error value
719  *
720  * @retval #CKMC_ERROR_NONE               Successful
721  * @retval #CKMC_ERROR_INVALID_PARAMETER  Input parameter is invalid
722  * @retval #CKMC_ERROR_DB_LOCKED          A user key is not loaded in memory (a user is not logged
723  *                                        in)
724  * @retval #CKMC_ERROR_DB_ERROR           Failed due to the error with unknown reason
725  * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN   Alias does not exist
726  * @retval #CKMC_ERROR_PERMISSION_DENIED  Failed to access key manager
727  *
728  * @pre User is already logged in and the user key is already loaded into memory in plain text form.
729  *
730  * @see ckmc_create_key_pair_rsa()
731  * @see ckmc_create_key_pair_ecdsa()
732  * @see ckmc_verify_signature()
733  * @see ckmc_buffer_free()
734  * @see #ckmc_hash_algo_e
735  * @see #ckmc_rsa_padding_algo_e
736  */
737 int ckmc_create_signature(const char *private_key_alias,
738                           const char *password,
739                           const ckmc_raw_buffer_s message,
740                           const ckmc_hash_algo_e hash,
741                           const ckmc_rsa_padding_algo_e padding,
742                           ckmc_raw_buffer_s **ppsignature);
743
744 /**
745  * @brief Verifies a given signature on a given message using a public key and returns the signature
746  *        status.
747  *
748  * @since_tizen 2.3
749  * @privlevel public
750  * @privilege %http://tizen.org/privilege/keymanager
751  *
752  * @remarks If password of policy is provided during storing a key, the same password should be
753  *          provided.
754  *
755  * @param[in] public_key_alias  The name of public key
756  * @param[in] password          The password used in decrypting a public key value
757  * @param[in] message           The input on which the signature is created
758  * @param[in] signature         The signature that is verified with public key
759  * @param[in] hash              The hash algorithm used in verifying signature
760  * @param[in] padding           The RSA padding algorithm used in verifying signature \n
761  *                              It is used only when the signature algorithm is RSA.
762  *
763  * @return @c 0 on success and the signature is valid,
764  *         otherwise a negative error value
765  *
766  * @retval #CKMC_ERROR_NONE                 Successful
767  * @retval #CKMC_ERROR_VERIFICATION_FAILED  The signature is invalid
768  * @retval #CKMC_ERROR_INVALID_PARAMETER    Input parameter is invalid
769  * @retval #CKMC_ERROR_DB_LOCKED            A user key is not loaded in memory (a user is not logged
770  *                                          in)
771  * @retval #CKMC_ERROR_DB_ERROR             Failed due to the error with unknown reason
772  * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN     Alias does not exist
773  * @retval #CKMC_ERROR_PERMISSION_DENIED    Failed to access key manager
774  *
775  * @pre User is already logged in and the user key is already loaded into memory in plain text form.
776  *
777  * @see ckmc_create_key_pair_rsa()
778  * @see ckmc_create_key_pair_ecdsa()
779  * @see ckmc_verify_signature()
780  * @see #ckmc_hash_algo_e
781  * @see #ckmc_rsa_padding_algo_e
782  */
783 int ckmc_verify_signature(const char *public_key_alias,
784                           const char *password,
785                           const ckmc_raw_buffer_s message,
786                           const ckmc_raw_buffer_s signature,
787                           const ckmc_hash_algo_e hash,
788                           const ckmc_rsa_padding_algo_e padding);
789
790 /**
791  * @deprecated, see ckmc_get_certificate_chain()
792  * @brief Verifies a certificate chain and returns that chain.
793  *
794  * @since_tizen 2.3
795  * @privlevel public
796  * @privilege %http://tizen.org/privilege/keymanager
797  *
798  * @remarks The trusted root certificate of the chain should exist in the system's certificate
799  *          storage.
800  * @remarks You must destroy the newly created @a ppcert_chain_list by calling
801  *          ckmc_cert_list_all_free() if it is no longer needed.
802  *
803  * @param[in] cert               The certificate to be verified
804  * @param[in] untrustedcerts     The untrusted CA certificates to be used in verifying a certificate
805  *                               chain
806  * @param[out] ppcert_chain_list The pointer to a newly created certificate chain's handle \n
807  *                               If an error occurs, @a *ppcert_chain_list will be null.
808  *
809  * @return @c 0 on success and the signature is valid,
810  *         otherwise a negative error value
811  *
812  * @retval #CKMC_ERROR_NONE                 Successful
813  * @retval #CKMC_ERROR_VERIFICATION_FAILED  The certificate chain is not valid
814  * @retval #CKMC_ERROR_INVALID_PARAMETER    Input parameter is invalid
815  * @retval #CKMC_ERROR_DB_LOCKED            A user key is not loaded in memory (a user is not logged
816  *                                          in)
817  * @retval #CKMC_ERROR_DB_ERROR             Failed due to the error with unknown reason
818  * @retval #CKMC_ERROR_INVALID_FORMAT       The format of certificate is not valid
819  * @retval #CKMC_ERROR_PERMISSION_DENIED    Failed to access key manager
820  *
821  * @pre User is already logged in and the user key is already loaded into memory in plain text form.
822  *
823  * @see ckmc_get_cert_chain_with_alias())
824  * @see ckmc_cert_list_all_free()
825  */
826 int ckmc_get_cert_chain(const ckmc_cert_s *cert,
827                         const ckmc_cert_list_s *untrustedcerts,
828                         ckmc_cert_list_s **ppcert_chain_list);
829
830 /**
831  * @deprecated, see ckmc_get_certificate_chain_with_alias()
832  * @brief Verifies a certificate chain using an alias list of untrusted certificates and return that
833  *        chain.
834  *
835  * @since_tizen 2.3
836  * @privlevel public
837  * @privilege %http://tizen.org/privilege/keymanager
838  *
839  * @remarks The trusted root certificate of the chain should exist in the system's certificate
840  *          storage.
841  * @remarks You must destroy the newly created @a ppcert_chain_list by calling
842  *          ckmc_cert_list_all_free() if it is no longer needed.
843  *
844  * @param[in] cert               The certificate to be verified
845  * @param[in] untrustedcerts     The alias list of untrusted CA certificates stored in key manager
846  *                               to be used in verifying a certificate chain
847  * @param[out] ppcert_chain_list The pointer to a newly created certificate chain's handle \n
848  *                               If an error occurs, @a *ppcert_chain_list will be null.
849  *
850  * @return @c 0 on success and the signature is valid,
851  *         otherwise a negative error value
852  *
853  * @retval #CKMC_ERROR_NONE                 Successful
854  * @retval #CKMC_ERROR_VERIFICATION_FAILED  The certificate chain is not valid
855  * @retval #CKMC_ERROR_INVALID_PARAMETER    Input parameter is invalid
856  * @retval #CKMC_ERROR_DB_LOCKED            A user key is not loaded in memory (a user is not logged
857  *                                          in)
858  * @retval #CKMC_ERROR_DB_ERROR             Failed due to the error with unknown reason
859  * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN     Alias does not exist
860  * @retval #CKMC_ERROR_INVALID_FORMAT       The format of certificate is not valid
861  * @retval #CKMC_ERROR_PERMISSION_DENIED    Failed to access key manager
862  *
863  * @pre User is already logged in and the user key is already loaded into memory in plain text form.
864  *
865  * @see ckmc_get_cert_chain())
866  * @see ckmc_cert_list_all_free()
867  */
868 int ckmc_get_cert_chain_with_alias(const ckmc_cert_s *cert,
869                                    const ckmc_alias_list_s *untrustedcerts,
870                                    ckmc_cert_list_s **ppcert_chain_list);
871
872 /**
873  * @brief Verifies a certificate chain and returns that chain using user entered trusted and
874  *        untrusted CA certificates
875  *
876  * @since_tizen 3.0
877  * @privlevel public
878  * @privilege %http://tizen.org/privilege/keymanager
879  *
880  * @remarks If the trusted root certificates are provided as a user input, these certificates do not
881  *          need to exist in the system's certificate storage.
882  * @remarks You must destroy the newly created @a ppcert_chain_list by calling
883  *          ckmc_cert_list_all_free() if it is no longer needed.
884  *  *
885  * @param[in] cert                    The certificate to be verified
886  * @param[in] untrustedcerts          The untrusted CA certificates to be used in verifying a
887  *                                    certificate chain
888  * @param[in] trustedcerts            The trusted CA certificates to be used in verifying a
889  *                                    certificate chain
890  * @param[in] use_trustedsystemcerts  The flag indicating the use of the trusted root certificates
891  *                                    in the system's certificate storage.
892  * @param[out] ppcert_chain_list The pointer to a newly created certificate chain's handle \n
893  *                               If an error occurs, @a *ppcert_chain_list will be null.
894  *
895  * @return @c 0 on success and the signature is valid,
896  *         otherwise a negative error value
897  *
898  * @retval #CKMC_ERROR_NONE                 Successful
899  * @retval #CKMC_ERROR_VERIFICATION_FAILED  The certificate chain is not valid
900  * @retval #CKMC_ERROR_INVALID_PARAMETER    Input parameter is invalid
901  * @retval #CKMC_ERROR_DB_LOCKED            A user key is not loaded in memory (a user is not logged
902  *                                          in)
903  * @retval #CKMC_ERROR_DB_ERROR             Failed due to the error with unknown reason
904  * @retval #CKMC_ERROR_INVALID_FORMAT       The format of certificate is not valid
905  * @retval #CKMC_ERROR_PERMISSION_DENIED    Failed to access key manager
906  *
907  * @pre User is already logged in and the user key is already loaded into memory in plain text form.
908  *
909  * @see ckmc_get_cert_chain_with_alias())
910  * @see ckmc_cert_list_all_free()
911  */
912 int ckmc_get_certificate_chain(const ckmc_cert_s *cert,
913                                const ckmc_cert_list_s *untrustedcerts,
914                                const ckmc_cert_list_s *trustedcerts,
915                                const bool use_trustedsystemcerts,
916                                ckmc_cert_list_s **ppcert_chain_list);
917
918 /**
919  * @brief Verifies a certificate chain and returns that chain using alias lists of untrusted and
920  *        trusted certificates
921  *
922  * @since_tizen 3.0
923  * @privlevel public
924  * @privilege %http://tizen.org/privilege/keymanager
925  *
926  * @remarks If the alias list of trusted root certificates is provided as a user input, these
927  *          certificates do not need to exist in the system's certificate storage.
928  * @remarks You must destroy the newly created @a ppcert_chain_list by calling
929  *          ckmc_cert_list_all_free() if it is no longer needed.
930  *
931  * @param[in] cert                    The certificate to be verified
932  * @param[in] untrustedcerts          The alias list of untrusted CA certificates stored in key
933  *                                    manager to be used in verifying a certificate chain
934  * @param[in] trustedcerts            The alias list of trusted CA certificates stored in key
935  *                                    manager to be used in verifying a certificate chain
936  * @param[in] use_trustedsystemcerts  The flag indicating the use of the trusted root certificates
937  *                                    in the system's certificate storage.
938  * @param[out] ppcert_chain_list The pointer to a newly created certificate chain's handle \n
939  *                               If an error occurs, @a *ppcert_chain_list will be null.
940  *
941  * @return @c 0 on success and the signature is valid,
942  *         otherwise a negative error value
943  *
944  * @retval #CKMC_ERROR_NONE                 Successful
945  * @retval #CKMC_ERROR_VERIFICATION_FAILED  The certificate chain is not valid
946  * @retval #CKMC_ERROR_INVALID_PARAMETER    Input parameter is invalid
947  * @retval #CKMC_ERROR_DB_LOCKED            A user key is not loaded in memory (a user is not logged
948  *                                          in)
949  * @retval #CKMC_ERROR_DB_ERROR             Failed due to the error with unknown reason
950  * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN     Alias does not exist
951  * @retval #CKMC_ERROR_INVALID_FORMAT       The format of certificate is not valid
952  * @retval #CKMC_ERROR_PERMISSION_DENIED    Failed to access key manager
953  *
954  * @pre User is already logged in and the user key is already loaded into memory in plain text form.
955  *
956  * @see ckmc_get_cert_chain())
957  * @see ckmc_cert_list_all_free()
958  */
959 int ckmc_get_certificate_chain_with_alias(const ckmc_cert_s *cert,
960                                           const ckmc_alias_list_s *untrustedcerts,
961                                           const ckmc_alias_list_s *trustedcerts,
962                                           const bool use_trustedsystemcerts,
963                                           ckmc_cert_list_s **ppcert_chain_list);
964
965 /**
966  * @brief Perform OCSP which checks certificate is whether revoked or not
967  *
968  * @since_tizen 3.0
969  * @privlevel public
970  * @privilege %http://tizen.org/privilege/keymanager
971  *
972  * @param[in] pcert_chain_list   Valid certificate chain to perform OCSP check
973  * @param[out] ocsp_status       The pointer to status result of OCSP check
974  *
975  * @return @c 0 on success, otherwise a negative error value
976  *
977  * @retval #CKMC_ERROR_NONE                 Successful
978  * @retval #CKMC_ERROR_INVALID_PARAMETER    Input parameter is invalid
979  * @retval #CKMC_ERROR_PERMISSION_DENIED    Failed to access key manager
980  *
981  * @pre User is already logged in and the user key is already loaded into memory in plain text form.
982  * @pre @a pcert_chain_list is created with ckmc_get_certificate_chain() or
983  *      ckmc_get_certificate_chain_with_alias()
984  *
985  * @see ckmc_get_cert_chain())
986  * @see ckmc_cert_list_all_free()
987  */
988 int ckmc_ocsp_check(const ckmc_cert_list_s *pcert_chain_list, ckmc_ocsp_status_e *ocsp_status);
989
990 /**
991  * @deprecated, see ckmc_set_permission()
992  * @brief Allows another application to access client's application data
993  *
994  * @since_tizen 2.3
995  * @privlevel public
996  * @privilege %http://tizen.org/privilege/keymanager
997  *
998  * @remarks Data identified by @a alias should exist
999  *
1000  * @param[in] alias       Data alias for which access will be granted
1001  * @param[in] accessor    Package id of the application that will gain access rights
1002  * @param[in] granted     Rights granted for @a accessor application
1003  *
1004  * @return @c 0 on success, otherwise a negative error value
1005  *
1006  * @retval #CKMC_ERROR_NONE                 Successful
1007  * @retval #CKMC_ERROR_INVALID_PARAMETER    Input parameter is invalid
1008  * @retval #CKMC_ERROR_DB_LOCKED            A user key is not loaded in memory (a user is not logged
1009  *                                          in)
1010  * @retval #CKMC_ERROR_DB_ERROR             Failed due to the error with unknown reason
1011  * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN     Alias does not exist
1012  * @retval #CKMC_ERROR_PERMISSION_DENIED    Failed to access key manager
1013  *
1014  * @pre User is already logged in and the user key is already loaded into memory in plain text form.
1015  *
1016  * @see ckmc_deny_access()
1017  */
1018 int ckmc_allow_access(const char *alias, const char *accessor, ckmc_access_right_e granted);
1019
1020 /**
1021  * @brief Allows another application to access client's application data
1022  *
1023  * @since_tizen 3.0
1024  * @privlevel public
1025  * @privilege %http://tizen.org/privilege/keymanager
1026  *
1027  * @remarks Data identified by @a alias should exist
1028  *
1029  * @param[in] alias       Data alias for which access will be granted
1030  * @param[in] accessor    Package id of the application that will gain access rights
1031  * @param[in] permissions Mask of permissions granted for @a accessor application
1032  *                        (@a ckmc_permission_e)
1033  *                        (previous permission mask will be replaced with the new mask value)
1034  *
1035  * @return @c 0 on success, otherwise a negative error value
1036  *
1037  * @retval #CKMC_ERROR_NONE                 Successful
1038  * @retval #CKMC_ERROR_INVALID_PARAMETER    Input parameter is invalid
1039  * @retval #CKMC_ERROR_DB_LOCKED            A user key is not loaded in memory (a user is not logged
1040  *                                          in)
1041  * @retval #CKMC_ERROR_DB_ERROR             Failed due to the error with unknown reason
1042  * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN     Alias does not exist
1043  * @retval #CKMC_ERROR_PERMISSION_DENIED    Failed to access key manager
1044  *
1045  * @pre User is already logged in and the user key is already loaded into memory in plain text form.
1046  */
1047 int ckmc_set_permission(const char *alias, const char *accessor, int permissions);
1048
1049 /**
1050  * @deprecated, see ckmc_set_permission()
1051  * @brief Revokes another application's access to client's application data
1052  *
1053  * @since_tizen 2.3
1054  * @privlevel public
1055  * @privilege %http://tizen.org/privilege/keymanager
1056  *
1057  * @remarks Data identified by @a alias should exist
1058  * @remarks Only access previously granted with ckmc_allow_access can be revoked.
1059  *
1060  * @param[in] alias       Data alias for which access will be revoked
1061  * @param[in] accessor    Package id of the application that will lose access rights
1062  *
1063  * @return @c 0 on success, otherwise a negative error value
1064  *
1065  * @retval #CKMC_ERROR_NONE                 Successful
1066  * @retval #CKMC_ERROR_INVALID_PARAMETER    Input parameter is invalid or the @a accessor doesn't
1067  *                                          have access to @a alias
1068  * @retval #CKMC_ERROR_DB_LOCKED            A user key is not loaded in memory (a user is not logged
1069  *                                          in)
1070  * @retval #CKMC_ERROR_DB_ERROR             Failed due to the error with unknown reason
1071  * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN     Alias does not exist
1072  * @retval #CKMC_ERROR_PERMISSION_DENIED    Failed to access key manager
1073  *
1074  * @pre User is already logged in and the user key is already loaded into memory in plain text form.
1075  *
1076  * @see ckmc_allow_access()
1077  * @see ckmc_set_permission()
1078  */
1079 int ckmc_deny_access(const char *alias, const char *accessor);
1080
1081 /**
1082  * @brief Removes a an entry (no matter of type) from the key manager.
1083  *
1084  * @since_tizen 3.0
1085  * @privlevel public
1086  * @privilege %http://tizen.org/privilege/keymanager
1087  *
1088  * @remarks To remove item, client must have remove permission to the specified item.
1089  * @remarks The item owner can remove by default.
1090  *
1091  * @param[in] alias Item alias to be removed
1092  *
1093  * @return @c 0 on success,
1094  *         otherwise a negative error value
1095  *
1096  * @retval #CKMC_ERROR_NONE              Successful
1097  * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
1098  * @retval #CKMC_ERROR_DB_LOCKED         A user key is not loaded in memory (a user is not logged
1099  *                                       in)
1100  * @retval #CKMC_ERROR_DB_ERROR          Failed due to a database error
1101  * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN  Alias does not exist
1102  * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
1103  *
1104  * @pre User is already logged in and the user key is already loaded into memory in plain text form.
1105  *
1106  * @see ckmc_save_key()
1107  * @see ckmc_save_cert
1108  * @see ckmc_save_data
1109  * @see ckmc_save_pkcs12
1110  * @see ckmc_create_key_pair_rsa
1111  * @see ckmc_create_key_pair_dsa
1112  * @see ckmc_create_key_pair_ecdsa
1113  */
1114 int ckmc_remove_alias(const char *alias);
1115
1116 #ifdef __cplusplus
1117 }
1118 #endif
1119
1120 /**
1121  * @}
1122  */
1123
1124
1125 #endif /* __TIZEN_CORE_CKMC_MANAGER_H */