Derivation API extension
[platform/core/security/key-manager.git] / src / include / ckmc / ckmc-type.h
1 /*
2  * Copyright (c) 2000 - 2021 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-type.h
18  * @version 1.0
19  * @brief Definitions of struct for the Key Manager's CAPI and their utility functions.
20  */
21
22
23 #ifndef __TIZEN_CORE_CKMC_TYPE_H
24 #define __TIZEN_CORE_CKMC_TYPE_H
25
26
27 #include <stddef.h>
28 #include <stdint.h>
29 #include <ckmc/ckmc-error.h>
30
31
32 #define KEY_MANAGER_CAPI __attribute__((visibility("default")))
33
34
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38
39
40 /**
41  * @addtogroup CAPI_KEY_MANAGER_TYPES_MODULE
42  * @{
43  */
44
45
46 /*
47  * Note: on tizen 3.0 owner id is equal to pkgId.
48  *       Preinstalled system(uid < 5000) and user (uid >= 5000) applications
49  *       does not have any pkgId. That's why ckm uses special "virtual"
50  *       pkgid for them. The virtual strings are defined under:
51  *                       ckmc_owner_id_system
52  */
53
54
55 /**
56  * @deprecated Deprecated since 3.0. [Use ckmc_owner_id_separator instead]
57  * @brief Separator between alias and label.
58  * @since_tizen 2.3
59  * @remarks Alias can be provided as an alias alone, or together with label - in this
60  *          case, separator " " (space bar) is used to separate label and alias.
61  * @see #ckmc_owner_id_separator
62  */
63 KEY_MANAGER_CAPI extern char const *const ckmc_label_name_separator;
64
65
66 /**
67  * @brief Separator between alias and owner id.
68  * @since_tizen 3.0
69  * @remarks Alias can be provided as an alias alone, or together with owner id.
70  *          In this case, separator " " (space bar) is used to separate id and alias.
71  * @see ckmc_alias_new()
72  */
73 KEY_MANAGER_CAPI extern char const *const ckmc_owner_id_separator;
74
75
76 /**
77  * @brief The owner of system database.
78  * @since_tizen 3.0
79  * @remarks #ckmc_owner_id_system contains id connected with all system applications that run with uid less than 5000.
80  *          Client should use #ckmc_owner_id_system to access data owned by system application and stored in system database.
81  *          Client must have permission to access proper row.
82  * @see ckmc_alias_new()
83  */
84 KEY_MANAGER_CAPI extern char const *const ckmc_owner_id_system;
85
86
87 /**
88  * @brief Enumeration for key types of key manager.
89  * @since_tizen 2.3
90  */
91 typedef enum __ckmc_key_type {
92         CKMC_KEY_NONE = 0, /**< Key type not specified */
93         CKMC_KEY_RSA_PUBLIC, /**< RSA public key */
94         CKMC_KEY_RSA_PRIVATE, /**< RSA private key */
95         CKMC_KEY_ECDSA_PUBLIC, /**< ECDSA public key */
96         CKMC_KEY_ECDSA_PRIVATE, /**< ECDSA private key */
97         CKMC_KEY_DSA_PUBLIC, /**< DSA public key */
98         CKMC_KEY_DSA_PRIVATE, /**< DSA private key */
99         CKMC_KEY_AES, /**< AES key */
100 } ckmc_key_type_e;
101
102
103 /**
104  * @brief Enumeration for data format.
105  * @since_tizen 2.3
106  */
107 typedef enum __ckmc_data_format {
108         CKMC_FORM_DER_BASE64 = 0, /**< DER format base64 encoded data */
109         CKMC_FORM_DER, /**< DER encoded data */
110         CKMC_FORM_PEM /**< PEM encoded data. It consists of the DER format base64 encoded
111                   with additional header and footer lines. */
112 } ckmc_data_format_e;
113
114
115 /**
116  * @brief Enumeration for elliptic curve.
117  * @since_tizen 2.3
118  */
119 typedef enum __ckmc_ec_type {
120         CKMC_EC_PRIME192V1 = 0, /**< Elliptic curve domain "secp192r1" listed in "SEC 2" recommended
121                             elliptic curve domain */
122         CKMC_EC_PRIME256V1, /**< "SEC 2" recommended elliptic curve domain - secp256r1 */
123         CKMC_EC_SECP384R1 /**< NIST curve P-384(covers "secp384r1", the elliptic curve domain
124                       listed in See SEC 2 */
125 } ckmc_ec_type_e;
126
127
128 /**
129  * @brief Enumeration for hash algorithm.
130  * @since_tizen 2.3
131  */
132 typedef enum __ckmc_hash_algo {
133         CKMC_HASH_NONE = 0, /**< No Hash Algorithm */
134         CKMC_HASH_SHA1, /**< Hash Algorithm SHA1 */
135         CKMC_HASH_SHA256, /**< Hash Algorithm SHA256 */
136         CKMC_HASH_SHA384, /**< Hash Algorithm SHA384 */
137         CKMC_HASH_SHA512 /**< Hash Algorithm SHA512 */
138 } ckmc_hash_algo_e;
139
140
141 /**
142  * @brief Enumeration for RSA padding algorithm.
143  * @since_tizen 2.3
144  */
145 typedef enum __ckmc_rsa_padding_algo {
146         CKMC_NONE_PADDING = 0, /**< No Padding */
147         CKMC_PKCS1_PADDING, /**< PKCS#1 Padding */
148         CKMC_X931_PADDING /**< X9.31 padding */
149 } ckmc_rsa_padding_algo_e;
150
151
152 /**
153  * @deprecated Deprecated since @if MOBILE 2.4. @elseif WEARABLE 3.0. @endif [Use ckmc_permission_e() instead]
154  * @brief Enumeration for database access rights.
155  * @since_tizen 2.3
156  */
157 typedef enum __ckmc_access_right {
158         CKMC_AR_READ = 0, /**< Access right for read*/
159         CKMC_AR_READ_REMOVE /**< Access right for read and remove*/
160 } ckmc_access_right_e;
161
162
163 /**
164  * @brief Enumeration for permissions to access/modify alias.
165  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
166  */
167 typedef enum __ckmc_permission {
168         CKMC_PERMISSION_NONE = 0x00, /**< Clear permissions */
169         CKMC_PERMISSION_READ = 0x01, /**< Read allowed */
170         CKMC_PERMISSION_REMOVE = 0x02 /**< Remove allowed */
171 } ckmc_permission_e;
172
173
174 /**
175  * @brief The structure for binary buffer used in key manager CAPI.
176  * @since_tizen 2.3
177  */
178 typedef struct __ckmc_raw_buff {
179         unsigned char *data; /**< Byte array containing binary data */
180         size_t size; /**< The size of the binary data */
181 } ckmc_raw_buffer_s;
182
183
184 /**
185  * @brief The structure for a policy for storing key/certificate/binary data.
186  * @since_tizen 2.3
187  */
188 typedef struct __ckmc_policy {
189         char *password; /**< Byte array used to encrypt data inside CKM. If it is not null, the data
190                     (or key, or certificate) is stored encrypted with this password inside
191                     key manager */
192         bool extractable; /**< If true key may be extracted from storage */
193 } ckmc_policy_s;
194
195
196 /**
197  * @brief The structure for key used in key manager CAPI.
198  * @since_tizen 2.3
199  */
200 typedef struct __ckmc_key {
201         unsigned char
202         *raw_key; /**< Byte array of key. raw_key may be encrypted with password */
203         size_t key_size; /**< The byte size of raw_key */
204         ckmc_key_type_e key_type; /**< The raw_key's type */
205         char *password; /**< Byte array used to decrypt data raw_key inside key manager. */
206 } ckmc_key_s;
207
208
209 /**
210  * @brief The structure for certificate used in key manager CAPI.
211  * @since_tizen 2.3
212  */
213 typedef struct __ckmc_cert {
214         unsigned char *raw_cert; /**< Byte array of certificate */
215         size_t cert_size; /**< Byte size of raw_cert */
216         ckmc_data_format_e data_format; /**< Raw_cert's encoding format */
217 } ckmc_cert_s;
218
219
220 /**
221  * @brief The structure for linked list of alias.
222  * @since_tizen 2.3
223  */
224 typedef struct __ckmc_alias_list {
225         char *alias; /**< The name of key, certificate or data stored in key manager */
226         struct __ckmc_alias_list
227                 *next; /**< The pointer pointing to the next ckmc_alias_list_s */
228 } ckmc_alias_list_s;
229
230 struct ckmc_alias_info_s;
231
232 /**
233  * @brief The structure of alias and additional information about it.
234  * @since_tizen 5.5
235  */
236 typedef struct ckmc_alias_info_s ckmc_alias_info_s;
237
238 /**
239  * @brief The structure for linked list of alias with additional information.
240  * @since_tizen 5.5
241  */
242 typedef struct __ckmc_alias_info_list_s {
243         struct ckmc_alias_info_s* info; /**< The pointer pointing to the alias structure
244                                           with additional information */
245         struct __ckmc_alias_info_list_s*
246                 next; /**< The pointer pointing to the next ckmc_alias_info_list_s */
247 } ckmc_alias_info_list_s;
248
249
250 /**
251  * @brief The structure for linked list of ckmc_cert_s
252  * @since_tizen 2.3
253  */
254 typedef struct __ckmc_cert_list {
255         ckmc_cert_s *cert; /**< The pointer of ckmc_cert_s */
256         struct __ckmc_cert_list
257                 *next; /**< The pointer pointing to the next ckmc_cert_list_s */
258 } ckmc_cert_list_s;
259
260
261 /**
262  * @brief Enumeration for OCSP status.
263  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
264  */
265 typedef enum __ckmc_ocsp_status {
266         CKMC_OCSP_STATUS_GOOD = 0, /**< OCSP status is good */
267         CKMC_OCSP_STATUS_REVOKED, /**< The certificate is revoked */
268         CKMC_OCSP_STATUS_UNKNOWN, /**< Unknown error */
269         CKMC_OCSP_ERROR_UNSUPPORTED, /**< The certificate does not provide OCSP extension */
270         CKMC_OCSP_ERROR_INVALID_URL, /**< The invalid URL in certificate OCSP extension */
271         CKMC_OCSP_ERROR_INVALID_RESPONSE, /**< The invalid response from OCSP server */
272         CKMC_OCSP_ERROR_REMOTE, /**< OCSP remote server error */
273         CKMC_OCSP_ERROR_NET, /**< Network connection error */
274         CKMC_OCSP_ERROR_INTERNAL /**< OpenSSL API error */
275 } ckmc_ocsp_status_e;
276
277
278 /**
279  * @brief The structure for PKCS12 used in key manager CAPI.
280  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
281  */
282 typedef struct __ckmc_pkcs12 {
283         ckmc_key_s *priv_key; /**< The private key, may be null */
284         ckmc_cert_s *cert; /**< The certificate, may be null */
285         ckmc_cert_list_s *ca_chain; /**< The chain certificate list, may be null */
286 } ckmc_pkcs12_s;
287
288
289 /**
290  * @brief Enumeration for crypto algorithm parameters.
291  * @since_tizen 3.0
292  * @see #ckmc_algo_type_e
293  */
294 typedef enum __ckmc_param_name {
295         CKMC_PARAM_ALGO_TYPE = 1,
296
297         CKMC_PARAM_ED_IV = 101, /**< 16B buffer (up to 2^64-1 bytes long in case of AES GCM) */
298         CKMC_PARAM_ED_CTR_LEN, /**< integer - ctr length in bits*/
299         CKMC_PARAM_ED_AAD, /**< buffer */
300         CKMC_PARAM_ED_TAG_LEN, /**< integer - tag length in bits */
301         CKMC_PARAM_ED_LABEL, /**< buffer */
302
303         CKMC_PARAM_KDF_PRF = 401, /**< integer - pseudo-random function number (see #ckmc_kdf_prf_e) */
304         CKMC_PARAM_KDF_LEN, /**< integer - length of the derived key in bytes. The value must be one of
305                             {16, 24, 32} */
306
307         CKMC_PARAM_KBKDF_MODE, /**< integer - KDF mode number (see #ckmc_kbkdf_mode_e) */
308         CKMC_PARAM_KBKDF_LABEL, /**< buffer - the purpose for the derived key. Conflicts with
309                                 #CKMC_PARAM_KBKDF_FIXED_INPUT */
310
311         CKMC_PARAM_KBKDF_CONTEXT, /**< buffer - information related to the derived key. Conflicts with
312                                   #CKMC_PARAM_KBKDF_FIXED_INPUT */
313
314         CKMC_PARAM_KBKDF_FIXED_INPUT, /**< buffer - KBKDF fixed input replacing context and label.
315                                       Conflicts with:
316                                       - #CKMC_PARAM_KBKDF_LABEL,
317                                       - #CKMC_PARAM_KBKDF_CONTEXT,
318                                       - #CKMC_PARAM_KBKDF_LLEN,
319                                       - #CKMC_PARAM_KBKDF_NO_SEPARATOR */
320         CKMC_PARAM_KBKDF_COUNTER_LOCATION, /**< integer - specifies location of the counter in KBKDF
321                                            (see #ckmc_kbkdf_counter_location_e) */
322         CKMC_PARAM_KBKDF_RLEN, /**< integer - specifies the length of the counter representation in bits
323                                in KBKDF. The value must be one of {8, 16, 24, 32}. If not set, the
324                                default value = 32 will be used */
325         CKMC_PARAM_KBKDF_LLEN, /**< integer - specifies the length of the length suffix representation
326                                in bits in KBKDF. The value must be one of {0, 8, 16, 24, 32}. If set to
327                                0 the length suffix will be skipped. If not set, the default value = 32
328                                will be used. The length suffix is skipped if
329                                #CKMC_PARAM_KBKDF_FIXED_INPUT is passed and this parameter conflicts
330                                with it */
331         CKMC_PARAM_KBKDF_NO_SEPARATOR, /**< integer - presence of this parameter will skip the zero
332                                        octet separator between label and context in KBKDF.
333                                        All values are allowed. This parameter conflicts with
334                                        #CKMC_PARAM_KBKDF_FIXED_INPUT. */
335
336         CKMC_PARAM_ECDH_PUBKEY, /**< buffer - EC public key in DER form (see #ckmc_key_s) */
337 } ckmc_param_name_e;
338
339 /**
340  * @brief Enumeration for key derivation function pseudo-random function parameter
341  * @since_tizen 7.5
342  *
343  * @see ckmc_key_derive()
344  * @see #ckmc_param_name_e
345  */
346 typedef enum __ckmc_kdf_prf {
347         CKMC_KDF_PRF_HMAC_SHA256 = 1, /**< HMAC SHA256 */
348         CKMC_KDF_PRF_HMAC_SHA384, /**< HMAC SHA384 */
349         CKMC_KDF_PRF_HMAC_SHA512, /**< HMAC SHA512 */
350 } ckmc_kdf_prf_e;
351
352 /**
353  * @brief Enumeration for key based key derivation function mode
354  * @since_tizen 7.5
355  *
356  * @see ckmc_key_derive()
357  * @see #ckmc_param_name_e
358  */
359 typedef enum __ckmc_kbkdf_mode {
360         CKMC_KBKDF_MODE_COUNTER = 1, /**< KBKDF counter mode */
361 } ckmc_kbkdf_mode_e;
362
363 /**
364  * @brief Enumeration for KBKDF counter location relative to fixed input
365  * @since_tizen 7.5
366  *
367  * @see ckmc_key_derive()
368  * @see #ckmc_param_name_e
369  */
370 typedef enum __ckmc_kbkdf_counter_location {
371         CKMC_KBKDF_COUNTER_BEFORE_FIXED = 1, /**< Counter is located before fixed input */
372         CKMC_KBKDF_COUNTER_AFTER_FIXED, /**< Counter is located after fixed input */
373         CKMC_KBKDF_COUNTER_MIDDLE_FIXED, /**< Counter is located in the middle of the fixed input
374                                          (between context and label). This setting requires setting
375                                          #CKMC_PARAM_KBKDF_LABEL and #CKMC_PARAM_KBKDF_CONTEXT and
376                                          conflicts with #CKMC_PARAM_KBKDF_FIXED_INPUT. If this location
377                                          is used the separator will be skipped regardless of the
378                                          #CKMC_PARAM_KBKDF_NO_SEPARATOR parameter */
379 } ckmc_kbkdf_counter_location_e;
380
381 /**
382  * @brief Algorithm parameter list handle.
383  * @since_tizen 3.0
384  * @remarks Each parameter list must have at least one CKMC_PARAM_ALGO_TYPE parameter that identifies the algorithm.
385  *          See #ckmc_algo_type_e for available algorithms and additional parameters they support.
386  * @see ckmc_generate_new_params()
387  * @see ckmc_param_list_new()
388  * @see ckmc_param_list_set_integer()
389  * @see ckmc_param_list_set_buffer()
390  * @see ckmc_param_list_get_integer()
391  * @see ckmc_param_list_get_buffer()
392  * @see ckmc_param_list_free()
393  * @see #ckmc_algo_type_e
394  * @see #ckmc_param_name_e
395  */
396 typedef struct __ckmc_param_list *ckmc_param_list_h;
397
398
399 /**
400  * @brief Enumeration for crypto algorithm types.
401  * @since_tizen 3.0
402  * @see #ckmc_param_name_e
403  */
404 typedef enum __ckmc_algo_type {
405         CKMC_ALGO_AES_CTR = 1, /**< AES-CTR algorithm
406                            Supported parameters:
407                            - CKMC_PARAM_ALGO_TYPE = CKMC_ALGO_AES_CTR(mandatory),
408                            - CKMC_PARAM_ED_IV = 16-byte initialization vector(mandatory)
409                            - CKMC_PARAM_ED_CTR_LEN = length of counter block in bits
410                            (optional, only 128b is supported at the moment) */
411
412         CKMC_ALGO_AES_CBC, /**< AES-CBC algorithm
413                        Supported parameters:
414                        - CKMC_PARAM_ALGO_TYPE = CKMC_ALGO_AES_CBC(mandatory),
415                        - CKMC_PARAM_ED_IV = 16-byte initialization vector(mandatory) */
416
417         CKMC_ALGO_AES_GCM, /**< AES-GCM algorithm
418                        Supported parameters:
419                        - CKMC_PARAM_ALGO_TYPE = CKMC_ALGO_AES_GCM(mandatory),
420                        - CKMC_PARAM_ED_IV = initialization vector(mandatory)
421                        - CKMC_PARAM_ED_TAG_LEN = GCM tag length in bits. One of
422                        {32, 64, 96, 104, 112, 120, 128} (optional, if not present, the
423                        length 128 is used; since Tizen 5.0, if TrustZone backend is used,
424                        32 and 64 lengths are not supported)
425                        - CKMC_PARAM_ED_AAD = additional authentication data(optional) */
426
427         CKMC_ALGO_AES_CFB, /**< AES-CFB algorithm
428                        Supported parameters:
429                        - CKMC_PARAM_ALGO_TYPE = CKMC_ALGO_AES_CFB(mandatory),
430                        - CKMC_PARAM_ED_IV = 16-byte initialization vector(mandatory) */
431
432         CKMC_ALGO_RSA_OAEP, /**< RSA-OAEP algorithm
433                         Supported parameters:
434                         - CKMC_PARAM_ALGO_TYPE = CKMC_ALGO_RSA_OAEP(required),
435                         - CKMC_PARAM_ED_LABEL = label to be associated with the message
436                         (optional, not supported at the moment) */
437
438         CKMC_ALGO_KBKDF, /**< Key based key derivation algorithm
439                      Supported parameters:
440                      - CKMC_PARAM_ALGO_TYPE = CKMC_ALGO_KBKDF(mandatory),
441                      - CKMC_PARAM_KDF_PRF = pseudo-random function (see #ckmc_kdf_prf_e)(mandatory),
442                      - CKMC_PARAM_KBKDF_MODE = KDF mode (see #ckmc_kbkdf_mode_e)(mandatory),
443                      - CKMC_PARAM_KBKDF_LABEL = the purpose for the derived key(optional),
444                      - CKMC_PARAM_KBKDF_CONTEXT = information related to the derived key(optional),
445                      - CKMC_PARAM_KDF_LEN = length of the derived key(mandatory)
446                      - CKMC_PARAM_KBKDF_FIXED_INPUT = replacement for context and label(optional),
447                      - CKMC_PARAM_KBKDF_COUNTER_LOCATION = counter location
448                      (see #ckmc_kbkdf_counter_location_e)(mandatory),
449                      - CKMC_PARAM_KBKDF_RLEN = length of the counter representation(optional),
450                      - CKMC_PARAM_KBKDF_LLEN = length of the length suffix representation(optional),
451                      - CKMC_PARAM_KBKDF_NO_SEPARATOR = existence of zero separator(optional) */
452
453         CKMC_ALGO_ECDH, /**< ECDH shared secret key agreement protocol
454                      Supported parameters (all are required):
455                      - CKMC_PARAM_ALGO_TYPE = CKMC_ALGO_ECDH,
456                      - CKMC_PARAM_ECDH_PUBKEY = peer's public key (see #ckmc_key_s) */
457 } ckmc_algo_type_e;
458
459 /**
460  * @brief Gets the alias from #ckmc_alias_info_s structure.
461  * @since_tizen 5.5
462  * @remarks The @a alias should not be released.
463  *          The @a alias can be used until #ckmc_alias_info_s is released.
464  * @param[in] info The pointer to the #ckmc_alias_info_s structure
465  * @param[out] alias The pointer to the alias
466  * @return #CKMC_ERROR_NONE on success,
467  *         othervise a negative error value
468  * @retval #CKMC_ERROR_NONE Successful
469  * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
470  * @see #ckmc_alias_info_s
471  */
472 int ckmc_alias_info_get_alias(const ckmc_alias_info_s* info, char** alias);
473
474 /**
475  * @brief Gets the password protection status from #ckmc_alias_info_s structure.
476  * @since_tizen 5.5
477  * @param[in] info The pointer to the #ckmc_alias_info_s structure
478  * @param[out] is_password_protected The pointer to the password protection flag
479  * @return #CKMC_ERROR_NONE on success,
480  *         othervise a negative error value
481  * @retval #CKMC_ERROR_NONE Successful
482  * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
483  * @see #ckmc_alias_info_s
484  */
485 int ckmc_alias_info_is_password_protected(const ckmc_alias_info_s* info, bool* is_password_protected);
486
487 /**
488  * @brief Destroys the #ckmc_alias_info_list_s handle and releases resources of #ckmc_alias_info_list_s from the provided first handle cascadingly.
489  * @since_tizen 5.5
490  * @param[in] first The first #ckmc_alias_info_list_s handle to destroy
491  * @see #ckmc_alias_info_list_s
492  */
493 void ckmc_alias_info_list_all_free(ckmc_alias_info_list_s *first);
494
495 /**
496  * @brief Creates a new full alias which is a concatenation of @a owner_id and @a alias.
497  * @since_tizen 3.0
498  * @remarks @a full_alias should be freed with free() after use.
499  * @remarks Returns #CKMC_ERROR_INVALID_PARAMETER if any of parameter is NULL.
500  * @remarks Returns #CKMC_ERROR_INVALID_PARAMETER if @a owner_id is empty.
501  * @param[in] owner_id Data owner's id. This should be package id if data owner is
502  *                     application. If you want to access data stored by system
503  *                     services, it should be #ckmc_owner_id_system
504  * @param[in] alias Data alias
505  * @param[out] full_alias The newly created alias which is a concatenation of
506  *                        @a owner_id, #ckmc_owner_id_separator and @a alias.
507  *                        Destroy by free() after use
508  * @return #CKMC_ERROR_NONE on success,
509  *         otherwise a negative error value
510  * @retval #CKMC_ERROR_NONE Successful
511  * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
512  * @retval #CKMC_ERROR_OUT_OF_MEMORY Not enough memory
513  * @see #ckmc_owner_id_separator
514  * @see #ckmc_owner_id_system
515  */
516 int ckmc_alias_new(const char *owner_id, const char *alias, char **full_alias);
517
518
519 /**
520  * @brief Creates a new #ckmc_key_s handle and returns it.
521  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
522  * @remarks You must destroy the newly created #ckmc_key_s by calling ckmc_key_free() if it is no longer needed.
523  * @param[in] raw_key The byte array of key \n
524  *                    @a raw_key may be encrypted with password
525  * @param[in] key_size The byte size of @a raw_key
526  * @param[in] key_type The @a raw_key's type
527  * @param[in] password The byte array used to decrypt @a raw_key inside key manager \n
528  *                     If @a raw_key is not encrypted, @a password can be null
529  * @param[out] ppkey The pointer to a newly created #ckmc_key_s handle
530  * @return #CKMC_ERROR_NONE on success,
531  *         otherwise a negative error value
532  * @retval #CKMC_ERROR_NONE Successful
533  * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
534  * @retval #CKMC_ERROR_OUT_OF_MEMORY Not enough memory
535  * @see ckmc_key_free()
536  * @see #ckmc_key_s
537  */
538 int ckmc_key_new(unsigned char *raw_key, size_t key_size, ckmc_key_type_e key_type, char *password, ckmc_key_s **ppkey);
539
540
541 /**
542  * @brief Destroys the #ckmc_key_s handle and releases all its resources.
543  * @since_tizen 2.3
544  * @param[in] key The #ckmc_key_s handle to destroy
545  */
546 void ckmc_key_free(ckmc_key_s *key);
547
548
549 /**
550  * @brief Creates a new #ckmc_raw_buffer_s handle and returns it.
551  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
552  * @remarks You must destroy the newly created #ckmc_raw_buffer_s by calling ckmc_buffer_free() if it is no longer needed.
553  * @param[in] data The byte array of buffer
554  * @param[in] size The byte size of buffer
555  * @param[out] ppbuffer The pointer to a newly created #ckmc_raw_buffer_s handle
556  * @return #CKMC_ERROR_NONE on success,
557  *         otherwise a negative error value
558  * @retval #CKMC_ERROR_NONE Successful
559  * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
560  * @retval #CKMC_ERROR_OUT_OF_MEMORY Not enough memory
561  * @see ckmc_buffer_free()
562  * @see #ckmc_raw_buffer_s
563  */
564 int ckmc_buffer_new(unsigned char *data, size_t size, ckmc_raw_buffer_s **ppbuffer);
565
566
567 /**
568  * @brief Destroys the #ckmc_raw_buffer_s handle and releases all its resources.
569  * @since_tizen 2.3
570  * @param[in] buffer The #ckmc_raw_buffer_s structure to destroy
571  */
572 void ckmc_buffer_free(ckmc_raw_buffer_s *buffer);
573
574
575 /**
576  * @brief Creates a new #ckmc_cert_s handle and returns it.
577  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
578  * @remarks You must destroy the newly created #ckmc_cert_s by calling ckmc_cert_free() if it is no longer needed.
579  * @param[in] raw_cert The byte array of certificate
580  * @param[in] cert_size The byte size of raw_cert
581  * @param[in] data_format The encoding format of raw_cert
582  * @param[out] ppcert The pointer to a newly created #ckmc_cert_s handle
583  * @return #CKMC_ERROR_NONE on success,
584  *         otherwise a negative error value
585  * @retval #CKMC_ERROR_NONE Successful
586  * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
587  * @retval #CKMC_ERROR_OUT_OF_MEMORY Not enough memory
588  * @see ckmc_cert_free()
589  * @see ckmc_load_cert_from_file()
590  * @see #ckmc_cert_s
591  */
592 int ckmc_cert_new(unsigned char *raw_cert, size_t cert_size, ckmc_data_format_e data_format, ckmc_cert_s **ppcert);
593
594
595 /**
596  * @brief Destroys the #ckmc_cert_s handle and releases all its resources.
597  * @since_tizen 2.3
598  * @param[in] cert The #ckmc_cert_s handle to destroy
599  * @see ckmc_load_cert_from_file()
600  */
601 void ckmc_cert_free(ckmc_cert_s *cert);
602
603
604 /**
605  * @brief Creates a new #ckmc_cert_s handle from a given file and returns it.
606  * @since_tizen 2.3
607  * @remarks You must destroy the newly created #ckmc_cert_s by calling ckmc_cert_free() if it is no longer needed.
608  * @param[in] file_path The path of certificate file to be loaded \n
609  *                      The only DER or PEM encoded certificate file is supported
610  * @param[out] cert The pointer of newly created #ckmc_cert_s handle
611  * @return #CKMC_ERROR_NONE on success,
612  *         otherwise a negative error value
613  * @retval #CKMC_ERROR_NONE Successful
614  * @retval #CKMC_ERROR_OUT_OF_MEMORY Not enough memory space
615  * @retval #CKMC_ERROR_INVALID_FORMAT Invalid certificate file format
616  * @retval #CKMC_ERROR_FILE_ACCESS_DENIED Provided file does not exist or cannot be accessed
617  * @see ckmc_cert_free()
618  * @see #ckmc_cert_s
619  */
620 int ckmc_load_cert_from_file(const char *file_path, ckmc_cert_s **cert);
621
622
623 /**
624  * @brief Creates a new #ckmc_pkcs12_s handle and returns it.
625  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
626  * @remarks You must destroy the newly created #ckmc_pkcs12_s by calling ckmc_pkcs12_free() if it is no longer needed.
627  * @remarks On success, private_key, cert && ca_cert_list ownership is transferred into newly returned ckmc_pkcs12_s.
628  * @param[in] private_key #ckmc_key_s handle to the private key (optional)
629  * @param[in] cert #ckmc_cert_s handle to the certificate (optional)
630  * @param[in] ca_cert_list #ckmc_cert_list_s list of chain certificate handles (optional)
631  * @param[out] pkcs12_bundle The pointer to a newly created #ckmc_pkcs12_s handle
632  * @return #CKMC_ERROR_NONE on success,
633  *         otherwise a negative error value
634  * @retval #CKMC_ERROR_NONE Successful
635  * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid or private_key, cert and ca_cert_list all are null
636  * @retval #CKMC_ERROR_OUT_OF_MEMORY Not enough memory
637  * @see ckmc_pkcs12_free()
638  * @see ckmc_pkcs12_load()
639  * @see #ckmc_key_s
640  * @see #ckmc_cert_s
641  * @see #ckmc_cert_list_s
642  * @see #ckmc_pkcs12_s
643  */
644 int ckmc_pkcs12_new(ckmc_key_s *private_key, ckmc_cert_s *cert, ckmc_cert_list_s *ca_cert_list, ckmc_pkcs12_s **pkcs12_bundle);
645
646
647 /**
648  * @deprecated Deprecated since @if MOBILE 2.4. @elseif WEARABLE 3.0. @endif [Use ckmc_pkcs12_load() instead]
649  * @brief Creates a new #ckmc_key_s (@a private_key), #ckmc_cert_s (@a cert), and #ckmc_cert_list_s (@a ca_cert_list) handle from a given PKCS#12 file and returns them.
650  * @since_tizen 2.3
651  * @remarks You must destroy the newly created #ckmc_key_s, #ckmc_cert_s, and
652  *          #ckmc_cert_list_s by calling ckmc_key_free(), ckmc_cert_free(), and
653  *          ckmc_cert_list_all_free() if they are no longer needed.
654  * @param[in] file_path The path of PKCS12 file to be loaded
655  * @param[in] passphrase The passphrase used to decrypt the PCKS12 file \n
656  *                       If PKCS12 file is not encrypted, passphrase can be null
657  * @param[out] private_key The pointer of newly created #ckmc_key_s handle for a private key
658  * @param[out] cert The pointer of newly created #ckmc_cert_s handle for a certificate \n
659  *                  It is null if the PKCS12 file does not contain a certificate
660  * @param[out] ca_cert_list The pointer of newly created #ckmc_cert_list_s handle for CA certificates \n
661  *                          It is null if the PKCS12 file does not contain CA certificates
662  * @return #CKMC_ERROR_NONE on success,
663  *         otherwise a negative error value
664  * @retval #CKMC_ERROR_NONE Successful
665  * @retval #CKMC_ERROR_OUT_OF_MEMORY Not enough memory space
666  * @retval #CKMC_ERROR_INVALID_FORMAT Invalid PKCS12 file format
667  * @retval #CKMC_ERROR_FILE_ACCESS_DENIED Provided file does not exist or cannot be accessed
668  * @see ckmc_pkcs12_new()
669  * @see ckmc_pkcs12_load()
670  * @see ckmc_key_free()
671  * @see ckmc_cert_free()
672  * @see ckmc_cert_list_all_free()
673  * @see #ckmc_key_s
674  * @see #ckmc_cert_s
675  * @see #ckmc_cert_list_s
676  */
677 int ckmc_load_from_pkcs12_file(const char *file_path, const char *passphrase, ckmc_key_s **private_key, ckmc_cert_s **cert, ckmc_cert_list_s **ca_cert_list) TIZEN_DEPRECATED_API;
678
679
680 /**
681  * @brief Creates a new #ckmc_pkcs12_s handle from a given PKCS#12 file and returns it.
682  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
683  * @remarks You must destroy the newly created #ckmc_pkcs12_s by calling ckmc_pkcs12_free() if they are no longer needed.
684  * @param[in] file_path The path of PKCS12 file to be loaded
685  * @param[in] passphrase The passphrase used to decrypt the PCKS12 file \n
686  *                       If PKCS12 file is not encrypted, passphrase can be null
687  * @param[out] pkcs12_bundle The pointer of newly created #ckmc_cert_list_s handle for CA certificates \n
688  *                           It is null if the PKCS12 file does not contain CA certificates
689  * @return #CKMC_ERROR_NONE on success,
690  *         otherwise a negative error value
691  * @retval #CKMC_ERROR_NONE Successful
692  * @retval #CKMC_ERROR_OUT_OF_MEMORY Not enough memory space
693  * @retval #CKMC_ERROR_INVALID_FORMAT Invalid PKCS12 file format
694  * @retval #CKMC_ERROR_FILE_ACCESS_DENIED Provided file does not exist or cannot be accessed
695  * @see ckmc_pkcs12_free()
696  * @see #ckmc_pkcs12_s
697  */
698 int ckmc_pkcs12_load(const char *file_path, const char *passphrase, ckmc_pkcs12_s **pkcs12_bundle);
699
700
701 /**
702  * @brief Destroys the #ckmc_pkcs12_s handle and releases all its resources.
703  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
704  * @param[in] pkcs12 The #ckmc_pkcs12_s handle to destroy
705  * @see ckmc_pkcs12_new()
706  * @see ckmc_pkcs12_load()
707  */
708 void ckmc_pkcs12_free(ckmc_pkcs12_s *pkcs12);
709
710
711 /**
712  * @brief Creates a new #ckmc_alias_list_s handle and returns it.
713  *        The alias pointer in the returned #ckmc_alias_list_s handle points to the provided characters and next is null.
714  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
715  * @remarks You must destroy the newly created #ckmc_alias_list_s
716  *          by calling ckmc_alias_list_free() or ckmc_alias_list_all_free() if it is no longer needed.
717  * @param[in] alias The first item to be set in the newly created #ckmc_alias_list_s
718  * @param[out] ppalias_list The pointer to a newly created #ckmc_alias_list_s handle
719  * @return #CKMC_ERROR_NONE on success,
720  *         otherwise a negative error value
721  * @retval #CKMC_ERROR_NONE Successful
722  * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
723  * @retval #CKMC_ERROR_OUT_OF_MEMORY Not enough memory
724  * @see ckmc_alias_list_all_free()
725  * @see #ckmc_alias_list_s
726  */
727 int ckmc_alias_list_new(char *alias, ckmc_alias_list_s **ppalias_list);
728
729
730 /**
731  * @brief Creates a new #ckmc_alias_list_s handle, adds it to a previous #ckmc_alias_list_s and returns it.
732  *        The alias pointer in the returned #ckmc_alias_list_s handle points to the provided characters and next is null.
733  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
734  * @param[in] previous The last #ckmc_alias_list_s handle to which a newly created #ckmc_alias_list_s is added
735  * @param[in] alias The item to be set in the newly created #ckmc_alias_list_s
736  * @param[out] pplast The pointer to a newly created and added #ckmc_alias_list_s handle
737  * @return #CKMC_ERROR_NONE on success,
738  *         otherwise a negative error value
739  * @retval #CKMC_ERROR_NONE Successful
740  * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
741  * @retval #CKMC_ERROR_OUT_OF_MEMORY Not enough memory
742  * @see ckmc_alias_list_all_free()
743  * @see #ckmc_alias_list_s
744  */
745 int ckmc_alias_list_add(ckmc_alias_list_s *previous, char *alias, ckmc_alias_list_s **pplast);
746
747
748 /**
749  * @brief Destroys the #ckmc_alias_list_s handle and releases resources of #ckmc_alias_list_s from the provided first handle cascadingly.
750  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
751  * @remarks It does not destroy an alias itself in #ckmc_alias_list_s.
752  * @param[in] first The first #ckmc_alias_list_s handle to destroy
753  * @see ckmc_alias_list_all_free()
754  * @see #ckmc_alias_list_s
755  */
756 void ckmc_alias_list_free(ckmc_alias_list_s *first);
757
758
759 /**
760  * @brief Destroys the #ckmc_alias_list_s handle and releases all its resources from the provided first handle cascadingly.
761  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
762  * @remarks It also destroys the alias in #ckmc_alias_list_s.
763  * @param[in] first The first #ckmc_alias_list_s handle to destroy
764  * @see #ckmc_alias_list_s
765  */
766 void ckmc_alias_list_all_free(ckmc_alias_list_s *first);
767
768
769 /**
770  * @brief Creates a new #ckmc_cert_list_s handle and returns it.
771  *        The cert pointer in the returned #ckmc_cert_list_s handle points to the provided #ckmc_cert_s and next is null.
772  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
773  * @remarks You must destroy the newly created #ckmc_cert_list_s by calling ckmc_cert_list_free() or ckmc_cert_list_all_free() if it is no longer needed.
774  * @param[in] cert The first item to be set in the newly created #ckmc_cert_list_s
775  * @param[out] ppalias_list The pointer to a newly created #ckmc_alias_list_s handle
776  * @return #CKMC_ERROR_NONE on success,
777  *         otherwise a negative error value
778  * @retval #CKMC_ERROR_NONE Successful
779  * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
780  * @retval #CKMC_ERROR_OUT_OF_MEMORY Not enough memory
781  * @see ckmc_cert_list_all_free()
782  * @see #ckmc_cert_list_s
783  */
784 int ckmc_cert_list_new(ckmc_cert_s *cert, ckmc_cert_list_s **ppalias_list);
785
786
787 /**
788  * @brief Creates a new #ckmc_cert_list_s handle, adds it to a previous #ckmc_cert_list_s and returns it.
789  *        The cert pointer in the returned #ckmc_alias_list_s handle points to the provided #ckmc_cert_s and next is null.
790  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
791  * @param[in] previous The last #ckmc_cert_list_s handle to which a newly created #ckmc_cert_list_s is added
792  * @param[in] cert The item to be set in the newly created #ckmc_cert_list_s
793  * @param[out] pplast The pointer to a newly created and added #ckmc_alias_list_s handle
794  * @return #CKMC_ERROR_NONE on success,
795  *         otherwise a negative error value
796  * @retval #CKMC_ERROR_NONE Successful
797  * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
798  * @retval #CKMC_ERROR_OUT_OF_MEMORY Not enough memory
799  * @see ckmc_cert_list_all_free()
800  * @see #ckmc_cert_list_s
801  */
802 int ckmc_cert_list_add(ckmc_cert_list_s *previous, ckmc_cert_s *cert, ckmc_cert_list_s **pplast);
803
804
805 /**
806  * @brief Destroys the #ckmc_cert_list_s handle and releases resources of #ckmc_cert_list_s from the provided first handle cascadingly.
807  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
808  * @remarks It does not destroy #ckmc_cert_s itself in #ckmc_cert_list_s.
809  * @param[in] first The first #ckmc_cert_list_s handle to destroy
810  * @see ckmc_cert_list_all_free()
811  * @see #ckmc_cert_list_s
812  */
813 void ckmc_cert_list_free(ckmc_cert_list_s *first);
814
815
816 /**
817  * @brief Destroys the #ckmc_cert_list_s handle and releases all its resources from the provided first handle cascadingly.
818  * @since_tizen 2.3
819  * @remarks It also destroys #ckmc_cert_s in #ckmc_cert_list_s.
820  * @param[in] first The first #ckmc_cert_list_s handle to destroy
821  * @see #ckmc_cert_list_s
822  */
823 void ckmc_cert_list_all_free(ckmc_cert_list_s *first);
824
825
826 /**
827  * @brief Creates new parameter list.
828  * @since_tizen 3.0
829  * @remarks Caller is responsible for freeing it with ckmc_param_list_free().
830  * @param[in] pparams Double pointer to the handle of param list to which the newly created algorithm param list will be assigned
831  * @return #CKMC_ERROR_NONE on success,
832  *         otherwise a negative error value
833  * @retval #CKMC_ERROR_NONE Successful
834  * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
835  * @see ckmc_param_list_set_integer()
836  * @see ckmc_param_list_set_buffer()
837  * @see ckmc_param_list_free()
838  * @see ckmc_generate_new_params()
839  * @see #ckmc_param_list_h
840  * @see #ckmc_param_name_e
841  * @see #ckmc_algo_type_e
842  */
843 int ckmc_param_list_new(ckmc_param_list_h *pparams);
844
845
846 /**
847  * @brief Sets integer parameter to the list.
848  * @since_tizen 3.0
849  * @remarks Caller is responsible for #ckmc_param_list_h creation.
850  * @param[in] params Algorithm param list handle created with ckmc_param_list_new() or ckmc_generate_new_params() \n
851  *                   New param with @a name and @a value will be set here
852  * @param[in] name Name of parameter to set \n
853  *                 Existing parameter will be overwritten \n
854  *                 Passing invalid parameter name will result in an error
855  * @param[in] value Value of the parameter in form of a integer
856  * @return #CKMC_ERROR_NONE on success,
857  *         otherwise a negative error value
858  * @retval #CKMC_ERROR_NONE Successful
859  * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
860  * @see ckmc_param_list_new()
861  * @see ckmc_param_list_set_buffer()
862  * @see ckmc_param_list_get_integer()
863  * @see ckmc_param_list_get_buffer()
864  * @see ckmc_param_list_free()
865  * @see ckmc_generate_new_params()
866  * @see #ckmc_param_list_h
867  * @see #ckmc_param_name_e
868  * @see #ckmc_algo_type_e
869  */
870 int ckmc_param_list_set_integer(ckmc_param_list_h params, ckmc_param_name_e name, uint64_t value);
871
872
873 /**
874  * @brief Sets buffer parameter to the list.
875  * @since_tizen 3.0
876  * @remarks Caller is responsible for #ckmc_param_list_h creation.
877  * @param[in] params Algorithm param list handle created with ckmc_param_list_new() or ckmc_generate_new_params()
878  *                   New param with @a name and @a buffer will be set here
879  * @param[in] name Name of parameter to set \n
880  *                 Existing parameter will be overwritten \n
881  *                 Passing invalid parameter name will result in an error
882  * @param[in] buffer Value of the parameter in form of a buffer \n
883  *                   Caller is responsible for creating and freeing the buffer
884  * @return #CKMC_ERROR_NONE on success,
885  *         otherwise a negative error value
886  * @retval #CKMC_ERROR_NONE Successful
887  * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
888  * @see ckmc_param_list_new()
889  * @see ckmc_param_list_set_integer()
890  * @see ckmc_param_list_get_integer()
891  * @see ckmc_param_list_get_buffer()
892  * @see ckmc_param_list_free()
893  * @see ckmc_generate_new_params()
894  * @see #ckmc_param_list_h
895  * @see #ckmc_param_name_e
896  * @see #ckmc_algo_type_e
897  */
898 int ckmc_param_list_set_buffer(ckmc_param_list_h params, ckmc_param_name_e name, const ckmc_raw_buffer_s *buffer);
899
900
901 /**
902  * @brief Gets integer parameter from the list.
903  * @since_tizen 3.0
904  * @remarks Caller is responsible for #ckmc_param_list_h creation.
905  * @param[in] params Algorithm param list handle created with ckmc_param_list_new() or ckmc_generate_new_params()
906  *                   which contains param with @a name
907  * @param[in] name Name of parameter to get
908  * @param[out] pvalue Value of the parameter in form of a integer
909  * @return #CKMC_ERROR_NONE on success,
910  *         otherwise a negative error value
911  * @retval #CKMC_ERROR_NONE Successful
912  * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
913  * @see ckmc_param_list_new()
914  * @see ckmc_param_list_set_integer()
915  * @see ckmc_param_list_set_buffer()
916  * @see ckmc_param_list_get_buffer()
917  * @see ckmc_param_list_free()
918  * @see ckmc_generate_new_params()
919  * @see #ckmc_param_list_h
920  * @see #ckmc_param_name_e
921  * @see #ckmc_algo_type_e
922  */
923 int ckmc_param_list_get_integer(ckmc_param_list_h params, ckmc_param_name_e name, uint64_t *pvalue);
924
925
926 /**
927  * @brief Gets buffer parameter from the list.
928  * @since_tizen 3.0
929  * @remarks Caller is responsible for #ckmc_param_list_h creation.
930  * @param[in] params Algorithm param list handle created with ckmc_param_list_new() or ckmc_generate_new_params()
931  *                   which contains param with @a name
932  * @param[in] name Name of parameter to get
933  * @param[out] ppbuffer Value of the parameter in form of a buffer \n
934  *                      Caller is responsible for creating and freeing the buffer
935  * @return #CKMC_ERROR_NONE on success,
936  *         otherwise a negative error value
937  * @retval #CKMC_ERROR_NONE Successful
938  * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
939  * @see ckmc_param_list_new()
940  * @see ckmc_param_list_set_integer()
941  * @see ckmc_param_list_set_buffer()
942  * @see ckmc_param_list_get_integer()
943  * @see ckmc_param_list_free()
944  * @see ckmc_generate_new_params()
945  * @see ckmc_buffer_free()
946  * @see #ckmc_param_list_h
947  * @see #ckmc_param_name_e
948  * @see #ckmc_algo_type_e
949  */
950 int ckmc_param_list_get_buffer(ckmc_param_list_h params, ckmc_param_name_e name, ckmc_raw_buffer_s **ppbuffer);
951
952
953 /**
954  * @brief Frees previously allocated list of algorithm params.
955  * @since_tizen 3.0
956  * @param[in] params First element of the list to be freed
957  * @see ckmc_param_list_new()
958  * @see ckmc_param_list_set_integer()
959  * @see ckmc_param_list_set_buffer()
960  * @see ckmc_param_list_get_integer()
961  * @see ckmc_param_list_get_buffer()
962  * @see ckmc_generate_new_params()
963  * @see #ckmc_param_list_h
964  * @see #ckmc_param_name_e
965  * @see #ckmc_algo_type_e
966  */
967 void ckmc_param_list_free(ckmc_param_list_h params);
968
969
970 /**
971  * @brief Generates algorithm parameters for a given algorithm type and set them to the list.
972  * @since_tizen 3.0
973  * @remarks Caller is responsible for #ckmc_param_list_h destruction.
974  * @remarks Algorithm parameters are set to default values. Optional fields are left empty.
975  *          Initialization vectors are left empty (they have to be set manually).
976  *          Caller is responsible for freeing the list with ckmc_param_list_free().
977  * @remarks If the function returns error, provided param list may contain some of default parameters.
978  * @param[in] type Type of the algorithm
979  * @param[out] pparams Newly generated handle of param list which should be freed by caller after use
980  * @return #CKMC_ERROR_NONE on success,
981  *         otherwise a negative error value
982  * @retval #CKMC_ERROR_NONE Successful
983  * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
984  * @see ckmc_param_list_new()
985  * @see ckmc_param_list_set_integer()
986  * @see ckmc_param_list_set_buffer()
987  * @see ckmc_param_list_get_integer()
988  * @see ckmc_param_list_get_buffer()
989  * @see ckmc_param_list_free()
990  * @see #ckmc_param_list_h
991  * @see #ckmc_param_name_e
992  * @see #ckmc_algo_type_e
993  */
994 int ckmc_generate_new_params(ckmc_algo_type_e type, ckmc_param_list_h *pparams);
995
996
997 /**
998  * @}
999  */
1000
1001
1002 #ifdef __cplusplus
1003 }
1004 #endif
1005
1006
1007 #endif /* __TIZEN_CORE_CKMC_TYPE_H */