split doxygen module into 3 sub modules
[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, certificates and data of a user and additional crypto functions.
20  */
21
22
23 #ifndef __TIZEN_CORE_CKMC_MANAGER_H
24 #define __TIZEN_CORE_CKMC_MANAGER_H
25
26 #include <stddef.h>
27 #include <sys/types.h>
28 #include <ckmc/ckmc-type.h>
29 #include <ckmc/ckmc-error.h>
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34
35 /**
36  * @addtogroup CAPI_KEY_MANAGER_CLIENT_MODULE
37  * @{
38  */
39
40
41 /**
42  * @brief Stores a key inside key manager based on the provided policy.
43  *
44  * @since_tizen 2.3
45  * @privlevel public
46  * @privilege %http://tizen.org/privilege/keymanager
47  *
48  * @remarks Currently only four types of keys are supported for this API. These are RSA public/private key and ECDSA /private key.
49  * @remarks key_type in key may be set to #CKMC_KEY_NONE as an input. key_type is determined inside key manager during storing keys.
50  * @remarks Some private key files are protected by a password. if raw_key in key read from those encrypted files is encrypted with a password, the password should be provided in the #ckmc_key structure.
51  * @remarks if password in policy is provided, the key is additionally encrypted with the password in policy.
52  *
53  * @param[in] alias is the name of a key to be stored
54  * @param[in] key has a key's binary value to be stored.
55  * @param[in] policy is about how to store a key securely.
56  *
57  * @return 0 on success, otherwise a negative error value
58  * @exception #CKMC_API_SUCCESS Successful
59  * @exception #CKMC_API_ERROR_INPUT_PARAM input parameter is invalid
60  * @exception #CKMC_API_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
61  * @exception #CKMC_API_ERROR_DB_ALIAS_EXISTS alias already exists.
62  * @exception #CKMC_API_ERROR_INVALID_FORMAT the format of raw_key is not valid.
63  * @exception #CKMC_API_ERROR_DB_ERROR failed due to other DB transaction unexpectedly.
64  *
65  * @pre User must be already logged in and his user key is already loaded into memory in plain text form.
66  *
67  * @see ckmc_remove_key()
68  * @see ckmc_get_key()
69  * @see ckmc_get_key_alias_list()
70  * @see #ckmc_key
71  * @see #ckmc_policy
72  */
73 int ckmc_save_key(const char *alias, const ckmc_key key, const ckmc_policy policy);
74
75 /**
76  * @brief Removes a key from key manager
77  *
78  * @since_tizen 2.3
79  * @privlevel public
80  * @privilege %http://tizen.org/privilege/keymanager
81  *
82  * @remarks a client can remove only keys stored by the client.
83  *
84  * @param[in] alias is the name of a key to be removed
85  *
86  * @return 0 on success, otherwise a negative error value
87  * @exception #CKMC_API_SUCCESS Successful
88  * @exception #CKMC_API_ERROR_INPUT_PARAM input parameter is invalid
89  * @exception #CKMC_API_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
90  * @exception #CKMC_API_ERROR_DB_ERROR failed due to the error with unknown reason
91  * @exception #CKMC_API_ERROR_DB_ALIAS_UNKNOWN alias doesn't exists.
92  *
93  * @pre User must be already logged in and his user key is already loaded into memory in plain text form.
94  *
95  * @see ckmc_save_key()
96  * @see ckmc_get_key()
97  * @see ckmc_get_key_alias_list()
98  */
99 int ckmc_remove_key(const char *alias);
100
101 /**
102  * @brief Get a key from key manager
103  *
104  * @since_tizen 2.3
105  * @privlevel public
106  * @privilege %http://tizen.org/privilege/keymanager
107  *
108  * @remarks a client can access only data stored by the client and non-restricted data stored by other clients.
109  * @remarks A newly created ppkey should be destroyed by calling ckmc_key_free() if it is no longer needed.
110  *
111  * @param[in] alias is the name of a key to retrieve
112  * @param[in] password is used in decrypting a key value. If password of policy is provided in ckmc_save_key(), the same password should be provided.
113  * @param[out] ppkey is a pointer to a newly created ckmc_key handle
114  *
115  * @return 0 on success, otherwise a negative error value
116  * @exception #CKMC_API_SUCCESS Successful
117  * @exception #CKMC_API_ERROR_INPUT_PARAM input parameter is invalid
118  * @exception #CKMC_API_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
119  * @exception #CKMC_API_ERROR_DB_ERROR failed due to the error with unknown reason
120  * @exception #CKMC_API_ERROR_DB_ALIAS_UNKNOWN alias doesn't exists.
121  *
122  * @pre User must be already logged in and his user key is already loaded into memory in plain text form.
123  *
124  * @see ckmc_save_key()
125  * @see ckmc_remove_key()
126  * @see ckmc_get_key_alias_list()
127  */
128 int ckmc_get_key(const char *alias, const char *password, ckmc_key **ppkey);
129
130 /**
131  * @brief Get a all alias of keys to which the client can access
132  *
133  * @since_tizen 2.3
134  * @privlevel public
135  * @privilege %http://tizen.org/privilege/keymanager
136  *
137  * @remarks a client can access only data stored by the client and non-restricted data stored by other clients.
138  * @remarks A newly created ppalias_list should be destroyed by calling ckmc_alias_list_all_free() if it is no longer needed.
139  *
140  * @param[out] ppalias_list is a pointer to a newly created ckmc_alias_list handle containing all available alias of keys. If there is no available key alias, *ppalias_list will be null.
141  *
142  * @return 0 on success, otherwise a negative error value
143  * @exception #CKMC_API_SUCCESS Successful
144  * @exception #CKMC_API_ERROR_INPUT_PARAM input parameter is invalid
145  * @exception #CKMC_API_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
146  * @exception #CKMC_API_ERROR_DB_ERROR failed due to the error with unknown reason
147  * @exception #CKMC_API_ERROR_DB_ALIAS_UNKNOWN alias doesn't exists.
148  *
149  * @pre User must be already logged in and his user key is already loaded into memory in plain text form.
150  *
151  * @see ckmc_save_key()
152  * @see ckmc_remove_key()
153  * @see ckmc_get_key()
154  */
155 int ckmc_get_key_alias_list(ckmc_alias_list** ppalias_list);
156
157
158
159
160 /**
161  * @brief Stores a certificate inside key manager based on the provided policy.
162  *
163  * @since_tizen 2.3
164  * @privlevel public
165  * @privilege %http://tizen.org/privilege/keymanager
166  *
167  * @param[in] alias is the name of a certificate to be stored
168  * @param[in] cert has a certificate's binary value to be stored.
169  * @param[in] policy is about how to store a certificate securely.
170  *
171  * @return 0 on success, otherwise a negative error value
172  * @exception #CKMC_API_SUCCESS Successful
173  * @exception #CKMC_API_ERROR_INPUT_PARAM input parameter is invalid
174  * @exception #CKMC_API_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
175  * @exception #CKMC_API_ERROR_DB_ALIAS_EXISTS alias already exists.
176  * @exception #CKMC_API_ERROR_INVALID_FORMAT the format of raw_cert is not valid.
177  * @exception #CKMC_API_ERROR_DB_ERROR failed due to other DB transaction unexpectedly.
178  *
179  * @pre User must be already logged in and his user key is already loaded into memory in plain text form.
180  *
181  * @see ckmc_remove_cert()
182  * @see ckmc_get_cert()
183  * @see ckmc_get_cert_alias_list()
184  * @see #ckmc_cert
185  * @see #ckmc_policy
186  */
187 int ckmc_save_cert(const char *alias, const ckmc_cert cert, const ckmc_policy policy);
188
189 /**
190  * @brief Removes a certificate from key manager
191  *
192  * @since_tizen 2.3
193  * @privlevel public
194  * @privilege %http://tizen.org/privilege/keymanager
195  *
196  * @remarks a client can remove only certificates stored by the client.
197  *
198  * @param[in] alias is the name of a certificate to be removed
199  *
200  * @return 0 on success, otherwise a negative error value
201  * @exception #CKMC_API_SUCCESS Successful
202  * @exception #CKMC_API_ERROR_INPUT_PARAM input parameter is invalid
203  * @exception #CKMC_API_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
204  * @exception #CKMC_API_ERROR_DB_ERROR failed due to the error with unknown reason
205  * @exception #CKMC_API_ERROR_DB_ALIAS_UNKNOWN alias doesn't exists.
206  *
207  * @pre User must be already logged in and his user key is already loaded into memory in plain text form.
208  *
209  * @see ckmc_save_cert()
210  * @see ckmc_get_cert()
211  * @see ckmc_get_cert_alias_list()
212  */
213 int ckmc_remove_cert(const char *alias);
214
215 /**
216  * @brief Get a certificate from key manager
217  *
218  * @since_tizen 2.3
219  * @privlevel public
220  * @privilege %http://tizen.org/privilege/keymanager
221  *
222  * @remarks a client can access only certificate stored by the client and non-restricted certificate stored by other clients.
223  * @remarks A newly created ppcert should be destroyed by calling ckmc_cert_free() if it is no longer needed.
224  *
225  * @param[in] alias is the name of a certificate to retrieve
226  * @param[in] password is used in decrypting a certificate value. If password of policy is provided in ckmc_save_cert(), the same password should be provided.
227  * @param[out] ppcert is a pointer to a newly created ckmc_cert handle
228  *
229  * @return 0 on success, otherwise a negative error value
230  * @exception #CKMC_API_SUCCESS Successful
231  * @exception #CKMC_API_ERROR_INPUT_PARAM input parameter is invalid
232  * @exception #CKMC_API_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
233  * @exception #CKMC_API_ERROR_DB_ERROR failed due to the error with unknown reason
234  * @exception #CKMC_API_ERROR_DB_ALIAS_UNKNOWN alias doesn't exists.
235  *
236  * @pre User must be already logged in and his user key is already loaded into memory in plain text form.
237  *
238  * @see ckmc_save_cert()
239  * @see ckmc_remove_cert()
240  * @see ckmc_get_cert_alias_list()
241  */
242 int ckmc_get_cert(const char *alias, const char *password, ckmc_cert **ppcert);
243
244 /**
245  * @brief Get a all alias of certificates to which the client can access
246  *
247  * @since_tizen 2.3
248  * @privlevel public
249  * @privilege %http://tizen.org/privilege/keymanager
250  *
251  * @remarks a client can access only data stored by the client and non-restricted data stored by other clients.
252  * @remarks A newly created ppalias_list should be destroyed by calling ckmc_alias_list_all_free() if it is no longer needed.
253  *
254  * @param[out] ppalias_list is a pointer to a newly created ckmc_alias_list handle containing all available alias of keys. If there is no available key alias, *ppalias_list will be null.
255  *
256  * @return 0 on success, otherwise a negative error value
257  * @exception #CKMC_API_SUCCESS Successful
258  * @exception #CKMC_API_ERROR_INPUT_PARAM input parameter is invalid
259  * @exception #CKMC_API_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
260  * @exception #CKMC_API_ERROR_DB_ERROR failed due to the error with unknown reason
261  * @exception #CKMC_API_ERROR_DB_ALIAS_UNKNOWN alias doesn't exists.
262  *
263  * @pre User must be already logged in and his user key is already loaded into memory in plain text form.
264  *
265  * @see ckmc_save_cert()
266  * @see ckmc_remove_cert()
267  * @see ckmc_get_cert()
268  */
269 int ckmc_get_cert_alias_list(ckmc_alias_list** ppalias_list);
270
271
272
273
274 /**
275  * @brief Stores a data inside key manager based on the provided policy.
276  *
277  * @since_tizen 2.3
278  * @privlevel public
279  * @privilege %http://tizen.org/privilege/keymanager
280  *
281  * @param[in] alias is the name of a data to be stored
282  * @param[in] data has a binary value to be stored.
283  * @param[in] policy is about how to store a data securely.
284  *
285  * @return 0 on success, otherwise a negative error value
286  * @exception #CKMC_API_SUCCESS Successful
287  * @exception #CKMC_API_ERROR_INPUT_PARAM input parameter is invalid
288  * @exception #CKMC_API_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
289  * @exception #CKMC_API_ERROR_DB_ALIAS_EXISTS alias already exists.
290  * @exception #CKMC_API_ERROR_DB_ERROR failed due to other DB transaction unexpectedly.
291  *
292  * @pre User must be already logged in and his user key is already loaded into memory in plain text form.
293  *
294  * @see ckmc_remove_data()
295  * @see ckmc_get_data()
296  * @see ckmc_get_data_alias_list()
297  * @see #ckmc_raw_buffer
298  * @see #ckmc_policy
299  */
300 int ckmc_save_data(const char *alias, ckmc_raw_buffer data, const ckmc_policy policy);
301
302 /**
303  * @brief Removes a data from key manager
304  *
305  * @since_tizen 2.3
306  * @privlevel public
307  * @privilege %http://tizen.org/privilege/keymanager
308  *
309  * @remarks a client can remove only data stored by the client.
310  *
311  * @param[in] alias is the name of a data to be removed
312  *
313  * @return 0 on success, otherwise a negative error value
314  * @exception #CKMC_API_SUCCESS Successful
315  * @exception #CKMC_API_ERROR_INPUT_PARAM input parameter is invalid
316  * @exception #CKMC_API_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
317  * @exception #CKMC_API_ERROR_DB_ERROR failed due to the error with unknown reason
318  * @exception #CKMC_API_ERROR_DB_ALIAS_UNKNOWN alias doesn't exists.
319  *
320  * @pre User must be already logged in and his user key is already loaded into memory in plain text form.
321  *
322  * @see ckmc_save_data()
323  * @see ckmc_get_data()
324  * @see ckmc_get_data_alias_list()
325  */
326 int ckmc_remove_data(const char *alias);
327
328 /**
329  * @brief Get a data from key manager
330  *
331  * @since_tizen 2.3
332  * @privlevel public
333  * @privilege %http://tizen.org/privilege/keymanager
334  *
335  * @remarks a client can access only data stored by the client and non-restricted data stored by other clients.
336  * @remarks A newly created ppdata should be destroyed by calling ckmc_buffer_free() if it is no longer needed.
337  *
338  * @param[in] alias is the name of a data to retrieve
339  * @param[in] password is used in decrypting a data value. If password of policy is provided in ckmc_save_data(), the same password should be provided.
340  * @param[out] ppdata is a pointer to a newly created ckmc_raw_buffer handle
341  *
342  * @return 0 on success, otherwise a negative error value
343  * @exception #CKMC_API_SUCCESS Successful
344  * @exception #CKMC_API_ERROR_INPUT_PARAM input parameter is invalid
345  * @exception #CKMC_API_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
346  * @exception #CKMC_API_ERROR_DB_ERROR failed due to the error with unknown reason
347  * @exception #CKMC_API_ERROR_DB_ALIAS_UNKNOWN alias doesn't exists.
348  *
349  * @pre User must be already logged in and his user key is already loaded into memory in plain text form.
350  *
351  * @see ckmc_save_data()
352  * @see ckmc_remove_data()
353  * @see ckmc_get_data_alias_list()
354  */
355 int ckmc_get_data(const char *alias, const char *password, ckmc_raw_buffer **ppdata);
356
357 /**
358  * @brief Get a all alias of data to which the client can access
359  *
360  * @since_tizen 2.3
361  * @privlevel public
362  * @privilege %http://tizen.org/privilege/keymanager
363  *
364  * @remarks a client can access only data stored by the client and non-restricted data stored by other clients.
365  * @remarks A newly created ppalias_list should be destroyed by calling ckmc_alias_list_all_free() if it is no longer needed.
366  *
367  * @param[out] ppalias_list is a pointer to a newly created ckmc_alias_list handle containing all available alias of keys. If there is no available key alias, *ppalias_list will be null.
368  *
369  * @return 0 on success, otherwise a negative error value
370  * @exception #CKMC_API_SUCCESS Successful
371  * @exception #CKMC_API_ERROR_INPUT_PARAM input parameter is invalid
372  * @exception #CKMC_API_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
373  * @exception #CKMC_API_ERROR_DB_ERROR failed due to the error with unknown reason
374  * @exception #CKMC_API_ERROR_DB_ALIAS_UNKNOWN alias doesn't exists.
375  *
376  * @pre User must be already logged in and his user key is already loaded into memory in plain text form.
377  *
378  * @see ckmc_save_data()
379  * @see ckmc_remove_data()
380  * @see ckmc_get_data()
381  */
382 int ckmc_get_data_alias_list(ckmc_alias_list** ppalias_list);
383
384
385
386
387 /**
388  * @brief Creates RSA private/public key pair and stores them inside key manager based on each policy.
389  *
390  * @since_tizen 2.3
391  * @privlevel public
392  * @privilege %http://tizen.org/privilege/keymanager
393  *
394  * @remarks if password in policy is provided, the key is additionally encrypted with the password in policy.
395  *
396  * @param[in] size is the size of key strength to be created. 1024, 2048, and 4096 are supported.
397  * @param[in] private_key_alias is the name of private key to be stored.
398  * @param[in] public_key_alias is the name of public key to be stored.
399  * @param[in] policy_private_key is about how to store a private key securely.
400  * @param[in] policy_public_key is about how to store a public key securely.
401  *
402  * @return 0 on success, otherwise a negative error value
403  * @exception #CKMC_API_SUCCESS Successful
404  * @exception #CKMC_API_ERROR_INPUT_PARAM input parameter is invalid
405  * @exception #CKMC_API_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
406  * @exception #CKMC_API_ERROR_DB_ALIAS_EXISTS alias already exists.
407  * @exception #CKMC_API_ERROR_DB_ERROR failed due to other DB transaction unexpectedly.
408  *
409  * @pre User must be already logged in and his user key is already loaded into memory in plain text form.
410  *
411  * @see ckmc_create_key_pair_ecdsa()
412  * @see ckmc_create_signature()
413  * @see ckmc_verify_signature()
414  */
415 int ckmc_create_key_pair_rsa(const size_t size, const char *private_key_alias, const char *public_key_alias, const ckmc_policy policy_private_key, const ckmc_policy policy_public_key);
416
417 /**
418  * @brief Creates ECDSA private/public key pair and stores them inside key manager based on each policy.
419  *
420  * @since_tizen 2.3
421  * @privlevel public
422  * @privilege %http://tizen.org/privilege/keymanager
423  *
424  * @remarks if password in policy is provided, the key is additionally encrypted with the password in policy.
425  *
426  * @param[in] type is the type of eliptic curve of ECDSA.
427  * @param[in] private_key_alias is the name of private key to be stored.
428  * @param[in] public_key_alias is the name of public key to be stored.
429  * @param[in] policy_private_key is about how to store a private key securely.
430  * @param[in] policy_public_key is about how to store a public key securely.
431  *
432  * @return 0 on success, otherwise a negative error value
433  * @exception #CKMC_API_SUCCESS Successful
434  * @exception #CKMC_API_ERROR_INPUT_PARAM input parameter is invalid
435  * @exception #CKMC_API_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
436  * @exception #CKMC_API_ERROR_DB_ALIAS_EXISTS alias already exists.
437  * @exception #CKMC_API_ERROR_DB_ERROR failed due to other DB transaction unexpectedly.
438  *
439  * @pre User must be already logged in and his user key is already loaded into memory in plain text form.
440  *
441  * @see ckmc_create_key_pair_rsa()
442  * @see ckmc_create_signature()
443  * @see ckmc_verify_signature()
444  * @see #ckmc_ec_type
445  */
446 int ckmc_create_key_pair_ecdsa(const ckmc_ec_type type, const char *private_key_alias, const char *public_key_alias, const ckmc_policy policy_private_key, const ckmc_policy policy_public_key);
447
448 /**
449  * @brief Creates a signature on a given message using a private key and returns the signature
450  *
451  * @since_tizen 2.3
452  * @privlevel public
453  * @privilege %http://tizen.org/privilege/keymanager
454  *
455  * @remarks If password of policy is provided during storing a key, the same password should be provided.
456  * @remarks A newly created ppsignature should be destroyed by calling ckmc_buffer_free() if it is no longer needed.
457  *
458  *
459  * @param[in] private_key_alias is the name of private key.
460  * @param[in] password is used in decrypting a private key value.
461  * @param[in] message is signed with a private key .
462  * @param[in] hash is the hash algorithm used in creating signature.
463  * @param[in] padding is the RSA padding algorithm used in creating signature. It is used only when the signature algorithm is RSA.
464  * @param[out] ppsignature is a pointer to a newly created signature's. If an error occurs, *ppsignature will be null.
465  *
466  * @return 0 on success, otherwise a negative error value
467  * @exception #CKMC_API_SUCCESS Successful
468  * @exception #CKMC_API_ERROR_INPUT_PARAM input parameter is invalid
469  * @exception #CKMC_API_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
470  * @exception #CKMC_API_ERROR_DB_ALIAS_UNKNOWN alias doesn't exists.
471  *
472  * @pre User must be already logged in and his user key is already loaded into memory in plain text form.
473  *
474  * @see ckmc_create_key_pair_rsa()
475  * @see ckmc_create_key_pair_ecdsa()
476  * @see ckmc_verify_signature()
477  * @see ckmc_buffer_free()
478  * @see #ckmc_hash_algo
479  * @see #ckmc_rsa_padding_algo
480  */
481 int ckmc_create_signature(const char *private_key_alias, const char *password, const ckmc_raw_buffer message, const ckmc_hash_algo hash, const ckmc_rsa_padding_algo padding, ckmc_raw_buffer **ppsignature);
482
483 /**
484  * @brief Verify a given signature on a given message using a public key and returns the signature status.
485  *
486  * @since_tizen 2.3
487  * @privlevel public
488  * @privilege %http://tizen.org/privilege/keymanager
489  *
490  * @remarks If password of policy is provided during storing a key, the same password should be provided.
491  *
492  * @param[in] public_key_alias is the name of public key.
493  * @param[in] password is used in decrypting a public key value.
494  * @param[in] message is a input on which the signature is created.
495  * @param[in] signature is verified with public key.
496  * @param[in] hash is the hash algorithm used in verifying signature.
497  * @param[in] padding is the RSA padding algorithm used in verifying signature. It is used only when the signature algorithm is RSA.
498  *
499  * @return 0 on success and the signature is valid, otherwise a negative error value
500  * @exception #CKMC_API_SUCCESS Successful
501  * @exception #CKMC_API_ERROR_VERIFICATION_FAILED the signature is invalid
502  * @exception #CKMC_API_ERROR_INPUT_PARAM input parameter is invalid
503  * @exception #CKMC_API_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
504  * @exception #CKMC_API_ERROR_DB_ALIAS_UNKNOWN alias doesn't exists.
505  *
506  * @pre User must be already logged in and his user key is already loaded into memory in plain text form.
507  *
508  * @see ckmc_create_key_pair_rsa()
509  * @see ckmc_create_key_pair_ecdsa()
510  * @see ckmc_verify_signature()
511  * @see #ckmc_hash_algo
512  * @see #ckmc_rsa_padding_algo
513  */
514 int ckmc_verify_signature(const char *public_key_alias, const char *password, const ckmc_raw_buffer message, const ckmc_raw_buffer signature, const ckmc_hash_algo hash, const ckmc_rsa_padding_algo padding);
515
516 /**
517  * @brief Verify a certificate chain and return that chain.
518  *
519  * @since_tizen 2.3
520  * @privlevel public
521  * @privilege %http://tizen.org/privilege/keymanager
522  *
523  * @remarks The trusted root certificate of the chain should exist in the system's certificate storage.
524  * @remarks A newly created ppcert_chain_list should be destroyed by calling ckmc_cert_list_all_free() if it is no longer needed.
525  *
526  * @param[in] cert is the certificate to be verified
527  * @param[in] untrustedcerts is the untrusted CA certificates to be used in verifying a certificate chain.
528  * @param[out] ppcert_chain_list is a pointer to a newly created certificate chain's handle. If an error occurs, *ppcert_chain_list will be null.
529  *
530  * @return 0 on success and the signature is valid, otherwise a negative error value
531  * @exception #CKMC_API_SUCCESS Successful
532  * @exception #CKMC_API_ERROR_VERIFICATION_FAILED the certificate chain is not valid
533  * @exception #CKMC_API_ERROR_INPUT_PARAM input parameter is invalid
534  * @exception #CKMC_API_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
535  * @exception #CKMC_API_ERROR_INVALID_FORMAT the format of certificate is not valid.
536  *
537  * @pre User must be already logged in and his user key is already loaded into memory in plain text form.
538  *
539  * @see ckmc_get_cert_chain_with_alias())
540  * @see ckmc_cert_list_all_free()
541  */
542 int ckmc_get_cert_chain(const ckmc_cert *cert, const ckmc_cert_list *untrustedcerts, ckmc_cert_list **ppcert_chain_list);
543
544 /**
545  * @brief Verify a certificate chain using a alias list of untrusted certificates and return that chain.
546  *
547  * @since_tizen 2.3
548  * @privlevel public
549  * @privilege %http://tizen.org/privilege/keymanager
550  *
551  * @remarks The trusted root certificate of the chain should exist in the system's certificate storage.
552  * @remarks A newly created ppcert_chain_list should be destroyed by calling ckmc_cert_list_all_free() if it is no longer needed.
553  *
554  * @param[in] cert is the certificate to be verified
555  * @param[in] untrustedcerts is  an alias list of untrusted CA certificates stored in key manager to be used in verifying a certificate chain.
556  * @param[out] ppcert_chain_list is a pointer to a newly created certificate chain's handle. If an error occurs, *ppcert_chain_list will be null.
557  *
558  * @return 0 on success and the signature is valid, otherwise a negative error value
559  * @exception #CKMC_API_SUCCESS Successful
560  * @exception #CKMC_API_ERROR_VERIFICATION_FAILED the certificate chain is not valid
561  * @exception #CKMC_API_ERROR_INPUT_PARAM input parameter is invalid
562  * @exception #CKMC_API_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
563  * @exception #CKMC_API_ERROR_DB_ALIAS_UNKNOWN alias doesn't exists.
564  * @exception #CKMC_API_ERROR_INVALID_FORMAT the format of certificate is not valid.
565  *
566  * @pre User must be already logged in and his user key is already loaded into memory in plain text form.
567  *
568  * @see ckmc_get_cert_chain())
569  * @see ckmc_cert_list_all_free()
570  */
571 int ckmc_get_cert_chain_with_alias(const ckmc_cert *cert, const ckmc_alias_list *untrustedcerts, ckmc_cert_list **ppcert_chain_list);
572
573
574 #ifdef __cplusplus
575 }
576 #endif
577
578 /**
579  * @}
580  */
581
582
583 #endif /* __TIZEN_CORE_CKMC_MANAGER_H */