Add C language APIs of client
[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  * @author      Yuseok Jeon(yuseok.jeon@samsung.com)
19  * @version     1.0
20  * @brief       provides management functions(storing, retrieving, and removing) for keys, certificates and data of a user and additional crypto functions.
21  */
22
23
24 #ifndef CKMC_MANAGER_H
25 #define CKMC_MANAGER_H
26
27 #include <sys/types.h>
28 #include <ckmc/ckmc-type.h>
29
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33
34 // key related functions
35 int ckm_save_key(const char *alias, const ckm_key key, const ckm_policy policy);
36 int ckm_remove_key(const char *alias);
37 int ckm_get_key(const char *alias, const char *password, ckm_key **key);
38 int ckm_get_key_alias_list(const ckm_alias_list** alias_list);
39
40 int ckm_save_cert(const char *alias, const ckm_cert cert, const ckm_policy policy);
41 int ckm_remove_cert(const char *alias);
42 int ckm_get_cert(const char *alias, const char *password, const ckm_cert **cert);
43 int ckm_get_cert_alias_list(const ckm_alias_list** alias_list);
44
45 int ckm_save_data(const char *alias, ckm_raw_buffer data, const ckm_policy policy);
46 int ckm_remove_data(const char *alias);
47 int ckm_get_data(const char *alias, const char *password, ckm_raw_buffer **data);
48 int ckm_get_data_alias_list(const ckm_alias_list** alias_list);
49
50
51 // crypto functions
52 int ckm_create_key_pair_rsa(const int size, const char *private_key_alias, const char *public_key_alias, const ckm_policy policy_private_key, const ckm_policy policy_public_key);
53 int ckm_create_key_pair_ecdsa(const ckm_ec_type type, const char *private_key_alias, const char *public_key_alias, const ckm_policy policy_private_key, const ckm_policy policy_public_key);
54 int ckm_create_signature(const char *private_key_alias, const char *password, const ckm_raw_buffer message, const ckm_hash_algo hash, const ckm_rsa_padding_algo padding, ckm_raw_buffer **signature);
55 int ckm_verify_signature(const char *public_key_alias, const char *password, const ckm_raw_buffer message, const ckm_raw_buffer signature, const ckm_hash_algo hash, const ckm_rsa_padding_algo padding);
56
57 int ckm_get_cert_chain(const ckm_cert *cert, const ckm_cert_list *untrustedcerts, ckm_cert_list **cert_chain_list);
58 int ckm_get_cert_chain_with_alias(const ckm_cert *cert, const ckm_alias_list *untrustedcerts, ckm_cert_list **cert_chain_list);
59
60
61 #ifdef __cplusplus
62 }
63 #endif
64
65
66 #endif /* CKMC_MANAGER_H */