2 * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License
17 * @file ckmc-manager.h
19 * @brief Provides management functions(storing, retrieving, and removing) for keys, certificates and data of a user and additional crypto functions.
23 #ifndef __TIZEN_CORE_CKMC_MANAGER_H
24 #define __TIZEN_CORE_CKMC_MANAGER_H
27 #include <sys/types.h>
29 #include <ckmc/ckmc-type.h>
30 #include <ckmc/ckmc-error.h>
37 * @addtogroup CAPI_KEY_MANAGER_CLIENT_MODULE
43 * @brief Stores a key inside key manager based on the provided policy.
47 * @privilege %http://tizen.org/privilege/keymanager
49 * @remarks Currently only four types of keys are supported for this API. These are RSA public/private key and ECDSA /private key.
50 * @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.
51 * @remarks Some private key files are protected by a password. if raw_key in key read from those encrypted files is encrypted with a password, the password should be provided in the #ckmc_key_s structure.
52 * @remarks if password in policy is provided, the key is additionally encrypted with the password in policy.
54 * @param[in] alias the name of a key to be stored
55 * @param[in] key a key's binary value to be stored.
56 * @param[in] policy about how to store a key securely.
58 * @return 0 on success, otherwise a negative error value
59 * @retval #CKMC_ERROR_NONE Successful
60 * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
61 * @retval #CKMC_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
62 * @retval #CKMC_ERROR_DB_ALIAS_EXISTS alias already exists.
63 * @retval #CKMC_ERROR_INVALID_FORMAT the format of raw_key is not valid.
64 * @retval #CKMC_ERROR_DB_ERROR failed due to other DB transaction unexpectedly.
65 * @retval #CKMC_ERROR_PERMISSION_DENIED failed to access key manager
67 * @pre User must be already logged in and his user key is already loaded into memory in plain text form.
69 * @see ckmc_remove_key()
71 * @see ckmc_get_key_alias_list()
75 int ckmc_save_key(const char *alias, const ckmc_key_s key, const ckmc_policy_s policy);
78 * @brief Removes a key from key manager
82 * @privilege %http://tizen.org/privilege/keymanager
84 * @remarks a client can remove only keys stored by the client.
86 * @param[in] alias the name of a key to be removed
88 * @return 0 on success, otherwise a negative error value
89 * @retval #CKMC_ERROR_NONE Successful
90 * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
91 * @retval #CKMC_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
92 * @retval #CKMC_ERROR_DB_ERROR failed due to the error with unknown reason
93 * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN alias doesn't exists.
94 * @retval #CKMC_ERROR_PERMISSION_DENIED failed to access key manager
96 * @pre User must be already logged in and his user key is already loaded into memory in plain text form.
98 * @see ckmc_save_key()
100 * @see ckmc_get_key_alias_list()
102 int ckmc_remove_key(const char *alias);
105 * @brief Gets a key from key manager
109 * @privilege %http://tizen.org/privilege/keymanager
111 * @remarks a client can access only data stored by the client and non-restricted data stored by other clients.
112 * @remarks A newly created ppkey should be destroyed by calling ckmc_key_free() if it is no longer needed.
114 * @param[in] alias the name of a key to retrieve
115 * @param[in] password used in decrypting a key value. If password of policy is provided in ckmc_save_key(), the same password should be provided.
116 * @param[out] ppkey a pointer to a newly created ckmc_key_s handle
118 * @return 0 on success, otherwise a negative error value
119 * @retval #CKMC_ERROR_NONE Successful
120 * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
121 * @retval #CKMC_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
122 * @retval #CKMC_ERROR_DB_ERROR failed due to the error with unknown reason
123 * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN alias doesn't exists.
124 * @retval #CKMC_ERROR_PERMISSION_DENIED failed to access key manager
125 * @retval #CKMC_ERROR_NOT_EXPORTABLE a key is not exportable and could not be returned to client
126 * @pre User must be already logged in and his user key is already loaded into memory in plain text form.
128 * @see ckmc_save_key()
129 * @see ckmc_remove_key()
130 * @see ckmc_get_key_alias_list()
132 int ckmc_get_key(const char *alias, const char *password, ckmc_key_s **ppkey);
135 * @brief Gets a all alias of keys to which the client can access
139 * @privilege %http://tizen.org/privilege/keymanager
141 * @remarks a client can access only data stored by the client and non-restricted data stored by other clients.
142 * @remarks A newly created ppalias_list should be destroyed by calling ckmc_alias_list_all_free() if it is no longer needed.
144 * @param[out] ppalias_list a pointer to a newly created ckmc_alias_list_s handle containing all available alias of keys. If there is no available key alias, *ppalias_list will be null.
146 * @return 0 on success, otherwise a negative error value
147 * @retval #CKMC_ERROR_NONE Successful
148 * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
149 * @retval #CKMC_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
150 * @retval #CKMC_ERROR_DB_ERROR failed due to the error with unknown reason
151 * @retval #CKMC_ERROR_PERMISSION_DENIED failed to access key manager
153 * @pre User must be already logged in and his user key is already loaded into memory in plain text form.
155 * @see ckmc_save_key()
156 * @see ckmc_remove_key()
157 * @see ckmc_get_key()
159 int ckmc_get_key_alias_list(ckmc_alias_list_s** ppalias_list);
165 * @brief Stores a certificate inside key manager based on the provided policy.
169 * @privilege %http://tizen.org/privilege/keymanager
171 * @param[in] alias the name of a certificate to be stored
172 * @param[in] cert a certificate's binary value to be stored.
173 * @param[in] policy about how to store a certificate securely.
175 * @return 0 on success, otherwise a negative error value
176 * @retval #CKMC_ERROR_NONE Successful
177 * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
178 * @retval #CKMC_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
179 * @retval #CKMC_ERROR_DB_ALIAS_EXISTS alias already exists.
180 * @retval #CKMC_ERROR_INVALID_FORMAT the format of raw_cert is not valid.
181 * @retval #CKMC_ERROR_DB_ERROR failed due to other DB transaction unexpectedly.
182 * @retval #CKMC_ERROR_PERMISSION_DENIED failed to access key manager
184 * @pre User must be already logged in and his user key is already loaded into memory in plain text form.
186 * @see ckmc_remove_cert()
187 * @see ckmc_get_cert()
188 * @see ckmc_get_cert_alias_list()
190 * @see #ckmc_policy_s
192 int ckmc_save_cert(const char *alias, const ckmc_cert_s cert, const ckmc_policy_s policy);
195 * @brief Removes a certificate from key manager
199 * @privilege %http://tizen.org/privilege/keymanager
201 * @remarks a client can remove only certificates stored by the client.
203 * @param[in] alias the name of a certificate to be removed
205 * @return 0 on success, otherwise a negative error value
206 * @retval #CKMC_ERROR_NONE Successful
207 * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
208 * @retval #CKMC_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
209 * @retval #CKMC_ERROR_DB_ERROR failed due to the error with unknown reason
210 * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN alias doesn't exists.
211 * @retval #CKMC_ERROR_PERMISSION_DENIED failed to access key manager
213 * @pre User must be already logged in and his user key is already loaded into memory in plain text form.
215 * @see ckmc_save_cert()
216 * @see ckmc_get_cert()
217 * @see ckmc_get_cert_alias_list()
219 int ckmc_remove_cert(const char *alias);
222 * @brief Gets a certificate from key manager
226 * @privilege %http://tizen.org/privilege/keymanager
228 * @remarks a client can access only certificate stored by the client and non-restricted certificate stored by other clients.
229 * @remarks A newly created ppcert should be destroyed by calling ckmc_cert_free() if it is no longer needed.
231 * @param[in] alias the name of a certificate to retrieve
232 * @param[in] password used in decrypting a certificate value. If password of policy is provided in ckmc_save_cert(), the same password should be provided.
233 * @param[out] ppcert a pointer to a newly created ckmc_cert_s handle
235 * @return 0 on success, otherwise a negative error value
236 * @retval #CKMC_ERROR_NONE Successful
237 * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
238 * @retval #CKMC_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
239 * @retval #CKMC_ERROR_DB_ERROR failed due to the error with unknown reason
240 * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN alias doesn't exists.
241 * @retval #CKMC_ERROR_PERMISSION_DENIED failed to access key manager
242 * @retval #CKMC_ERROR_NOT_EXPORTABLE a certification is not exportable and could not be returned to client
244 * @pre User must be already logged in and his user key is already loaded into memory in plain text form.
246 * @see ckmc_save_cert()
247 * @see ckmc_remove_cert()
248 * @see ckmc_get_cert_alias_list()
250 int ckmc_get_cert(const char *alias, const char *password, ckmc_cert_s **ppcert);
253 * @brief Gets a all alias of certificates to which the client can access
257 * @privilege %http://tizen.org/privilege/keymanager
259 * @remarks a client can access only data stored by the client and non-restricted data stored by other clients.
260 * @remarks A newly created ppalias_list should be destroyed by calling ckmc_alias_list_all_free() if it is no longer needed.
262 * @param[out] ppalias_list a pointer to a newly created ckmc_alias_list_s handle containing all available alias of keys. If there is no available key alias, *ppalias_list will be null.
264 * @return 0 on success, otherwise a negative error value
265 * @retval #CKMC_ERROR_NONE Successful
266 * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
267 * @retval #CKMC_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
268 * @retval #CKMC_ERROR_DB_ERROR failed due to the error with unknown reason
269 * @retval #CKMC_ERROR_PERMISSION_DENIED failed to access key manager
271 * @pre User must be already logged in and his user key is already loaded into memory in plain text form.
273 * @see ckmc_save_cert()
274 * @see ckmc_remove_cert()
275 * @see ckmc_get_cert()
277 int ckmc_get_cert_alias_list(ckmc_alias_list_s** ppalias_list);
283 * @brief Stores a data inside key manager based on the provided policy.
287 * @privilege %http://tizen.org/privilege/keymanager
289 * @param[in] alias the name of a data to be stored
290 * @param[in] data a binary value to be stored.
291 * @param[in] policy about how to store a data securely.
293 * @return 0 on success, otherwise a negative error value
294 * @retval #CKMC_ERROR_NONE Successful
295 * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
296 * @retval #CKMC_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
297 * @retval #CKMC_ERROR_DB_ALIAS_EXISTS alias already exists.
298 * @retval #CKMC_ERROR_DB_ERROR failed due to other DB transaction unexpectedly.
299 * @retval #CKMC_ERROR_PERMISSION_DENIED failed to access key manager
301 * @pre User must be already logged in and his user key is already loaded into memory in plain text form.
303 * @see ckmc_remove_data()
304 * @see ckmc_get_data()
305 * @see ckmc_get_data_alias_list()
306 * @see #ckmc_raw_buffer_s
307 * @see #ckmc_policy_s
309 int ckmc_save_data(const char *alias, ckmc_raw_buffer_s data, const ckmc_policy_s policy);
312 * @brief Removes a data from key manager
316 * @privilege %http://tizen.org/privilege/keymanager
318 * @remarks a client can remove only data stored by the client.
320 * @param[in] alias the name of a data to be removed
322 * @return 0 on success, otherwise a negative error value
323 * @retval #CKMC_ERROR_NONE Successful
324 * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
325 * @retval #CKMC_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
326 * @retval #CKMC_ERROR_DB_ERROR failed due to the error with unknown reason
327 * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN alias doesn't exists.
328 * @retval #CKMC_ERROR_PERMISSION_DENIED failed to access key manager
330 * @pre User must be already logged in and his user key is already loaded into memory in plain text form.
332 * @see ckmc_save_data()
333 * @see ckmc_get_data()
334 * @see ckmc_get_data_alias_list()
336 int ckmc_remove_data(const char *alias);
339 * @brief Gets a data from key manager
343 * @privilege %http://tizen.org/privilege/keymanager
345 * @remarks a client can access only data stored by the client and non-restricted data stored by other clients.
346 * @remarks A newly created ppdata should be destroyed by calling ckmc_buffer_free() if it is no longer needed.
348 * @param[in] alias the name of a data to retrieve
349 * @param[in] password used in decrypting a data value. If password of policy is provided in ckmc_save_data(), the same password should be provided.
350 * @param[out] ppdata a pointer to a newly created ckmc_raw_buffer_s handle
352 * @return 0 on success, 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 in)
356 * @retval #CKMC_ERROR_DB_ERROR failed due to the error with unknown reason
357 * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN alias doesn't exists.
358 * @retval #CKMC_ERROR_PERMISSION_DENIED failed to access key manager
359 * @retval #CKMC_ERROR_NOT_EXPORTABLE data is not exportable and could not be returned to client
361 * @pre User must be already logged in and his user key is already loaded into memory in plain text form.
363 * @see ckmc_save_data()
364 * @see ckmc_remove_data()
365 * @see ckmc_get_data_alias_list()
367 int ckmc_get_data(const char *alias, const char *password, ckmc_raw_buffer_s **ppdata);
370 * @brief Gets a all alias of data to which the client can access
374 * @privilege %http://tizen.org/privilege/keymanager
376 * @remarks a client can access only data stored by the client and non-restricted data stored by other clients.
377 * @remarks A newly created ppalias_list should be destroyed by calling ckmc_alias_list_all_free() if it is no longer needed.
379 * @param[out] ppalias_list a pointer to a newly created ckmc_alias_list_s handle containing all available alias of keys. If there is no available key alias, *ppalias_list will be null.
381 * @return 0 on success, otherwise a negative error value
382 * @retval #CKMC_ERROR_NONE Successful
383 * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
384 * @retval #CKMC_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
385 * @retval #CKMC_ERROR_DB_ERROR failed due to the error with unknown reason
386 * @retval #CKMC_ERROR_PERMISSION_DENIED failed to access key manager
388 * @pre User must be already logged in and his user key is already loaded into memory in plain text form.
390 * @see ckmc_save_data()
391 * @see ckmc_remove_data()
392 * @see ckmc_get_data()
394 int ckmc_get_data_alias_list(ckmc_alias_list_s** ppalias_list);
400 * @brief Creates RSA private/public key pair and stores them inside key manager based on each policy.
404 * @privilege %http://tizen.org/privilege/keymanager
406 * @remarks if password in policy is provided, the key is additionally encrypted with the password in policy.
408 * @param[in] size the size of key strength to be created. 1024, 2048, and 4096 are supported.
409 * @param[in] private_key_alias the name of private key to be stored.
410 * @param[in] public_key_alias the name of public key to be stored.
411 * @param[in] policy_private_key about how to store a private key securely.
412 * @param[in] policy_public_key about how to store a public key securely.
414 * @return 0 on success, otherwise a negative error value
415 * @retval #CKMC_ERROR_NONE Successful
416 * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
417 * @retval #CKMC_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
418 * @retval #CKMC_ERROR_DB_ALIAS_EXISTS alias already exists.
419 * @retval #CKMC_ERROR_DB_ERROR failed due to other DB transaction unexpectedly.
420 * @retval #CKMC_ERROR_PERMISSION_DENIED failed to access key manager
422 * @pre User must be already logged in and his user key is already loaded into memory in plain text form.
424 * @see ckmc_create_key_pair_ecdsa()
425 * @see ckmc_create_signature()
426 * @see ckmc_verify_signature()
428 int ckmc_create_key_pair_rsa(const size_t size, const char *private_key_alias, const char *public_key_alias, const ckmc_policy_s policy_private_key, const ckmc_policy_s policy_public_key);
431 * @brief Creates ECDSA private/public key pair and stores them inside key manager based on each policy.
435 * @privilege %http://tizen.org/privilege/keymanager
437 * @remarks if password in policy is provided, the key is additionally encrypted with the password in policy.
439 * @param[in] type the type of eliptic curve of ECDSA.
440 * @param[in] private_key_alias the name of private key to be stored.
441 * @param[in] public_key_alias the name of public key to be stored.
442 * @param[in] policy_private_key about how to store a private key securely.
443 * @param[in] policy_public_key about how to store a public key securely.
445 * @return 0 on success, otherwise a negative error value
446 * @retval #CKMC_ERROR_NONE Successful
447 * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
448 * @retval #CKMC_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
449 * @retval #CKMC_ERROR_DB_ALIAS_EXISTS alias already exists.
450 * @retval #CKMC_ERROR_DB_ERROR failed due to other DB transaction unexpectedly.
451 * @retval #CKMC_ERROR_PERMISSION_DENIED failed to access key manager
453 * @pre User must be already logged in and his user key is already loaded into memory in plain text form.
455 * @see ckmc_create_key_pair_rsa()
456 * @see ckmc_create_signature()
457 * @see ckmc_verify_signature()
458 * @see #ckmc_ec_type_e
460 int ckmc_create_key_pair_ecdsa(const ckmc_ec_type_e type, const char *private_key_alias, const char *public_key_alias, const ckmc_policy_s policy_private_key, const ckmc_policy_s policy_public_key);
463 * @brief Creates a signature on a given message using a private key and returns the signature
467 * @privilege %http://tizen.org/privilege/keymanager
469 * @remarks If password of policy is provided during storing a key, the same password should be provided.
470 * @remarks A newly created ppsignature should be destroyed by calling ckmc_buffer_free() if it is no longer needed.
473 * @param[in] private_key_alias the name of private key.
474 * @param[in] password used in decrypting a private key value.
475 * @param[in] message signed with a private key .
476 * @param[in] hash the hash algorithm used in creating signature.
477 * @param[in] padding the RSA padding algorithm used in creating signature. It is used only when the signature algorithm is RSA.
478 * @param[out] ppsignature a pointer to a newly created signature's. If an error occurs, *ppsignature will be null.
480 * @return 0 on success, otherwise a negative error value
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 in)
484 * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN alias doesn't exists.
485 * @retval #CKMC_ERROR_PERMISSION_DENIED failed to access key manager
487 * @pre User must be already logged in and his user key is already loaded into memory in plain text form.
489 * @see ckmc_create_key_pair_rsa()
490 * @see ckmc_create_key_pair_ecdsa()
491 * @see ckmc_verify_signature()
492 * @see ckmc_buffer_free()
493 * @see #ckmc_hash_algo_e
494 * @see #ckmc_rsa_padding_algo_e
496 int ckmc_create_signature(const char *private_key_alias, const char *password, const ckmc_raw_buffer_s message, const ckmc_hash_algo_e hash, const ckmc_rsa_padding_algo_e padding, ckmc_raw_buffer_s **ppsignature);
499 * @brief Verifies a given signature on a given message using a public key and returns the signature status.
503 * @privilege %http://tizen.org/privilege/keymanager
505 * @remarks If password of policy is provided during storing a key, the same password should be provided.
507 * @param[in] public_key_alias the name of public key.
508 * @param[in] password used in decrypting a public key value.
509 * @param[in] message a input on which the signature is created.
510 * @param[in] signature verified with public key.
511 * @param[in] hash the hash algorithm used in verifying signature.
512 * @param[in] padding the RSA padding algorithm used in verifying signature. It is used only when the signature algorithm is RSA.
514 * @return 0 on success and the signature is valid, otherwise a negative error value
515 * @retval #CKMC_ERROR_NONE Successful
516 * @retval #CKMC_ERROR_VERIFICATION_FAILED the signature is invalid
517 * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
518 * @retval #CKMC_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
519 * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN alias doesn't exists.
520 * @retval #CKMC_ERROR_PERMISSION_DENIED failed to access key manager
522 * @pre User must be already logged in and his user key is already loaded into memory in plain text form.
524 * @see ckmc_create_key_pair_rsa()
525 * @see ckmc_create_key_pair_ecdsa()
526 * @see ckmc_verify_signature()
527 * @see #ckmc_hash_algo_e
528 * @see #ckmc_rsa_padding_algo_e
530 int ckmc_verify_signature(const char *public_key_alias, const char *password, const ckmc_raw_buffer_s message, const ckmc_raw_buffer_s signature, const ckmc_hash_algo_e hash, const ckmc_rsa_padding_algo_e padding);
533 * @brief Verifies a certificate chain and return that chain.
537 * @privilege %http://tizen.orckmc_buffer_freeg/privilege/keymanager
539 * @remarks The trusted root certificate of the chain should exist in the system's certificate storage.
540 * @remarks A newly created ppcert_chain_list should be destroyed by calling ckmc_cert_list_all_free() if it is no longer needed.
542 * @param[in] cert the certificate to be verified
543 * @param[in] untrustedcerts the untrusted CA certificates to be used in verifying a certificate chain.
544 * @param[out] ppcert_chain_list a pointer to a newly created certificate chain's handle. If an error occurs, *ppcert_chain_list will be null.
546 * @return 0 on success and the signature is valid, otherwise a negative error value
547 * @retval #CKMC_ERROR_NONE Successful
548 * @retval #CKMC_ERROR_VERIFICATION_FAILED the certificate chain is not valid
549 * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
550 * @retval #CKMC_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
551 * @retval #CKMC_ERROR_INVALID_FORMAT the format of certificate is not valid.
552 * @retval #CKMC_ERROR_PERMISSION_DENIED failed to access key manager
554 * @pre User must be already logged in and his user key is already loaded into memory in plain text form.
556 * @see ckmc_get_cert_chain_with_alias())
557 * @see ckmc_cert_list_all_free()
559 int ckmc_get_cert_chain(const ckmc_cert_s *cert, const ckmc_cert_list_s *untrustedcerts, ckmc_cert_list_s **ppcert_chain_list);
562 * @brief Verifies a certificate chain using a alias list of untrusted certificates and return that chain.
566 * @privilege %http://tizen.org/privilege/keymanager
568 * @remarks The trusted root certificate of the chain should exist in the system's certificate storage.
569 * @remarks A newly created ppcert_chain_list should be destroyed by calling ckmc_cert_list_all_free() if it is no longer needed.
571 * @param[in] cert the certificate to be verified
572 * @param[in] untrustedcerts an alias list of untrusted CA certificates stored in key manager to be used in verifying a certificate chain.
573 * @param[out] ppcert_chain_list a pointer to a newly created certificate chain's handle. If an error occurs, *ppcert_chain_list will be null.
575 * @return 0 on success and the signature is valid, otherwise a negative error value
576 * @retval #CKMC_ERROR_NONE Successful
577 * @retval #CKMC_ERROR_VERIFICATION_FAILED the certificate chain is not valid
578 * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
579 * @retval #CKMC_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
580 * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN alias doesn't exists.
581 * @retval #CKMC_ERROR_INVALID_FORMAT the format of certificate is not valid.
582 * @retval #CKMC_ERROR_PERMISSION_DENIED failed to access key manager
584 * @pre User must be already logged in and his user key is already loaded into memory in plain text form.
586 * @see ckmc_get_cert_chain())
587 * @see ckmc_cert_list_all_free()
589 int ckmc_get_cert_chain_with_alias(const ckmc_cert_s *cert, const ckmc_alias_list_s *untrustedcerts, ckmc_cert_list_s **ppcert_chain_list);
601 #endif /* __TIZEN_CORE_CKMC_MANAGER_H */