b392137cc9b2a57fc8da2522183e1847ff8b1a62
[platform/core/security/key-manager.git] / src / include / ckmc / ckmc-type.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-type.h
18  * @version     1.0
19  * @brief       Definitions of struct for the Key Manager's CAPI and their utility functions.
20  */
21
22 #ifndef __TIZEN_CORE_CKMC_TYPE_H
23 #define __TIZEN_CORE_CKMC_TYPE_H
24
25 #include <stddef.h>
26 #include <ckmc/ckmc-error.h>
27
28 #define KEY_MANAGER_CAPI __attribute__((visibility("default")))
29
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34
35 /**
36  * @addtogroup CAPI_KEY_MANAGER_TYPES_MODULE
37  * @{
38  */
39
40 /**
41  * alias can be provided as an alias alone, or together with label - in this
42  * case, separator " " (space bar) is used to separate label and alias.
43  * @see key-manager_doc.h
44  */
45 extern char const * const ckmc_label_name_separator;
46
47 /**
48  * @brief Enumeration for key types of key manager.
49  * @since_tizen 2.3
50  */
51 typedef enum __ckmc_key_type {
52     CKMC_KEY_NONE = 0,       /**< key type not specified */
53     CKMC_KEY_RSA_PUBLIC,     /**< RSA public key */
54     CKMC_KEY_RSA_PRIVATE,    /**< RSA private key */
55     CKMC_KEY_ECDSA_PUBLIC,   /**< ECDSA public key */
56     CKMC_KEY_ECDSA_PRIVATE,  /**< ECDSA private key */
57     CKMC_KEY_DSA_PUBLIC,     /**< DSA public key */
58     CKMC_KEY_DSA_PRIVATE,    /**< DSA private key */
59     CKMC_KEY_AES,            /**< AES key */
60 } ckmc_key_type_e;
61
62 /**
63  * @brief Enumeration for data format.
64  * @since_tizen 2.3
65  */
66 typedef enum __ckmc_data_format {
67     CKMC_FORM_DER_BASE64 = 0,  /**< DER format base64 encoded data */
68     CKMC_FORM_DER,             /**< DER encoded data */
69     CKMC_FORM_PEM              /**< PEM encoded data. It consists of the DER format base64 encoded with additional header and footer lines. */
70 } ckmc_data_format_e;
71
72 /**
73  * @brief Enumeration for elliptic curve.
74  * @since_tizen 2.3
75  */
76 typedef enum __ckmc_ec_type {
77     CKMC_EC_PRIME192V1 = 0, /**< Elliptic curve domain "secp192r1" listed in "SEC 2" recommended elliptic curve domain  */
78     CKMC_EC_PRIME256V1,     /**< "SEC 2" recommended elliptic curve domain - secp256r1 */
79     CKMC_EC_SECP384R1       /**< NIST curve P-384 (covers "secp384r1", the elliptic curve domain listed in See SEC 2 */
80 } ckmc_ec_type_e;
81
82 /**
83  * @brief Enumeration for hash algorithm.
84  * @since_tizen 2.3
85  */
86 typedef enum __ckmc_hash_algo {
87     CKMC_HASH_NONE = 0, /**< No Hash Algorithm  */
88     CKMC_HASH_SHA1,     /**< Hash Algorithm SHA1  */
89     CKMC_HASH_SHA256,   /**< Hash Algorithm SHA256  */
90     CKMC_HASH_SHA384,   /**< Hash Algorithm SHA384  */
91     CKMC_HASH_SHA512    /**< Hash Algorithm SHA512  */
92 } ckmc_hash_algo_e;
93
94 /**
95  * @brief Enumeration for RSA padding algorithm.
96  * @since_tizen 2.3
97  */
98 typedef enum __ckmc_rsa_padding_algo {
99     CKMC_NONE_PADDING = 0,  /**< No Padding */
100     CKMC_PKCS1_PADDING,     /**< PKCS#1 Padding */
101     CKMC_X931_PADDING       /**< X9.31 padding */
102 } ckmc_rsa_padding_algo_e;
103
104 /**
105  * @deprecated, use ckmc_permission_e instead
106  * @brief Enumeration for database access rights.
107  * @since_tizen 2.3
108  */
109 typedef enum __ckmc_access_right{
110     CKMC_AR_READ = 0,       /**< access right for read*/
111     CKMC_AR_READ_REMOVE     /**< access right for read and remove*/
112 } ckmc_access_right_e;
113
114 /**
115  * @brief Enumeration for permissions to access/modify alias.
116  * @since_tizen 3.0
117  */
118 typedef enum __ckmc_permission{
119     CKMC_PERMISSION_NONE        = 0x00, /**< clear permissions */
120     CKMC_PERMISSION_READ        = 0x01, /**< read allowed */
121     CKMC_PERMISSION_REMOVE      = 0x02  /**< remove allowed */
122 } ckmc_permission_e;
123
124 /**
125  * @brief the structure for binary buffer used in key manager CAPI.
126  * @since_tizen 2.3
127  */
128 typedef struct __ckmc_raw_buff {
129     unsigned char* data; /**< Byte array containing binary data */
130     size_t size;         /**< The size of the binary data */
131 } ckmc_raw_buffer_s;
132
133 /**
134  * @brief The structure for a policy for storing key/certificate/binary data.
135  * @since_tizen 2.3
136  */
137 typedef struct __ckmc_policy {
138     char* password;   /**< Byte array used to encrypt data inside CKM. If it is not null, the data(or key, or certificate) is stored encrypted with this password inside key manager */
139     bool extractable; /**< If true key may be extracted from storage */
140 } ckmc_policy_s;
141
142 /**
143  * @brief The structure for key used in key manager CAPI.
144  * @since_tizen 2.3
145  */
146 typedef struct __ckmc_key {
147     unsigned char* raw_key;   /**< Byte array of key. raw_key may be encrypted with password */
148     size_t key_size;          /**< The byte size of raw_key */
149     ckmc_key_type_e key_type; /**< The raw_key's type */
150     char* password;           /**< Byte array used to decrypt data raw_key inside key manager. */
151 } ckmc_key_s;
152
153 /**
154  * @brief The structure for certificate used in key manager CAPI.
155  * @since_tizen 2.3
156  */
157 typedef struct __ckmc_cert {
158     unsigned char* raw_cert;  /**< Byte array of certificate */
159     size_t cert_size;         /**< Byte size of raw_cert */
160     ckmc_data_format_e data_format; /**< Raw_cert's encoding format */
161 } ckmc_cert_s;
162
163 /**
164  * @brief The structure for linked list of alias.
165  * @since_tizen 2.3
166  */
167 typedef struct __ckmc_alias_list {
168     char *alias;  /**< The name of key, certificate or data stored in key manager */
169     struct __ckmc_alias_list *next; /**< The pointer pointing to the next ckmc_alias_list_s */
170 } ckmc_alias_list_s;
171
172 /**
173  * @brief The structure for linked list of ckmc_cert_s
174  * @since_tizen 2.3
175  */
176 typedef struct __ckmc_cert_list {
177     ckmc_cert_s *cert; /**< The pointer of ckmc_cert_s */
178     struct __ckmc_cert_list *next; /**< The pointer pointing to the next ckmc_cert_list_s */
179 } ckmc_cert_list_s;
180
181 /**
182  * @brief The structure for PKCS12 used in key manager CAPI.
183  * @since_tizen 2.3
184  */
185 typedef struct __ckmc_pkcs12 {
186     ckmc_key_s  *priv_key;      /**< private key, may be null */
187     ckmc_cert_s *cert;          /**< certificate, may be null */
188     ckmc_cert_list_s *ca_chain; /**< chain certificates list, may be null */
189 } ckmc_pkcs12_s;
190
191
192 /**
193  * @internal
194  * @brief Creates a new @a ckmc_key_s handle and returns it.
195  *
196  * @since_tizen 2.3
197  *
198  * @remarks You must destroy the newly created @a ckmc_key_s by calling ckmc_key_free() if it is no longer needed.
199  *
200  * @param[in] raw_key  The byte array of key \n
201  *                     @a raw_key may be encrypted with password.
202  * @param[in] key_size The byte size of @a raw_key
203  * @param[in] key_type The @a raw_key's type
204  * @param[in] password The byte array used to decrypt @a raw_key inside key manager \n
205  *                     If @a raw_key is not encrypted, @a password can be null.
206  * @param[out] ppkey   The pointer to a newly created @a ckmc_key_s handle
207  *
208  * @return @c 0 on success,
209  *         otherwise a negative error value
210  *
211  * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
212  * @retval #CKMC_ERROR_OUT_OF_MEMORY     Not enough memory
213  *
214  * @see ckmc_key_free()
215  * @see #ckmc_key_s
216  */
217 int ckmc_key_new(unsigned char *raw_key, size_t key_size,
218         ckmc_key_type_e key_type, char *password, ckmc_key_s **ppkey);
219
220 /**
221  * @brief Destroys the @a ckmc_key_s handle and releases all its resources.
222  *
223  * @since_tizen 2.3
224  *
225  * @param[in] key The @a ckmc_key_s handle to destroy
226  *
227  */
228 void ckmc_key_free(ckmc_key_s *key);
229
230 /**
231  * @internal
232  * @brief Creates a new @a ckmc_raw_buffer_s handle and returns it.
233  *
234  * @since_tizen 2.3
235  *
236  * @remarks You must destroy the newly created @a ckmc_raw_buffer_s by calling ckmc_buffer_free() if it is no longer needed.
237  *
238  * @param[in]  data      The byte array of buffer
239  * @param[in]  size      The byte size of buffer
240  * @param[out] ppbuffer  The pointer to a newly created @a ckmc_buffer_s handle
241  *
242  * @return @c 0 on success,
243  *         otherwise a negative error value
244  *
245  * @retval #CKMC_ERROR_INVALID_PARAMETER  Input parameter is invalid
246  * @retval #CKMC_ERROR_OUT_OF_MEMORY      Not enough memory
247  *
248  * @see ckmc_buffer_free()
249  * @see #ckmc_raw_buffer_s
250  */
251 int ckmc_buffer_new(unsigned char *data, size_t size,ckmc_raw_buffer_s **ppbuffer);
252
253 /**
254  * @brief Destroys the @a ckmc_raw_buffer_s handle and releases all its resources.
255  *
256  * @since_tizen 2.3
257  *
258  * @param[in] buffer The @a ckmc_raw_buffer_s handle to destroy
259  *
260  */
261 void ckmc_buffer_free(ckmc_raw_buffer_s *buffer);
262
263 /**
264  * @internal
265  * @brief Creates a new @a ckmc_cert_s handle and returns it.
266  *
267  * @since_tizen 2.3
268  *
269  * @remarks You must destroy the newly created @a ckmc_cert_s by calling ckmc_cert_free() if it is no longer needed.
270  *
271  * @param[in]  raw_cert     The byte array of certificate
272  * @param[in]  cert_size    The byte size of raw_cert
273  * @param[in]  data_format  The encoding format of raw_cert
274  * @param[out] ppcert       The pointer to a newly created @a ckmc_cert_s handle
275  *
276  * @return @c 0 on success,
277  *         otherwise a negative error value
278  *
279  * @retval #CKMC_ERROR_INVALID_PARAMETER  Input parameter is invalid
280  * @retval #CKMC_ERROR_OUT_OF_MEMORY      Not enough memory
281  *
282  * @see ckmc_cert_free()
283  * @see ckmc_load_cert_from_file()
284  * @see #ckmc_cert_s
285  */
286 int ckmc_cert_new(unsigned char *raw_cert, size_t cert_size,
287         ckmc_data_format_e data_format, ckmc_cert_s **ppcert);
288
289 /**
290  * @brief Destroys the @a ckmc_cert handle and releases all its resources.
291  *
292  * @since_tizen 2.3
293  *
294  * @param[in] cert The @a ckmc_cert_s handle to destroy
295  *
296  * @see ckmc_load_cert_from_file()
297  * @see ckmc_load_from_pkcs12_file
298  */
299 void ckmc_cert_free(ckmc_cert_s *cert);
300
301 /**
302  * @brief Creates a new @a ckmc_cert_s handle from a given file and returns it.
303  *
304  * @since_tizen 2.3
305  *
306  * @remarks You must destroy the newly created @a ckmc_cert_s by calling ckmc_cert_free() if it is no longer needed.
307  *
308  * @param[in]  file_path  The path of certificate file to be loaded \n
309  *                        The only DER or PEM encoded certificate file is supported.
310  * @param[out] cert       The pointer of newly created @a ckmc_cert_s handle
311  *
312  * @return #CKMC_ERROR_NONE on success,
313  *         otherwise a negative error value
314  *
315  * @retval #CKMC_ERROR_NONE                Successful
316  * @retval #CKMC_ERROR_OUT_OF_MEMORY       Not enough memory space
317  * @retval #CKMC_ERROR_INVALID_FORMAT      Invalid certificate file format
318  * @retval #CKMC_ERROR_FILE_ACCESS_DENIED  Provided file does not exist or cannot be accessed
319  *
320  * @see ckmc_cert_free()
321  * @see #ckmc_cert_s
322  */
323 int ckmc_load_cert_from_file(const char *file_path, ckmc_cert_s **cert);
324
325 /**
326  * @brief Creates a new @a ckmc_pkcs12_s handle and returns it.
327  *
328  * @since_tizen 2.3
329  *
330  * @remarks You must destroy the newly created @a ckmc_pkcs12_s by calling ckmc_pkcs12_free() if it is no longer needed.
331  * @remarks On success, private_key, cert && ca_cert_list ownership is transferred into newly returned ckmc_pkcs12_s.
332  *
333  * @param[in]  private_key      @a ckmc_key_s handle to the private key (optional)
334  * @param[in]  cert             @a ckmc_cert_s handle to the certificate (optional)
335  * @param[in]  ca_cert_list     @a ckmc_cert_list_s list of chain certificate handles (optional)
336  * @param[out] pkcs12_bundle    The pointer to a newly created @a ckmc_pkcs12_s handle
337  *
338  * @return @c 0 on success,
339  *         otherwise a negative error value
340  *
341  * @retval #CKMC_ERROR_INVALID_PARAMETER  Input parameter is invalid or private_key, cert and ca_cert_list all are null.
342  * @retval #CKMC_ERROR_OUT_OF_MEMORY      Not enough memory
343  *
344  * @see ckmc_pkcs12_free()
345  * @see ckmc_load_from_pkcs12_file()
346  * @see ckmc_load_from_pkcs12_file2()
347  * @see #ckmc_key_s
348  * @see #ckmc_cert_s
349  * @see #ckmc_cert_list_s
350  * @see #ckmc_pkcs12_s
351  */
352 int ckmc_pkcs12_new(ckmc_key_s *private_key, ckmc_cert_s *cert,
353         ckmc_cert_list_s *ca_cert_list, ckmc_pkcs12_s **pkcs12_bundle);
354
355 /**
356  * @deprecated, use @a ckmc_load_from_pkcs12_file2() instead
357  * @brief Creates a new @a ckmc_key_s(private key), @a ckmc_cert_s(certificate), and @a ckmc_cert_list_s(CA certificates) handle from a given PKCS#12 file and returns them.
358  *
359  * @since_tizen 2.3
360  *
361  * @remarks You must destroy the newly created @a ckmc_key_s, @a ckmc_cert_s, and @a ckmc_cert_list_s by calling ckmc_key_free(), ckmc_cert_free(), and ckmc_cert_list_all_free() if they are no longer needed.
362  *
363  * @param[in]  file_path    The path of PKCS12 file to be loaded
364  * @param[in]  passphrase   The passphrase used to decrypt the PCKS12 file \n
365  *                          If PKCS12 file is not encrypted, passphrase can be null.
366  * @param[out] private_key  The pointer of newly created @a ckmc_key_s handle for a private key
367  * @param[out] cert         The pointer of newly created @a ckmc_cert_s handle for a certificate \n
368  *                          It is null if the PKCS12 file does not contain a certificate.
369  * @param[out] ca_cert_list The pointer of newly created @a ckmc_cert_list_s handle for CA certificates \n
370  *                          It is null if the PKCS12 file does not contain CA certificates.
371  *
372  * @return #CKMC_ERROR_NONE on success,
373  *         otherwise a negative error value
374  *
375  * @retval #CKMC_ERROR_NONE                Successful
376  * @retval #CKMC_ERROR_OUT_OF_MEMORY       Not enough memory space
377  * @retval #CKMC_ERROR_INVALID_FORMAT      Invalid PKCS12 file format
378  * @retval #CKMC_ERROR_FILE_ACCESS_DENIED  Provided file does not exist or cannot be accessed
379  *
380  * @see ckmc_pkcs12_new()
381  * @see ckmc_load_from_pkcs12_file2()
382  * @see ckmc_key_free()
383  * @see ckmc_cert_free()
384  * @see ckmc_cert_list_all_free()
385  * @see #ckmc_key_s
386  * @see #ckmc_cert_s
387  * @see #ckmc_cert_list_s
388  */
389 int ckmc_load_from_pkcs12_file(const char *file_path, const char *passphrase,
390         ckmc_key_s **private_key, ckmc_cert_s **cert,
391         ckmc_cert_list_s **ca_cert_list);
392
393 /**
394  * @brief Creates a new @a ckmc_pkcs12_s handle from a given PKCS#12 file and returns it.
395  *
396  * @since_tizen 2.3
397  *
398  * @remarks You must destroy the newly created @a ckmc_pkcs12_s by calling ckmc_pkcs12_free() if they are no longer needed.
399  *
400  * @param[in]  file_path    The path of PKCS12 file to be loaded
401  * @param[in]  passphrase   The passphrase used to decrypt the PCKS12 file \n
402  *                          If PKCS12 file is not encrypted, passphrase can be null.
403  * @param[out] ca_cert_list The pointer of newly created @a ckmc_cert_list_s handle for CA certificates \n
404  *                          It is null if the PKCS12 file does not contain CA certificates.
405  *
406  * @return #CKMC_ERROR_NONE on success,
407  *         otherwise a negative error value
408  *
409  * @retval #CKMC_ERROR_NONE                Successful
410  * @retval #CKMC_ERROR_OUT_OF_MEMORY       Not enough memory space
411  * @retval #CKMC_ERROR_INVALID_FORMAT      Invalid PKCS12 file format
412  * @retval #CKMC_ERROR_FILE_ACCESS_DENIED  Provided file does not exist or cannot be accessed
413  *
414  * @see ckmc_pkcs12_free()
415  * @see #ckmc_pkcs12_s
416  */
417 int ckmc_load_from_pkcs12_file2(const char *file_path, const char *passphrase, ckmc_pkcs12_s **pkcs12_bundle);
418
419 /**
420  * @brief Destroys the @a ckmc_pkcs12_s handle and releases all its resources.
421  *
422  * @since_tizen 2.3
423  *
424  * @param[in] pkcs12 The @a ckmc_pkcs12_s handle to destroy
425  *
426  * @see ckmc_pkcs12_new()
427  * @see ckmc_load_from_pkcs12_file2()
428  */
429 void ckmc_pkcs12_free(ckmc_pkcs12_s *pkcs12);
430
431 /**
432  * @internal
433  * @brief Creates a new @a ckmc_alias_list_s handle and returns it.
434  *        The alias pointer in the returned @a ckmc_alias_list_s handle points to the provided characters and next is null.
435  *
436  * @since_tizen 2.3
437  *
438  * @remarks You must destroy the newly created @a ckmc_alias_list_s by calling ckmc_alias_list_free() or ckmc_alias_list_all_free() if it is no longer needed.
439  *
440  * @param[in]  alias        The first item to be set in the newly created @a ckmc_alias_list_s
441  * @param[out] ppalias_list The pointer to a newly created @a ckmc_alias_list_s handle
442  *
443  * @return @c 0 on success,
444  *         otherwise a negative error value
445  *
446  * @retval #CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
447  * @retval #CKMC_ERROR_OUT_OF_MEMORY     Not enough memory
448  *
449  * @see ckmc_alias_list_all_free()
450  * @see #ckmc_alias_list_s
451  */
452 int ckmc_alias_list_new(char *alias, ckmc_alias_list_s **ppalias_list);
453
454 /**
455  * @internal
456  * @brief Creates a new @a ckmc_alias_list_s handle, adds it to a previous @a ckmc_alias_list_s and returns it.
457  *        The alias pointer in the returned @a ckmc_alias_list_s handle points to the provided characters and next is null.
458  *
459  * @since_tizen 2.3
460  *
461  * @param[in]  previous  The last @a ckmc_alias_list_s handle to which a newly created @a ckmc_alias_list_s is added
462  * @param[in]  alias     The item to be set in the newly created @a ckmc_alias_list_s
463  * @param[out] pplast    The pointer to a newly created and added @a ckmc_alias_list_s handle
464  *
465  * @return @c 0 on success,
466  *         otherwise a negative error value
467  *
468  * @retval #CKMC_ERROR_INVALID_PARAMETER  Input parameter is invalid
469  * @retval #CKMC_ERROR_OUT_OF_MEMORY      Not enough memory
470  *
471  * @see ckmc_alias_list_all_free()
472  * @see #ckmc_alias_list_s
473  */
474 int ckmc_alias_list_add(ckmc_alias_list_s *previous,
475         char *alias, ckmc_alias_list_s **pplast);
476
477 /**
478  * @internal
479  * @brief Destroys the @a ckmc_alias_list_s handle and releases resources of @a ckmc_alias_list_s from the provided first handle cascadingly.
480  *
481  * @since_tizen 2.3
482  *
483  * @remarks It does not destroy an alias itself in @a ckmc_alias_list_s.
484  *
485  * @param[in] first The first @a ckmc_alias_list_s handle to destroy
486  *
487  * @see ckmc_alias_list_all_free()
488  * @see #ckmc_alias_list_s
489  */
490 void ckmc_alias_list_free(ckmc_alias_list_s *first);
491
492 /**
493  * @brief Destroys the @a ckmc_alias_list_s handle and releases all its resources from the provided first handle cascadingly.
494  *
495  * @since_tizen 2.3
496  *
497  * @remarks It also destroys the alias in @a ckmc_alias_list_s.
498  *
499  * @param[in] first The first @a ckmc_alias_list_s handle to destroy
500  *
501  * @see #ckmc_alias_list_s
502  */
503 void ckmc_alias_list_all_free(ckmc_alias_list_s *first);
504
505 /**
506  * @internal
507  * @brief Creates a new @a ckmc_cert_list_s handle and returns it.
508  *        The cert pointer in the returned @a ckmc_cert_list_s handle points to the provided @a ckmc_cert_s and next is null.
509  *
510  * @since_tizen 2.3
511  *
512  * @remarks You must destroy the newly created @a ckmc_cert_list_s by calling ckmc_cert_list_free() or ckmc_cert_list_all_free() if it is no longer needed.
513  *
514  * @param[in]  cert          The first item to be set in the newly created @a ckmc_cert_list_s
515  * @param[out] ppalias_list  The pointer to a newly created @a ckmc_alias_list_s handle
516  *
517  * @return @c 0 on success,
518  *         otherwise a negative error value
519  *
520  * @retval #CKMC_ERROR_INVALID_PARAMETER  Input parameter is invalid
521  * @retval #CKMC_ERROR_OUT_OF_MEMORY      Not enough memory
522  *
523  * @see ckmc_cert_list_all_free()
524  * @see #ckmc_cert_list_s
525  */
526 int ckmc_cert_list_new(ckmc_cert_s *cert, ckmc_cert_list_s **ppalias_list);
527
528 /**
529  * @internal
530  * @brief Creates a new @a ckmc_cert_list_s handle, adds it to a previous @a ckmc_cert_list_s and returns it.
531  *        The cert pointer in the returned @a ckmc_alias_list_s handle points to the provided @a ckmc_cert_s and next is null.
532  *
533  * @since_tizen 2.3
534  *
535  * @param[in]  previous  The last @a ckmc_cert_list_s handle to which a newly created @a ckmc_cert_list_s is added
536  * @param[in]  cert      The item to be set in the newly created @a ckmc_cert_list_s
537  * @param[out] pplast    The pointer to a newly created and added @a ckmc_alias_list_s handle
538  *
539  * @return @c 0 on success,
540  *         otherwise a negative error value
541  *
542  * @retval #CKMC_ERROR_INVALID_PARAMETER  Input parameter is invalid
543  * @retval #CKMC_ERROR_OUT_OF_MEMORY      Not enough memory
544  *
545  * @see ckmc_cert_list_all_free()
546  * @see #ckmc_cert_list_s
547  */
548 int ckmc_cert_list_add(ckmc_cert_list_s *previous,
549         ckmc_cert_s *cert, ckmc_cert_list_s **pplast);
550
551 /**
552  * @internal
553  * @brief Destroys the @a ckmc_cert_list_s handle and releases resources of @a ckmc_cert_list_s from the provided first handle cascadingly.
554  *
555  * @since_tizen 2.3
556  *
557  * @remarks It does not destroy @a ckmc_cert_s itself in @a ckmc_cert_list_s.
558  *
559  * @param[in] first The first @a ckmc_cert_list_s handle to destroy
560  *
561  * @see ckmc_cert_list_all_free()
562  * @see #ckmc_cert_list_s
563  */
564 void ckmc_cert_list_free(ckmc_cert_list_s *first);
565
566 /**
567  * @brief Destroys the @a ckmc_cert_list_s handle and releases all its resources from the provided first handle cascadingly.
568  *
569  * @since_tizen 2.3
570  *
571  * @remarks It also destroys @a ckmc_cert_s in ckmc_cert_list_s.
572  *
573  * @param[in] first The first @a ckmc_cert_list_s handle to destroy
574  *
575  * @see #ckmc_cert_list_s
576  */
577 void ckmc_cert_list_all_free(ckmc_cert_list_s *first);
578
579 /**
580  * @}
581  */
582
583 #ifdef __cplusplus
584 }
585 #endif
586
587 #endif /* __TIZEN_CORE_CKMC_TYPE_H */