/**
* @brief Decrypts a user key with password. A decrypted user key exists only on memory. If this API is called for the first time, a user key will be generated internally.
- *
* @remarks The user key is a randomly generated key used in encrypting user data. And the user key is protected by a user's password.
*
* @param[in] user is a uid of a user whose key is decrypted.
* @param[in] password is used in decrypting a user key.
*
* @return 0 on success, otherwise a negative error value
- * @retval #CKM_API_SUCCESS Successful
- * @retval #CKM_API_ERROR_SERVER_ERROR failed to unlock user key
- * @retval #CKM_API_ERROR_INPUT_PARAM invalid input parameter
- * @retval #CKM_API_ERROR_AUTHENTICATION_FAILED not correct password
- *
- * @see ckm_lock_user_key()
- * @see ckm_remove_user_data()
- * @see ckm_change_user_password()
- * @see ckm_reset_user_password()
+ * @exception #CKMC_API_SUCCESS Successful
+ * @exception #CKMC_API_ERROR_SERVER_ERROR failed to unlock user key
+ * @exception #CKMC_API_ERROR_INPUT_PARAM invalid input parameter
+ * @exception #CKMC_API_ERROR_AUTHENTICATION_FAILED not correct password
+ *
+ * @see ckmc_lock_user_key()
+ * @see ckmc_remove_user_data()
+ * @see ckmc_change_user_password()
+ * @see ckmc_reset_user_password()
+ *
+ * @since 2.3
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/keymanager.admin *
*/
-int ckm_unlock_user_key(uid_t user, const char *password);
+int ckmc_unlock_user_key(uid_t user, const char *password);
/**
* @brief remove a decrypted user key from memory
* @param[in] user is a uid of a user whose key is removed from memory.
*
* @return 0 on success, otherwise a negative error value
- * @retval #CKM_API_SUCCESS Successful
- * @retval #CKM_API_ERROR_INPUT_PARAM invalid input parameter
+ * @exception #CKMC_API_SUCCESS Successful
+ * @exception #CKMC_API_ERROR_INPUT_PARAM invalid input parameter
+ *
+ * @see ckmc_unlock_user_key()
+ * @see ckmc_remove_user_data()
+ * @see ckmc_change_user_password()
+ * @see ckmc_reset_user_password()
*
- * @see ckm_unlock_user_key()
- * @see ckm_remove_user_data()
- * @see ckm_change_user_password()
- * @see ckm_reset_user_password()
+ * @since 2.3
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/keymanager.admin *
*/
-int ckm_lock_user_key(uid_t user);
+int ckmc_lock_user_key(uid_t user);
/**
* @brief remove user data from Store and erase a user key used for encryption
* @param[in] user is a uid of a user whose data and key are removed
*
* @return 0 on success, otherwise a negative error value
- * @retval #CKM_API_SUCCESS Successful
- * @retval #CKM_API_ERROR_INPUT_PARAM invalid input parameter
+ * @exception #CKMC_API_SUCCESS Successful
+ * @exception #CKMC_API_ERROR_INPUT_PARAM invalid input parameter
*
- * @see ckm_unlock_user_key()
- * @see ckm_lock_user_key()
- * @see ckm_change_user_password()
- * @see ckm_reset_user_password()
+ * @see ckmc_unlock_user_key()
+ * @see ckmc_lock_user_key()
+ * @see ckmc_change_user_password()
+ * @see ckmc_reset_user_password()
+ *
+ * @since 2.3
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/keymanager.admin *
*/
-int ckm_remove_user_data(uid_t user);
+int ckmc_remove_user_data(uid_t user);
/**
* @brief change a password for a user. key manager decrypts a user key with old password and re-encrypts a user key with new password.
* @param[in] new_password is used in re-encrypting a user key.
*
* @return 0 on success, otherwise a negative error value
- * @retval #CKM_API_SUCCESS Successful
- * @retval #CKM_API_ERROR_INPUT_PARAM invalid input parameter
- * @retval #CKM_API_ERROR_AUTHENTICATION_FAILED not correct password
- * @retval #CKM_API_ERROR_BAD_REQUEST no information about old password
- *
- * @see ckm_unlock_user_key()
- * @see ckm_lock_user_key()
- * @see ckm_remove_user_data()
- * @see ckm_reset_user_password()
+ * @exception #CKMC_API_SUCCESS Successful
+ * @exception #CKMC_API_ERROR_INPUT_PARAM invalid input parameter
+ * @exception #CKMC_API_ERROR_AUTHENTICATION_FAILED not correct password
+ * @exception #CKMC_API_ERROR_BAD_REQUEST no information about old password
+ *
+ * @see ckmc_unlock_user_key()
+ * @see ckmc_lock_user_key()
+ * @see ckmc_remove_user_data()
+ * @see ckmc_reset_user_password()
+ *
+ * @since 2.3
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/keymanager.admin *
*/
-int ckm_change_user_password(uid_t user, const char *old_password, const char *new_password);
+int ckmc_change_user_password(uid_t user, const char *old_password, const char *new_password);
/**
* @brief change a password for a user without old password.
* @param[in] new_password is used in re-encrypting a user key.
*
* @return 0 on success, otherwise a negative error value
- * @retval #CKM_API_SUCCESS Successful
- * @retval #CKM_API_ERROR_INPUT_PARAM invalid input parameter
- * @retval #CKM_API_ERROR_BAD_REQUEST a user key is not unlocked.
+ * @exception #CKMC_API_SUCCESS Successful
+ * @exception #CKMC_API_ERROR_INPUT_PARAM invalid input parameter
+ * @exception #CKMC_API_ERROR_BAD_REQUEST a user key is not unlocked.
*
* @pre User must be already logged in and his user key is already loaded into memory in plain text form.
*
- * @see ckm_unlock_user_key()
- * @see ckm_lock_user_key()
- * @see ckm_remove_user_data()
- * @see ckm_change_user_password()
+ * @see ckmc_unlock_user_key()
+ * @see ckmc_lock_user_key()
+ * @see ckmc_remove_user_data()
+ * @see ckmc_change_user_password()
+ *
+ * @since 2.3
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/keymanager.admin *
*/
-int ckm_reset_user_password(uid_t user, const char *newPassword);
+int ckmc_reset_user_password(uid_t user, const char *newPassword);
/**
/**
* @brief indicating the result of the one specific API is successful
*/
-#define CKM_API_SUCCESS 0
+#define CKMC_API_SUCCESS 0
/**
* @brief indicating the socket between client and Central Key Manager failed
*/
-#define CKM_API_ERROR_SOCKET -1
+#define CKMC_API_ERROR_SOCKET -1
/**
* @brief indicating the request from client is malformed
*/
-#define CKM_API_ERROR_BAD_REQUEST -2
+#define CKMC_API_ERROR_BAD_REQUEST -2
/**
* @brief indicating the response from Central Key Manager is malformed
*/
-#define CKM_API_ERROR_BAD_RESPONSE -3
+#define CKMC_API_ERROR_BAD_RESPONSE -3
/**
* @brief indicating the transmitting request failed.
* @remarks This Error code is deprecated.
*/
-#define CKM_API_ERROR_SEND_FAILED -4
+#define CKMC_API_ERROR_SEND_FAILED -4
/**
* @brief indicating the receiving response failed.
* @remarks This Error code is deprecated.
*/
-#define CKM_API_ERROR_RECV_FAILED -5
+#define CKMC_API_ERROR_RECV_FAILED -5
/**
* @brief indicating the authentication between client and manager failed.
* @remarks This Error code is deprecated.
*/
-#define CKM_API_ERROR_AUTHENTICATION_FAILED -6
+#define CKMC_API_ERROR_AUTHENTICATION_FAILED -6
/**
* @brief indicating the API's input parameter is malformed
*/
-#define CKM_API_ERROR_INPUT_PARAM -7
+#define CKMC_API_ERROR_INPUT_PARAM -7
/**
* @brief indicating the output buffer size which is passed as parameter is too small
*/
-#define CKM_API_ERROR_BUFFER_TOO_SMALL -8
+#define CKMC_API_ERROR_BUFFER_TOO_SMALL -8
/**
* @brief indicating system is running out of memory state
*/
-#define CKM_API_ERROR_OUT_OF_MEMORY -9
+#define CKMC_API_ERROR_OUT_OF_MEMORY -9
/**
* @brief indicating the access has been denied by Central Key Manager
*/
-#define CKM_API_ERROR_ACCESS_DENIED -10
+#define CKMC_API_ERROR_ACCESS_DENIED -10
/**
* @brief indicating Central Key Manager has been failed for some reason
*/
-#define CKM_API_ERROR_SERVER_ERROR -11
+#define CKMC_API_ERROR_SERVER_ERROR -11
/**
* @brief indicating the database was not unlocked - user did not login
*/
-#define CKM_API_ERROR_DB_LOCKED -12
+#define CKMC_API_ERROR_DB_LOCKED -12
/**
* @brief indicating an internal error inside the database
*/
-#define CKM_API_ERROR_DB_ERROR -13
+#define CKMC_API_ERROR_DB_ERROR -13
/**
* @brief indicating that provided alias already exists in the database
*/
-#define CKM_API_ERROR_DB_ALIAS_EXISTS -14
+#define CKMC_API_ERROR_DB_ALIAS_EXISTS -14
/**
* @brief indicating that request given to database returned no result
*/
-#define CKM_API_ERROR_DB_ALIAS_UNKNOWN -15
+#define CKMC_API_ERROR_DB_ALIAS_UNKNOWN -15
/**
* @brief indicating that CA certificate(s) were unknown and chain could not be created
*/
-#define CKM_API_ERROR_VERIFICATION_FAILED -16
+#define CKMC_API_ERROR_VERIFICATION_FAILED -16
/**
* @brief indicating that a provided file or binary has not a valid format
*/
-#define CKM_API_ERROR_INVALID_FORMAT -17
+#define CKMC_API_ERROR_INVALID_FORMAT -17
/**
* @brief indicating that provided file doesn't exists or cannot be accessed in the file system
*/
-#define CKM_API_ERROR_FILE_ACCESS_DENIED -18
+#define CKMC_API_ERROR_FILE_ACCESS_DENIED -18
/**
* @brief indicating the error with unknown reason
*/
-#define CKM_API_ERROR_UNKNOWN -255
+#define CKMC_API_ERROR_UNKNOWN -255
/**
*
* @remarks Currently only four types of keys are supported for this API. These are RSA public/private key and ECDSA /private key.
* @remarks key_type in key may be set to #CKM_KEY_NONE as an input. key_type is determined inside key manager during storing keys.
- * @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 #ckm_key structure.
+ * @remarks Some private key files are protected by a password. if raw_key in key read from those encrypted files is encrypted with a password, the password should be provided in the #ckmc_key structure.
* @remarks if password in policy is provided, the key is additionally encrypted with the password in policy.
*
* @param[in] alias is the name of a key to be stored
* @param[in] policy is about how to store a key securely.
*
* @return 0 on success, otherwise a negative error value
- * @retval #CKM_API_SUCCESS Successful
- * @retval #CKM_API_ERROR_INPUT_PARAM input parameter is invalid
- * @retval #CKM_API_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
- * @retval #CKM_API_ERROR_DB_ALIAS_EXISTS alias already exists.
- * @retval #CKM_API_ERROR_INVALID_FORMAT the format of raw_key is not valid.
- * @retval #CKM_API_ERROR_DB_ERROR failed due to other DB transaction unexpectedly.
+ * @exception #CKMC_API_SUCCESS Successful
+ * @exception #CKMC_API_ERROR_INPUT_PARAM input parameter is invalid
+ * @exception #CKMC_API_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
+ * @exception #CKMC_API_ERROR_DB_ALIAS_EXISTS alias already exists.
+ * @exception #CKMC_API_ERROR_INVALID_FORMAT the format of raw_key is not valid.
+ * @exception #CKMC_API_ERROR_DB_ERROR failed due to other DB transaction unexpectedly.
*
* @pre User must be already logged in and his user key is already loaded into memory in plain text form.
*
- * @see ckm_remove_key()
- * @see ckm_get_key()
- * @see ckm_get_key_alias_list()
- * @see #ckm_key
- * @see #ckm_policy
+ * @see ckmc_remove_key()
+ * @see ckmc_get_key()
+ * @see ckmc_get_key_alias_list()
+ * @see #ckmc_key
+ * @see #ckmc_policy
+ *
+ * @since 2.3
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/keymanager *
*/
-int ckm_save_key(const char *alias, const ckm_key key, const ckm_policy policy);
+int ckmc_save_key(const char *alias, const ckmc_key key, const ckmc_policy policy);
/**
* @brief Removes a key from key manager
* @param[in] alias is the name of a key to be removed
*
* @return 0 on success, otherwise a negative error value
- * @retval #CKM_API_SUCCESS Successful
- * @retval #CKM_API_ERROR_INPUT_PARAM input parameter is invalid
- * @retval #CKM_API_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
- * @retval #CKM_API_ERROR_DB_ERROR failed due to the error with unknown reason
- * @retval #CKM_API_ERROR_DB_ALIAS_UNKNOWN alias doesn't exists.
+ * @exception #CKMC_API_SUCCESS Successful
+ * @exception #CKMC_API_ERROR_INPUT_PARAM input parameter is invalid
+ * @exception #CKMC_API_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
+ * @exception #CKMC_API_ERROR_DB_ERROR failed due to the error with unknown reason
+ * @exception #CKMC_API_ERROR_DB_ALIAS_UNKNOWN alias doesn't exists.
*
* @pre User must be already logged in and his user key is already loaded into memory in plain text form.
*
- * @see ckm_save_key()
- * @see ckm_get_key()
- * @see ckm_get_key_alias_list()
+ * @see ckmc_save_key()
+ * @see ckmc_get_key()
+ * @see ckmc_get_key_alias_list()
+ *
+ * @since 2.3
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/keymanager *
*/
-int ckm_remove_key(const char *alias);
+int ckmc_remove_key(const char *alias);
/**
* @brief Get a key from key manager
*
* @remarks a client can access only data stored by the client and non-restricted data stored by other clients.
- * @remarks A newly created ppkey should be destroyed by calling ckm_key_free() if it is no longer needed.
+ * @remarks A newly created ppkey should be destroyed by calling ckmc_key_free() if it is no longer needed.
*
* @param[in] alias is the name of a key to retrieve
- * @param[in] password is used in decrypting a key value. If password of policy is provided in ckm_save_key(), the same password should be provided.
- * @param[out] ppkey is a pointer to a newly created ckm_key handle
+ * @param[in] password is used in decrypting a key value. If password of policy is provided in ckmc_save_key(), the same password should be provided.
+ * @param[out] ppkey is a pointer to a newly created ckmc_key handle
*
* @return 0 on success, otherwise a negative error value
- * @retval #CKM_API_SUCCESS Successful
- * @retval #CKM_API_ERROR_INPUT_PARAM input parameter is invalid
- * @retval #CKM_API_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
- * @retval #CKM_API_ERROR_DB_ERROR failed due to the error with unknown reason
- * @retval #CKM_API_ERROR_DB_ALIAS_UNKNOWN alias doesn't exists.
+ * @exception #CKMC_API_SUCCESS Successful
+ * @exception #CKMC_API_ERROR_INPUT_PARAM input parameter is invalid
+ * @exception #CKMC_API_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
+ * @exception #CKMC_API_ERROR_DB_ERROR failed due to the error with unknown reason
+ * @exception #CKMC_API_ERROR_DB_ALIAS_UNKNOWN alias doesn't exists.
*
* @pre User must be already logged in and his user key is already loaded into memory in plain text form.
*
- * @see ckm_save_key()
- * @see ckm_remove_key()
- * @see ckm_get_key_alias_list()
+ * @see ckmc_save_key()
+ * @see ckmc_remove_key()
+ * @see ckmc_get_key_alias_list()
+ *
+ * @since 2.3
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/keymanager *
*/
-int ckm_get_key(const char *alias, const char *password, ckm_key **ppkey);
+int ckmc_get_key(const char *alias, const char *password, ckmc_key **ppkey);
/**
* @brief Get a all alias of keys to which the client can access
*
* @remarks a client can access only data stored by the client and non-restricted data stored by other clients.
- * @remarks A newly created ppalias_list should be destroyed by calling ckm_alias_list_all_free() if it is no longer needed.
+ * @remarks A newly created ppalias_list should be destroyed by calling ckmc_alias_list_all_free() if it is no longer needed.
*
- * @param[out] ppalias_list is a pointer to a newly created ckm_alias_list handle containing all available alias of keys. If there is no available key alias, *ppalias_list will be null.
+ * @param[out] ppalias_list is a pointer to a newly created ckmc_alias_list handle containing all available alias of keys. If there is no available key alias, *ppalias_list will be null.
*
* @return 0 on success, otherwise a negative error value
- * @retval #CKM_API_SUCCESS Successful
- * @retval #CKM_API_ERROR_INPUT_PARAM input parameter is invalid
- * @retval #CKM_API_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
- * @retval #CKM_API_ERROR_DB_ERROR failed due to the error with unknown reason
- * @retval #CKM_API_ERROR_DB_ALIAS_UNKNOWN alias doesn't exists.
+ * @exception #CKMC_API_SUCCESS Successful
+ * @exception #CKMC_API_ERROR_INPUT_PARAM input parameter is invalid
+ * @exception #CKMC_API_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
+ * @exception #CKMC_API_ERROR_DB_ERROR failed due to the error with unknown reason
+ * @exception #CKMC_API_ERROR_DB_ALIAS_UNKNOWN alias doesn't exists.
*
* @pre User must be already logged in and his user key is already loaded into memory in plain text form.
*
- * @see ckm_save_key()
- * @see ckm_remove_key()
- * @see ckm_get_key()
+ * @see ckmc_save_key()
+ * @see ckmc_remove_key()
+ * @see ckmc_get_key()
+ *
+ * @since 2.3
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/keymanager *
*/
-int ckm_get_key_alias_list(ckm_alias_list** ppalias_list);
+int ckmc_get_key_alias_list(ckmc_alias_list** ppalias_list);
* @param[in] policy is about how to store a certificate securely.
*
* @return 0 on success, otherwise a negative error value
- * @retval #CKM_API_SUCCESS Successful
- * @retval #CKM_API_ERROR_INPUT_PARAM input parameter is invalid
- * @retval #CKM_API_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
- * @retval #CKM_API_ERROR_DB_ALIAS_EXISTS alias already exists.
- * @retval #CKM_API_ERROR_INVALID_FORMAT the format of raw_cert is not valid.
- * @retval #CKM_API_ERROR_DB_ERROR failed due to other DB transaction unexpectedly.
+ * @exception #CKMC_API_SUCCESS Successful
+ * @exception #CKMC_API_ERROR_INPUT_PARAM input parameter is invalid
+ * @exception #CKMC_API_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
+ * @exception #CKMC_API_ERROR_DB_ALIAS_EXISTS alias already exists.
+ * @exception #CKMC_API_ERROR_INVALID_FORMAT the format of raw_cert is not valid.
+ * @exception #CKMC_API_ERROR_DB_ERROR failed due to other DB transaction unexpectedly.
*
* @pre User must be already logged in and his user key is already loaded into memory in plain text form.
*
- * @see ckm_remove_cert()
- * @see ckm_get_cert()
- * @see ckm_get_cert_alias_list()
- * @see #ckm_cert
- * @see #ckm_policy
+ * @see ckmc_remove_cert()
+ * @see ckmc_get_cert()
+ * @see ckmc_get_cert_alias_list()
+ * @see #ckmc_cert
+ * @see #ckmc_policy
+ *
+ * @since 2.3
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/keymanager *
*/
-int ckm_save_cert(const char *alias, const ckm_cert cert, const ckm_policy policy);
+int ckmc_save_cert(const char *alias, const ckmc_cert cert, const ckmc_policy policy);
/**
* @brief Removes a certificate from key manager
* @param[in] alias is the name of a certificate to be removed
*
* @return 0 on success, otherwise a negative error value
- * @retval #CKM_API_SUCCESS Successful
- * @retval #CKM_API_ERROR_INPUT_PARAM input parameter is invalid
- * @retval #CKM_API_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
- * @retval #CKM_API_ERROR_DB_ERROR failed due to the error with unknown reason
- * @retval #CKM_API_ERROR_DB_ALIAS_UNKNOWN alias doesn't exists.
+ * @exception #CKMC_API_SUCCESS Successful
+ * @exception #CKMC_API_ERROR_INPUT_PARAM input parameter is invalid
+ * @exception #CKMC_API_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
+ * @exception #CKMC_API_ERROR_DB_ERROR failed due to the error with unknown reason
+ * @exception #CKMC_API_ERROR_DB_ALIAS_UNKNOWN alias doesn't exists.
*
* @pre User must be already logged in and his user key is already loaded into memory in plain text form.
*
- * @see ckm_save_cert()
- * @see ckm_get_cert()
- * @see ckm_get_cert_alias_list()
+ * @see ckmc_save_cert()
+ * @see ckmc_get_cert()
+ * @see ckmc_get_cert_alias_list()
+ *
+ * @since 2.3
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/keymanager *
*/
-int ckm_remove_cert(const char *alias);
+int ckmc_remove_cert(const char *alias);
/**
* @brief Get a certificate from key manager
*
* @remarks a client can access only certificate stored by the client and non-restricted certificate stored by other clients.
- * @remarks A newly created ppcert should be destroyed by calling ckm_cert_free() if it is no longer needed.
+ * @remarks A newly created ppcert should be destroyed by calling ckmc_cert_free() if it is no longer needed.
*
* @param[in] alias is the name of a certificate to retrieve
- * @param[in] password is used in decrypting a certificate value. If password of policy is provided in ckm_save_cert(), the same password should be provided.
- * @param[out] ppcert is a pointer to a newly created ckm_cert handle
+ * @param[in] password is used in decrypting a certificate value. If password of policy is provided in ckmc_save_cert(), the same password should be provided.
+ * @param[out] ppcert is a pointer to a newly created ckmc_cert handle
*
* @return 0 on success, otherwise a negative error value
- * @retval #CKM_API_SUCCESS Successful
- * @retval #CKM_API_ERROR_INPUT_PARAM input parameter is invalid
- * @retval #CKM_API_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
- * @retval #CKM_API_ERROR_DB_ERROR failed due to the error with unknown reason
- * @retval #CKM_API_ERROR_DB_ALIAS_UNKNOWN alias doesn't exists.
+ * @exception #CKMC_API_SUCCESS Successful
+ * @exception #CKMC_API_ERROR_INPUT_PARAM input parameter is invalid
+ * @exception #CKMC_API_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
+ * @exception #CKMC_API_ERROR_DB_ERROR failed due to the error with unknown reason
+ * @exception #CKMC_API_ERROR_DB_ALIAS_UNKNOWN alias doesn't exists.
*
* @pre User must be already logged in and his user key is already loaded into memory in plain text form.
*
- * @see ckm_save_cert()
- * @see ckm_remove_cert()
- * @see ckm_get_cert_alias_list()
+ * @see ckmc_save_cert()
+ * @see ckmc_remove_cert()
+ * @see ckmc_get_cert_alias_list()
+ *
+ * @since 2.3
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/keymanager *
*/
-int ckm_get_cert(const char *alias, const char *password, const ckm_cert **ppcert);
+int ckmc_get_cert(const char *alias, const char *password, ckmc_cert **ppcert);
/**
* @brief Get a all alias of certificates to which the client can access
*
* @remarks a client can access only data stored by the client and non-restricted data stored by other clients.
- * @remarks A newly created ppalias_list should be destroyed by calling ckm_alias_list_all_free() if it is no longer needed.
+ * @remarks A newly created ppalias_list should be destroyed by calling ckmc_alias_list_all_free() if it is no longer needed.
*
- * @param[out] ppalias_list is a pointer to a newly created ckm_alias_list handle containing all available alias of keys. If there is no available key alias, *ppalias_list will be null.
+ * @param[out] ppalias_list is a pointer to a newly created ckmc_alias_list handle containing all available alias of keys. If there is no available key alias, *ppalias_list will be null.
*
* @return 0 on success, otherwise a negative error value
- * @retval #CKM_API_SUCCESS Successful
- * @retval #CKM_API_ERROR_INPUT_PARAM input parameter is invalid
- * @retval #CKM_API_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
- * @retval #CKM_API_ERROR_DB_ERROR failed due to the error with unknown reason
- * @retval #CKM_API_ERROR_DB_ALIAS_UNKNOWN alias doesn't exists.
+ * @exception #CKMC_API_SUCCESS Successful
+ * @exception #CKMC_API_ERROR_INPUT_PARAM input parameter is invalid
+ * @exception #CKMC_API_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
+ * @exception #CKMC_API_ERROR_DB_ERROR failed due to the error with unknown reason
+ * @exception #CKMC_API_ERROR_DB_ALIAS_UNKNOWN alias doesn't exists.
*
* @pre User must be already logged in and his user key is already loaded into memory in plain text form.
*
- * @see ckm_save_cert()
- * @see ckm_remove_cert()
- * @see ckm_get_cert()
+ * @see ckmc_save_cert()
+ * @see ckmc_remove_cert()
+ * @see ckmc_get_cert()
+ *
+ * @since 2.3
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/keymanager *
*/
-int ckm_get_cert_alias_list(ckm_alias_list** ppalias_list);
+int ckmc_get_cert_alias_list(ckmc_alias_list** ppalias_list);
* @param[in] policy is about how to store a data securely.
*
* @return 0 on success, otherwise a negative error value
- * @retval #CKM_API_SUCCESS Successful
- * @retval #CKM_API_ERROR_INPUT_PARAM input parameter is invalid
- * @retval #CKM_API_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
- * @retval #CKM_API_ERROR_DB_ALIAS_EXISTS alias already exists.
- * @retval #CKM_API_ERROR_DB_ERROR failed due to other DB transaction unexpectedly.
+ * @exception #CKMC_API_SUCCESS Successful
+ * @exception #CKMC_API_ERROR_INPUT_PARAM input parameter is invalid
+ * @exception #CKMC_API_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
+ * @exception #CKMC_API_ERROR_DB_ALIAS_EXISTS alias already exists.
+ * @exception #CKMC_API_ERROR_DB_ERROR failed due to other DB transaction unexpectedly.
*
* @pre User must be already logged in and his user key is already loaded into memory in plain text form.
*
- * @see ckm_remove_data()
- * @see ckm_get_data()
- * @see ckm_get_data_alias_list()
- * @see #ckm_raw_buffer
- * @see #ckm_policy
+ * @see ckmc_remove_data()
+ * @see ckmc_get_data()
+ * @see ckmc_get_data_alias_list()
+ * @see #ckmc_raw_buffer
+ * @see #ckmc_policy
+ *
+ * @since 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/keymanager *
*/
-int ckm_save_data(const char *alias, ckm_raw_buffer data, const ckm_policy policy);
+int ckmc_save_data(const char *alias, ckmc_raw_buffer data, const ckmc_policy policy);
/**
* @brief Removes a data from key manager
* @param[in] alias is the name of a data to be removed
*
* @return 0 on success, otherwise a negative error value
- * @retval #CKM_API_SUCCESS Successful
- * @retval #CKM_API_ERROR_INPUT_PARAM input parameter is invalid
- * @retval #CKM_API_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
- * @retval #CKM_API_ERROR_DB_ERROR failed due to the error with unknown reason
- * @retval #CKM_API_ERROR_DB_ALIAS_UNKNOWN alias doesn't exists.
+ * @exception #CKMC_API_SUCCESS Successful
+ * @exception #CKMC_API_ERROR_INPUT_PARAM input parameter is invalid
+ * @exception #CKMC_API_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
+ * @exception #CKMC_API_ERROR_DB_ERROR failed due to the error with unknown reason
+ * @exception #CKMC_API_ERROR_DB_ALIAS_UNKNOWN alias doesn't exists.
*
* @pre User must be already logged in and his user key is already loaded into memory in plain text form.
*
- * @see ckm_save_data()
- * @see ckm_get_data()
- * @see ckm_get_data_alias_list()
+ * @see ckmc_save_data()
+ * @see ckmc_get_data()
+ * @see ckmc_get_data_alias_list()
+ *
+ * @since 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/keymanager *
*/
-int ckm_remove_data(const char *alias);
+int ckmc_remove_data(const char *alias);
/**
* @brief Get a data from key manager
*
* @remarks a client can access only data stored by the client and non-restricted data stored by other clients.
- * @remarks A newly created ppdata should be destroyed by calling ckm_buffer_free() if it is no longer needed.
+ * @remarks A newly created ppdata should be destroyed by calling ckmc_buffer_free() if it is no longer needed.
*
* @param[in] alias is the name of a data to retrieve
- * @param[in] password is used in decrypting a data value. If password of policy is provided in ckm_save_data(), the same password should be provided.
- * @param[out] ppdata is a pointer to a newly created ckm_raw_buffer handle
+ * @param[in] password is used in decrypting a data value. If password of policy is provided in ckmc_save_data(), the same password should be provided.
+ * @param[out] ppdata is a pointer to a newly created ckmc_raw_buffer handle
*
* @return 0 on success, otherwise a negative error value
- * @retval #CKM_API_SUCCESS Successful
- * @retval #CKM_API_ERROR_INPUT_PARAM input parameter is invalid
- * @retval #CKM_API_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
- * @retval #CKM_API_ERROR_DB_ERROR failed due to the error with unknown reason
- * @retval #CKM_API_ERROR_DB_ALIAS_UNKNOWN alias doesn't exists.
+ * @exception #CKMC_API_SUCCESS Successful
+ * @exception #CKMC_API_ERROR_INPUT_PARAM input parameter is invalid
+ * @exception #CKMC_API_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
+ * @exception #CKMC_API_ERROR_DB_ERROR failed due to the error with unknown reason
+ * @exception #CKMC_API_ERROR_DB_ALIAS_UNKNOWN alias doesn't exists.
*
* @pre User must be already logged in and his user key is already loaded into memory in plain text form.
*
- * @see ckm_save_data()
- * @see ckm_remove_data()
- * @see ckm_get_data_alias_list()
+ * @see ckmc_save_data()
+ * @see ckmc_remove_data()
+ * @see ckmc_get_data_alias_list()
+ *
+ * @since 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/keymanager *
*/
-int ckm_get_data(const char *alias, const char *password, ckm_raw_buffer **ppdata);
+int ckmc_get_data(const char *alias, const char *password, ckmc_raw_buffer **ppdata);
/**
* @brief Get a all alias of data to which the client can access
*
* @remarks a client can access only data stored by the client and non-restricted data stored by other clients.
- * @remarks A newly created ppalias_list should be destroyed by calling ckm_alias_list_all_free() if it is no longer needed.
+ * @remarks A newly created ppalias_list should be destroyed by calling ckmc_alias_list_all_free() if it is no longer needed.
*
- * @param[out] ppalias_list is a pointer to a newly created ckm_alias_list handle containing all available alias of keys. If there is no available key alias, *ppalias_list will be null.
+ * @param[out] ppalias_list is a pointer to a newly created ckmc_alias_list handle containing all available alias of keys. If there is no available key alias, *ppalias_list will be null.
*
* @return 0 on success, otherwise a negative error value
- * @retval #CKM_API_SUCCESS Successful
- * @retval #CKM_API_ERROR_INPUT_PARAM input parameter is invalid
- * @retval #CKM_API_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
- * @retval #CKM_API_ERROR_DB_ERROR failed due to the error with unknown reason
- * @retval #CKM_API_ERROR_DB_ALIAS_UNKNOWN alias doesn't exists.
+ * @exception #CKMC_API_SUCCESS Successful
+ * @exception #CKMC_API_ERROR_INPUT_PARAM input parameter is invalid
+ * @exception #CKMC_API_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
+ * @exception #CKMC_API_ERROR_DB_ERROR failed due to the error with unknown reason
+ * @exception #CKMC_API_ERROR_DB_ALIAS_UNKNOWN alias doesn't exists.
*
* @pre User must be already logged in and his user key is already loaded into memory in plain text form.
*
- * @see ckm_save_data()
- * @see ckm_remove_data()
- * @see ckm_get_data()
+ * @see ckmc_save_data()
+ * @see ckmc_remove_data()
+ * @see ckmc_get_data()
+ *
+ * @since 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/keymanager *
*/
-int ckm_get_data_alias_list(ckm_alias_list** ppalias_list);
+int ckmc_get_data_alias_list(ckmc_alias_list** ppalias_list);
* @param[in] policy_public_key is about how to store a public key securely.
*
* @return 0 on success, otherwise a negative error value
- * @retval #CKM_API_SUCCESS Successful
- * @retval #CKM_API_ERROR_INPUT_PARAM input parameter is invalid
- * @retval #CKM_API_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
- * @retval #CKM_API_ERROR_DB_ALIAS_EXISTS alias already exists.
- * @retval #CKM_API_ERROR_DB_ERROR failed due to other DB transaction unexpectedly.
+ * @exception #CKMC_API_SUCCESS Successful
+ * @exception #CKMC_API_ERROR_INPUT_PARAM input parameter is invalid
+ * @exception #CKMC_API_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
+ * @exception #CKMC_API_ERROR_DB_ALIAS_EXISTS alias already exists.
+ * @exception #CKMC_API_ERROR_DB_ERROR failed due to other DB transaction unexpectedly.
*
* @pre User must be already logged in and his user key is already loaded into memory in plain text form.
*
- * @see ckm_create_key_pair_ecdsa()
- * @see ckm_create_signature()
- * @see ckm_verify_signature()
+ * @see ckmc_create_key_pair_ecdsa()
+ * @see ckmc_create_signature()
+ * @see ckmc_verify_signature()
+ *
+ * @since 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/keymanager *
*/
-int ckm_create_key_pair_rsa(const size_t size, const char *private_key_alias, const char *public_key_alias, const ckm_policy policy_private_key, const ckm_policy policy_public_key);
+int ckmc_create_key_pair_rsa(const size_t size, const char *private_key_alias, const char *public_key_alias, const ckmc_policy policy_private_key, const ckmc_policy policy_public_key);
/**
* @brief Creates ECDSA private/public key pair and stores them inside key manager based on each policy.
* @param[in] policy_public_key is about how to store a public key securely.
*
* @return 0 on success, otherwise a negative error value
- * @retval #CKM_API_SUCCESS Successful
- * @retval #CKM_API_ERROR_INPUT_PARAM input parameter is invalid
- * @retval #CKM_API_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
- * @retval #CKM_API_ERROR_DB_ALIAS_EXISTS alias already exists.
- * @retval #CKM_API_ERROR_DB_ERROR failed due to other DB transaction unexpectedly.
+ * @exception #CKMC_API_SUCCESS Successful
+ * @exception #CKMC_API_ERROR_INPUT_PARAM input parameter is invalid
+ * @exception #CKMC_API_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
+ * @exception #CKMC_API_ERROR_DB_ALIAS_EXISTS alias already exists.
+ * @exception #CKMC_API_ERROR_DB_ERROR failed due to other DB transaction unexpectedly.
*
* @pre User must be already logged in and his user key is already loaded into memory in plain text form.
*
- * @see ckm_create_key_pair_rsa()
- * @see ckm_create_signature()
- * @see ckm_verify_signature()
- * @see #ckm_ec_type
+ * @see ckmc_create_key_pair_rsa()
+ * @see ckmc_create_signature()
+ * @see ckmc_verify_signature()
+ * @see #ckmc_ec_type
+ *
+ * @since 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/keymanager *
*/
-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);
+int ckmc_create_key_pair_ecdsa(const ckmc_ec_type type, const char *private_key_alias, const char *public_key_alias, const ckmc_policy policy_private_key, const ckmc_policy policy_public_key);
/**
* @brief Creates a signature on a given message using a private key and returns the signature
*
* @remarks If password of policy is provided during storing a key, the same password should be provided.
- * @remarks A newly created ppsignature should be destroyed by calling ckm_buffer_free() if it is no longer needed.
+ * @remarks A newly created ppsignature should be destroyed by calling ckmc_buffer_free() if it is no longer needed.
*
*
* @param[in] private_key_alias is the name of private key.
* @param[out] ppsignature is a pointer to a newly created signature's. If an error occurs, *ppsignature will be null.
*
* @return 0 on success, otherwise a negative error value
- * @retval #CKM_API_SUCCESS Successful
- * @retval #CKM_API_ERROR_INPUT_PARAM input parameter is invalid
- * @retval #CKM_API_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
- * @retval #CKM_API_ERROR_DB_ALIAS_UNKNOWN alias doesn't exists.
+ * @exception #CKMC_API_SUCCESS Successful
+ * @exception #CKMC_API_ERROR_INPUT_PARAM input parameter is invalid
+ * @exception #CKMC_API_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
+ * @exception #CKMC_API_ERROR_DB_ALIAS_UNKNOWN alias doesn't exists.
*
* @pre User must be already logged in and his user key is already loaded into memory in plain text form.
*
- * @see ckm_create_key_pair_rsa()
- * @see ckm_create_key_pair_ecdsa()
- * @see ckm_verify_signature()
- * @see ckm_buffer_free()
- * @see #ckm_hash_algo
- * @see #ckm_rsa_padding_algo
+ * @see ckmc_create_key_pair_rsa()
+ * @see ckmc_create_key_pair_ecdsa()
+ * @see ckmc_verify_signature()
+ * @see ckmc_buffer_free()
+ * @see #ckmc_hash_algo
+ * @see #ckmc_rsa_padding_algo
+ *
+ * @since 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/keymanager *
*/
-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 **ppsignature);
+int ckmc_create_signature(const char *private_key_alias, const char *password, const ckmc_raw_buffer message, const ckmc_hash_algo hash, const ckmc_rsa_padding_algo padding, ckmc_raw_buffer **ppsignature);
/**
* @brief Verify a given signature on a given message using a public key and returns the signature status.
* @param[in] padding is the RSA padding algorithm used in verifying signature. It is used only when the signature algorithm is RSA.
*
* @return 0 on success and the signature is valid, otherwise a negative error value
- * @retval #CKM_API_SUCCESS Successful
- * @retval #CKM_API_ERROR_VERIFICATION_FAILED the signature is invalid
- * @retval #CKM_API_ERROR_INPUT_PARAM input parameter is invalid
- * @retval #CKM_API_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
- * @retval #CKM_API_ERROR_DB_ALIAS_UNKNOWN alias doesn't exists.
+ * @exception #CKMC_API_SUCCESS Successful
+ * @exception #CKMC_API_ERROR_VERIFICATION_FAILED the signature is invalid
+ * @exception #CKMC_API_ERROR_INPUT_PARAM input parameter is invalid
+ * @exception #CKMC_API_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
+ * @exception #CKMC_API_ERROR_DB_ALIAS_UNKNOWN alias doesn't exists.
*
* @pre User must be already logged in and his user key is already loaded into memory in plain text form.
*
- * @see ckm_create_key_pair_rsa()
- * @see ckm_create_key_pair_ecdsa()
- * @see ckm_verify_signature()
- * @see #ckm_hash_algo
- * @see #ckm_rsa_padding_algo
+ * @see ckmc_create_key_pair_rsa()
+ * @see ckmc_create_key_pair_ecdsa()
+ * @see ckmc_verify_signature()
+ * @see #ckmc_hash_algo
+ * @see #ckmc_rsa_padding_algo
+ *
+ * @since 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/keymanager *
*/
-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);
+int ckmc_verify_signature(const char *public_key_alias, const char *password, const ckmc_raw_buffer message, const ckmc_raw_buffer signature, const ckmc_hash_algo hash, const ckmc_rsa_padding_algo padding);
/**
* @brief Verify a certificate chain and return that chain.
*
* @remarks The trusted root certificate of the chain should exist in the system's certificate storage.
- * @remarks A newly created ppcert_chain_list should be destroyed by calling ckm_cert_list_all_free() if it is no longer needed.
+ * @remarks A newly created ppcert_chain_list should be destroyed by calling ckmc_cert_list_all_free() if it is no longer needed.
*
* @param[in] cert is the certificate to be verified
* @param[in] untrustedcerts is the untrusted CA certificates to be used in verifying a certificate chain.
* @param[out] ppcert_chain_list is a pointer to a newly created certificate chain's handle. If an error occurs, *ppcert_chain_list will be null.
*
* @return 0 on success and the signature is valid, otherwise a negative error value
- * @retval #CKM_API_SUCCESS Successful
- * @retval #CKM_API_ERROR_VERIFICATION_FAILED the certificate chain is not valid
- * @retval #CKM_API_ERROR_INPUT_PARAM input parameter is invalid
- * @retval #CKM_API_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
- * @retval #CKM_API_ERROR_INVALID_FORMAT the format of certificate is not valid.
+ * @exception #CKMC_API_SUCCESS Successful
+ * @exception #CKMC_API_ERROR_VERIFICATION_FAILED the certificate chain is not valid
+ * @exception #CKMC_API_ERROR_INPUT_PARAM input parameter is invalid
+ * @exception #CKMC_API_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
+ * @exception #CKMC_API_ERROR_INVALID_FORMAT the format of certificate is not valid.
*
* @pre User must be already logged in and his user key is already loaded into memory in plain text form.
*
- * @see ckm_get_cert_chain_with_alias())
- * @see ckm_cert_list_all_free()
+ * @see ckmc_get_cert_chain_with_alias())
+ * @see ckmc_cert_list_all_free()
+ *
+ * @since 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/keymanager *
*/
-int ckm_get_cert_chain(const ckm_cert *cert, const ckm_cert_list *untrustedcerts, ckm_cert_list **ppcert_chain_list);
+int ckmc_get_cert_chain(const ckmc_cert *cert, const ckmc_cert_list *untrustedcerts, ckmc_cert_list **ppcert_chain_list);
/**
* @brief Verify a certificate chain using a alias list of untrusted certificates and return that chain.
*
* @remarks The trusted root certificate of the chain should exist in the system's certificate storage.
- * @remarks A newly created ppcert_chain_list should be destroyed by calling ckm_cert_list_all_free() if it is no longer needed.
+ * @remarks A newly created ppcert_chain_list should be destroyed by calling ckmc_cert_list_all_free() if it is no longer needed.
*
* @param[in] cert is the certificate to be verified
* @param[in] untrustedcerts is an alias list of untrusted CA certificates stored in key manager to be used in verifying a certificate chain.
* @param[out] ppcert_chain_list is a pointer to a newly created certificate chain's handle. If an error occurs, *ppcert_chain_list will be null.
*
* @return 0 on success and the signature is valid, otherwise a negative error value
- * @retval #CKM_API_SUCCESS Successful
- * @retval #CKM_API_ERROR_VERIFICATION_FAILED the certificate chain is not valid
- * @retval #CKM_API_ERROR_INPUT_PARAM input parameter is invalid
- * @retval #CKM_API_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
- * @retval #CKM_API_ERROR_DB_ALIAS_UNKNOWN alias doesn't exists.
- * @retval #CKM_API_ERROR_INVALID_FORMAT the format of certificate is not valid.
+ * @exception #CKMC_API_SUCCESS Successful
+ * @exception #CKMC_API_ERROR_VERIFICATION_FAILED the certificate chain is not valid
+ * @exception #CKMC_API_ERROR_INPUT_PARAM input parameter is invalid
+ * @exception #CKMC_API_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
+ * @exception #CKMC_API_ERROR_DB_ALIAS_UNKNOWN alias doesn't exists.
+ * @exception #CKMC_API_ERROR_INVALID_FORMAT the format of certificate is not valid.
*
* @pre User must be already logged in and his user key is already loaded into memory in plain text form.
*
- * @see ckm_get_cert_chain())
- * @see ckm_cert_list_all_free()
+ * @see ckmc_get_cert_chain())
+ * @see ckmc_cert_list_all_free()
+ *
+ * @since 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/keymanager *
*/
-int ckm_get_cert_chain_with_alias(const ckm_cert *cert, const ckm_alias_list *untrustedcerts, ckm_cert_list **ppcert_chain_list);
+int ckmc_get_cert_chain_with_alias(const ckmc_cert *cert, const ckmc_alias_list *untrustedcerts, ckmc_cert_list **ppcert_chain_list);
#ifdef __cplusplus
/**
* @brief Enumeration for key types of key manager.
*/
-typedef enum ckm_key_type_t {
- CKM_KEY_NONE =0, /**< key type not specified */
- CKM_KEY_RSA_PUBLIC, /**< RSA public key */
- CKM_KEY_RSA_PRIVATE, /**< RSA private key */
- CKM_KEY_ECDSA_PUBLIC, /**< ECDSA public key */
- CKM_KEY_ECDSA_PRIVATE, /**< ECDSA private key */
-} ckm_key_type;
+typedef enum ckmc_key_type_t {
+ CKMC_KEY_NONE =0, /**< key type not specified */
+ CKMC_KEY_RSA_PUBLIC, /**< RSA public key */
+ CKMC_KEY_RSA_PRIVATE, /**< RSA private key */
+ CKMC_KEY_ECDSA_PUBLIC, /**< ECDSA public key */
+ CKMC_KEY_ECDSA_PRIVATE, /**< ECDSA private key */
+} ckmc_key_type;
/**
* @brief Enumeration for data format.
*/
-typedef enum ckm_data_format_t {
- CKM_FORM_DER_BASE64 =0, /**< DER format base64 encoded data */
- CKM_FORM_DER, /**< DER encoded data */
- CKM_FORM_PEM /**< PEM encoded data. It consists of the DER format base64 encoded with additional header and footer lines */
-} ckm_data_format;
+typedef enum ckmc_data_format_t {
+ CKMC_FORM_DER_BASE64 =0, /**< DER format base64 encoded data */
+ CKMC_FORM_DER, /**< DER encoded data */
+ CKMC_FORM_PEM /**< PEM encoded data. It consists of the DER format base64 encoded with additional header and footer lines */
+} ckmc_data_format;
/**
* @brief Enumeration for eliptic curve.
*/
-typedef enum ckm_ec_type_t {
- CKM_EC_PRIME192V1 =0, /**< Elliptic curve domain "secp192r1" listed in "SEC 2" recommended elliptic curve domain */
- CKM_EC_PRIME256V1, /**< "SEC 2" recommended elliptic curve domain - secp256r1 */
- CKM_EC_SECP384R1 /**< NIST curve P-384 (covers "secp384r1", the elliptic curve domain listed in See SEC 2 */
-} ckm_ec_type;
+typedef enum ckmc_ec_type_t {
+ CKMC_EC_PRIME192V1 =0, /**< Elliptic curve domain "secp192r1" listed in "SEC 2" recommended elliptic curve domain */
+ CKMC_EC_PRIME256V1, /**< "SEC 2" recommended elliptic curve domain - secp256r1 */
+ CKMC_EC_SECP384R1 /**< NIST curve P-384 (covers "secp384r1", the elliptic curve domain listed in See SEC 2 */
+} ckmc_ec_type;
/**
* @brief Enumeration for bool type used within key manager CAPI.
*/
-typedef enum ckm_bool_t {
- CKM_FALSE =0, /**< false */
- CKM_TRUE /**< true */
-} ckm_bool;
+typedef enum ckmc_bool_t {
+ CKMC_FALSE =0, /**< false */
+ CKMC_TRUE /**< true */
+} ckmc_bool;
/**
* @brief Enumeration for hash algorithm.
*/
-typedef enum ckm_hash_algo_t {
- CKM_HASH_SHA1 =0, /**< Hash Algorithm SHA1 */
- CKM_HASH_SHA256, /**< Hash Algorithm SHA256 */
- CKM_HASH_SHA384, /**< Hash Algorithm SHA384 */
- CKM_HASH_SHA512 /**< Hash Algorithm SHA512 */
-} ckm_hash_algo;
+typedef enum ckmc_hash_algo_t {
+ CKMC_HASH_SHA1 =0, /**< Hash Algorithm SHA1 */
+ CKMC_HASH_SHA256, /**< Hash Algorithm SHA256 */
+ CKMC_HASH_SHA384, /**< Hash Algorithm SHA384 */
+ CKMC_HASH_SHA512 /**< Hash Algorithm SHA512 */
+} ckmc_hash_algo;
/**
* @brief Enumeration for RSA padding algorithm.
*/
-typedef enum ckm_rsa_padding_algo_t {
- CKM_PKCS1_PADDING =0, /**< PKCS#1 Padding */
- CKM_X931_PADDING /**< X9.31 padding */
-} ckm_rsa_padding_algo;
+typedef enum ckmc_rsa_padding_algo_t {
+ CKMC_PKCS1_PADDING =0, /**< PKCS#1 Padding */
+ CKMC_X931_PADDING /**< X9.31 padding */
+} ckmc_rsa_padding_algo;
* @details @a data is byte array containing some binary data
* @a size is the size of the binary data
*/
-typedef struct ckm_raw_buff_t{
+typedef struct ckmc_raw_buff_t{
unsigned char* data;
size_t size;
-} ckm_raw_buffer;
+} ckmc_raw_buffer;
/**
* @brief a policy for storing key/certificate/binary data
* if @a extractable true, key may be extracted from storage
* if @a restricted true, only key owner can see data
*/
-typedef struct ckm_policy_t {
+typedef struct ckmc_policy_t {
char* password; // byte array used to encrypt data inside CKM
- ckm_bool extractable; // if true key may be extracted from storage
- ckm_bool restricted; // if true only key owner may see data
-} ckm_policy;
+ ckmc_bool extractable; // if true key may be extracted from storage
+ ckmc_bool restricted; // if true only key owner may see data
+} ckmc_policy;
/**
* @brief key structure used in key manager CAPI
* @a key_type is the raw_key's type
* if @a password is byte array used to decrypt raw_key inside key manager.
*/
-typedef struct ckm_key_t {
+typedef struct ckmc_key_t {
unsigned char* raw_key;
size_t key_size;
- ckm_key_type key_type;
+ ckmc_key_type key_type;
char* password; // byte array used to decrypt data raw_key inside key manager
-} ckm_key;
+} ckmc_key;
/**
* @brief certificate structure used in key manager CAPI
* @a cert_size is the byte size of raw_cert
* @a data_format is the raw_cert's encoding format
*/
-typedef struct ckm_cert_t {
+typedef struct ckmc_cert_t {
unsigned char* raw_cert;
size_t cert_size;
- ckm_data_format data_format;
-} ckm_cert;
+ ckmc_data_format data_format;
+} ckmc_cert;
/**
* @brief linked list structure of alias
* @details @a alias is a name of key, certificate or data stored in key manager.
- * @a next is a pointer pointing to the next ckm_alias_list
+ * @a next is a pointer pointing to the next ckmc_alias_list
*/
-typedef struct ckm_alias_list_t {
+typedef struct ckmc_alias_list_t {
char *alias;
- struct ckm_alias_list_t *next;
-} ckm_alias_list;
+ struct ckmc_alias_list_t *next;
+} ckmc_alias_list;
/**
- * @brief linked list structure of ckm_cert
- * @details @a cert is a pointer of ckm_cert.
- * @a next is a pointer pointing to the next ckm_cert_list
+ * @brief linked list structure of ckmc_cert
+ * @details @a cert is a pointer of ckmc_cert.
+ * @a next is a pointer pointing to the next ckmc_cert_list
*/
-typedef struct ckm_cert_list_t {
- ckm_cert *cert;
- struct ckm_cert_list_t *next;
-} ckm_cert_list;
+typedef struct ckmc_cert_list_t {
+ ckmc_cert *cert;
+ struct ckmc_cert_list_t *next;
+} ckmc_cert_list;
/**
- * @brief Creates a new ckm_key handle and returns it.
+ * @brief Creates a new ckmc_key handle and returns it.
*
- * @remarks A newly created ckm_key should be destroyed by calling ckm_key_free() if it is no longer needed.
+ * @remarks A newly created ckmc_key should be destroyed by calling ckmc_key_free() if it is no longer needed.
*
* @param[in] raw_key is byte array of key. raw_key may be encrypted with password
* @param[in] key_size is the byte size of raw_key
* @param[in] key_type is the raw_key's type
* @param[in] password is byte array used to decrypt raw_key inside key manager. If raw_key is not encrypted, password can be null.
- * @return a newly created ckm_key handle
- * @retval If successful, a newly created ckm_key handle will be returned
- * @retval If out of memory, returns a null value.
- * @see ckm_key_free()
- * @see #ckm_key
+ * @return a newly created ckmc_key handle
+ * @exception If successful, a newly created ckmc_key handle will be returned
+ * @exception If out of memory, returns a null value.
+ * @see ckmc_key_free()
+ * @see #ckmc_key
+ *
+ * @since 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/keymanager *
*/
-ckm_key *ckm_key_new(unsigned char *raw_key, size_t key_size, ckm_key_type key_type, char *password);
+ckmc_key *ckmc_key_new(unsigned char *raw_key, size_t key_size, ckmc_key_type key_type, char *password);
/**
- * @brief Destroys the ckm_key handle and releases all its resources.
- * @param[in] key a ckm_key handle to destroy
- * @see ckm_key_new()
+ * @brief Destroys the ckmc_key handle and releases all its resources.
+ * @param[in] key a ckmc_key handle to destroy
+ * @see ckmc_key_new()
+ *
+ * @since 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/keymanager *
*/
-void ckm_key_free(ckm_key *key);
+void ckmc_key_free(ckmc_key *key);
/**
- * @brief Creates a new ckm_raw_buffer handle and returns it.
+ * @brief Creates a new ckmc_raw_buffer handle and returns it.
*
- * @remarks A newly created ckm_raw_buffer should be destroyed by calling ckm_buffer_free() if it is no longer needed.
+ * @remarks A newly created ckmc_raw_buffer should be destroyed by calling ckmc_buffer_free() if it is no longer needed.
*
* @param[in] data is byte array of buffer.
* @param[in] size is the byte size of buffer
- * @return a newly created ckm_raw_buffer handle
- * @retval If successful, a newly created ckm_raw_buffer handle will be returned
- * @retval If out of memory, returns a null value.
- * @see ckm_buffer_free()
- * @see #ckm_raw_buffer
+ * @return a newly created ckmc_raw_buffer handle
+ * @exception If successful, a newly created ckmc_raw_buffer handle will be returned
+ * @exception If out of memory, returns a null value.
+ * @see ckmc_buffer_free()
+ * @see #ckmc_raw_buffer
*/
-ckm_raw_buffer * ckm_buffer_new(unsigned char *data, size_t size);
+ckmc_raw_buffer * ckmc_buffer_new(unsigned char *data, size_t size);
/**
- * @brief Destroys the ckm_raw_buffer handle and releases all its resources.
- * @param[in] buffer a ckm_raw_buffer handle to destroy
- * @see ckm_buffer_new()
+ * @brief Destroys the ckmc_raw_buffer handle and releases all its resources.
+ * @param[in] buffer a ckmc_raw_buffer handle to destroy
+ * @see ckmc_buffer_new()
+ *
+ * @since 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/keymanager *
*/
-void ckm_buffer_free(ckm_raw_buffer *buffer);
+void ckmc_buffer_free(ckmc_raw_buffer *buffer);
/**
- * @brief Creates a new ckm_cert handle and returns it.
+ * @brief Creates a new ckmc_cert handle and returns it.
*
- * @remarks A newly created ckm_cert should be destroyed by calling ckm_cert_free() if it is no longer needed.
+ * @remarks A newly created ckmc_cert should be destroyed by calling ckmc_cert_free() if it is no longer needed.
*
* @param[in] raw_cert is byte array of certificate.
* @param[in] cert_size is the byte size of raw_cert.
* @param[in] data_format is the encoding format of raw_cert
- * @return a newly created ckm_cert handle
- * @retval If successful, a newly created ckm_cert handle will be returned
- * @retval If out of memory, returns a null value.
- * @see ckm_cert_free()
- * @see ckm_load_cert_from_file()
- * @see ckm_load_from_pkcs12_file
- * @see #ckm_cert
+ * @return a newly created ckmc_cert handle
+ * @exception If successful, a newly created ckmc_cert handle will be returned
+ * @exception If out of memory, returns a null value.
+ * @see ckmc_cert_free()
+ * @see ckmc_load_cert_from_file()
+ * @see ckmc_load_from_pkcs12_file
+ * @see #ckmc_cert
+ *
+ * @since 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/keymanager *
*/
-ckm_cert *ckm_cert_new(unsigned char *raw_cert, size_t cert_size, ckm_data_format data_format);
+ckmc_cert *ckmc_cert_new(unsigned char *raw_cert, size_t cert_size, ckmc_data_format data_format);
/**
- * @brief Destroys the ckm_cert handle and releases all its resources.
- * @param[in] buffer a ckm_cert handle to destroy
- * @see ckm_cert_new()
- * @see ckm_load_cert_from_file()
- * @see ckm_load_from_pkcs12_file
+ * @brief Destroys the ckmc_cert handle and releases all its resources.
+ * @param[in] buffer a ckmc_cert handle to destroy
+ * @see ckmc_cert_new()
+ * @see ckmc_load_cert_from_file()
+ * @see ckmc_load_from_pkcs12_file
+ *
+ * @since 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/keymanager *
*/
-void ckm_cert_free(ckm_cert *cert);
+void ckmc_cert_free(ckmc_cert *cert);
/**
- * @brief Create a new ckm_cert handle from a given file and returns it.
+ * @brief Create a new ckmc_cert handle from a given file and returns it.
*
- * @remarks A newly created ckm_cert should be destroyed by calling ckm_cert_free() if it is no longer needed.
+ * @remarks A newly created ckmc_cert should be destroyed by calling ckmc_cert_free() if it is no longer needed.
*
* @param[in] file_path is a path of certificate file to be loaded. The only DER or PEM encoded certificate file is supported.
- * @param[out] cert is the pointer of newly created ckm_cert handle
- * @return #CKM_API_SUCCESS on success, otherwise a negative error value
- * @retval #CKM_API_SUCCESS Successful
- * @retval #CKM_API_ERROR_OUT_OF_MEMORY not enough memory space
- * @retval #CKM_API_ERROR_INVALID_FORMAT invalid certificate file format
- * @retval #CKM_API_ERROR_FILE_ACCESS_DENIED provided file doesn't exists or cannot be accessed
- * @see ckm_cert_free()
- * @see ckm_cert_new()
- * @see ckm_load_from_pkcs12_file()
- * @see #ckm_cert
+ * @param[out] cert is the pointer of newly created ckmc_cert handle
+ * @return #CKMC_API_SUCCESS on success, otherwise a negative error value
+ * @exception #CKMC_API_SUCCESS Successful
+ * @exception #CKMC_API_ERROR_OUT_OF_MEMORY not enough memory space
+ * @exception #CKMC_API_ERROR_INVALID_FORMAT invalid certificate file format
+ * @exception #CKMC_API_ERROR_FILE_ACCESS_DENIED provided file doesn't exists or cannot be accessed
+ * @see ckmc_cert_free()
+ * @see ckmc_cert_new()
+ * @see ckmc_load_from_pkcs12_file()
+ * @see #ckmc_cert
+ *
+ * @since 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/keymanager *
*/
-int ckm_load_cert_from_file(const char *file_path, ckm_cert **cert);
+int ckmc_load_cert_from_file(const char *file_path, ckmc_cert **cert);
/**
- * @brief Create a new ckm_key(private key), ckm_cert(certificate), and ckm_cert_list(CA certificates) handle from a given PKCS#12 file and returns them.
+ * @brief Create a new ckmc_key(private key), ckmc_cert(certificate), and ckmc_cert_list(CA certificates) handle from a given PKCS#12 file and returns them.
*
- * @remarks A newly created ckm_key, ckm_cert, and ckm_cert_list should be destroyed by calling ckm_key_free(), ckm_cert_free(), and ckm_cert_list_all_free() if they are no longer needed.
+ * @remarks A newly created ckmc_key, ckmc_cert, and ckmc_cert_list should be destroyed by calling ckmc_key_free(), ckmc_cert_free(), and ckmc_cert_list_all_free() if they are no longer needed.
*
* @param[in] file_path is a path of PKCS12 file to be loaded.
* @param[in] passphrase is used to decrypt the PCKS12 file. If PKCS12 file is not encrypted, passphrase can be null.
- * @param[out] private_key is the pointer of newly created ckm_key handle for a private key
- * @param[out] cert is the pointer of newly created ckm_cert handle for a certificate. It is null if the PKCS12 file doesn't contain a certificate.
- * @param[out] ca_cert_list is the pointer of newly created ckm_cert_list handle for CA certificates. It is null if the PKCS12 file doesn't contain CA certificates.
- * @return #CKM_API_SUCCESS on success, otherwise a negative error value
- * @retval #CKM_API_SUCCESS Successful
- * @retval #CKM_API_ERROR_OUT_OF_MEMORY not enough memory space
- * @retval #CKM_API_ERROR_INVALID_FORMAT invalid PKCS12 file format
- * @retval #CKM_API_ERROR_FILE_ACCESS_DENIED provided file doesn't exists or cannot be accessed
- * @see ckm_key_free()
- * @see ckm_cert_free()
- * @see ckm_cert_list_all_free()
- * @see #ckm_key
- * @see #ckm_cert
- * @see #ckm_cert_list
+ * @param[out] private_key is the pointer of newly created ckmc_key handle for a private key
+ * @param[out] cert is the pointer of newly created ckmc_cert handle for a certificate. It is null if the PKCS12 file doesn't contain a certificate.
+ * @param[out] ca_cert_list is the pointer of newly created ckmc_cert_list handle for CA certificates. It is null if the PKCS12 file doesn't contain CA certificates.
+ * @return #CKMC_API_SUCCESS on success, otherwise a negative error value
+ * @exception #CKMC_API_SUCCESS Successful
+ * @exception #CKMC_API_ERROR_OUT_OF_MEMORY not enough memory space
+ * @exception #CKMC_API_ERROR_INVALID_FORMAT invalid PKCS12 file format
+ * @exception #CKMC_API_ERROR_FILE_ACCESS_DENIED provided file doesn't exists or cannot be accessed
+ * @see ckmc_key_free()
+ * @see ckmc_cert_free()
+ * @see ckmc_cert_list_all_free()
+ * @see #ckmc_key
+ * @see #ckmc_cert
+ * @see #ckmc_cert_list
+ *
+ * @since 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/keymanager *
*/
-int ckm_load_from_pkcs12_file(const char *file_path, const char *passphrase, ckm_key **private_key, ckm_cert **cert, ckm_cert_list **ca_cert_list);
+int ckmc_load_from_pkcs12_file(const char *file_path, const char *passphrase, ckmc_key **private_key, ckmc_cert **cert, ckmc_cert_list **ca_cert_list);
/**
- * @brief Creates a new ckm_alias_list handle and returns it. The alias pointer in the returned ckm_alias_list handle points to the provided characters and the next is null.
- *
- * @remarks A newly created ckm_alias_list should be destroyed by calling ckm_alias_list_free() or ckm_alias_list_all_free() if it is no longer needed.
- *
- * @param[in] alias is the first item to be set in the newly created ckm_alias_list.
- * @return a newly created ckm_alias_list handle
- * @retval If successful, a newly created ckm_alias_list handle will be returned
- * @retval If out of memory, returns a null value.
- * @see ckm_alias_list_add()
- * @see ckm_alias_list_free()
- * @see ckm_alias_list_all_free()
- * @see #ckm_alias_list
+ * @brief Creates a new ckmc_alias_list handle and returns it. The alias pointer in the returned ckmc_alias_list handle points to the provided characters and the next is null.
+ *
+ * @remarks A newly created ckmc_alias_list should be destroyed by calling ckmc_alias_list_free() or ckmc_alias_list_all_free() if it is no longer needed.
+ *
+ * @param[in] alias is the first item to be set in the newly created ckmc_alias_list.
+ * @return a newly created ckmc_alias_list handle
+ * @exception If successful, a newly created ckmc_alias_list handle will be returned
+ * @exception If out of memory, returns a null value.
+ * @see ckmc_alias_list_add()
+ * @see ckmc_alias_list_free()
+ * @see ckmc_alias_list_all_free()
+ * @see #ckmc_alias_list
+ *
+ * @since 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/keymanager *
*/
-ckm_alias_list *ckm_alias_list_new(char *alias);
+ckmc_alias_list *ckmc_alias_list_new(char *alias);
/**
- * @brief Creates a new ckm_alias_list handle, add it to a previous ckm_alias_list and returns it. The alias pointer in the returned ckm_alias_list handle points to the provided characters and the next is null.
- *
- * @param[in] previous the last ckm_alias_list handle to which a newly created ckm_alias_list is added
- * @param[in] alias is an item to be set in the newly created ckm_alias_list.
- * @return a newly added ckm_alias_list handle. It should be given as previous when ckm_cert_list_add() is called again.
- * @retval If successful, a newly created ckm_alias_list handle will be returned
- * @retval If out of memory, returns a null value.
- * @see ckm_alias_list_add()
- * @see ckm_alias_list_free()
- * @see ckm_alias_list_all_free()
- * @see #ckm_alias_list
+ * @brief Creates a new ckmc_alias_list handle, add it to a previous ckmc_alias_list and returns it. The alias pointer in the returned ckmc_alias_list handle points to the provided characters and the next is null.
+ *
+ * @param[in] previous the last ckmc_alias_list handle to which a newly created ckmc_alias_list is added
+ * @param[in] alias is an item to be set in the newly created ckmc_alias_list.
+ * @return a newly added ckmc_alias_list handle. It should be given as previous when ckmc_cert_list_add() is called again.
+ * @exception If successful, a newly created ckmc_alias_list handle will be returned
+ * @exception If out of memory, returns a null value.
+ * @see ckmc_alias_list_add()
+ * @see ckmc_alias_list_free()
+ * @see ckmc_alias_list_all_free()
+ * @see #ckmc_alias_list
+ *
+ * @since 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/keymanager *
*/
-ckm_alias_list *ckm_alias_list_add(ckm_alias_list *previous, char *alias);
+ckmc_alias_list *ckmc_alias_list_add(ckmc_alias_list *previous, char *alias);
/**
- * @brief Destroys the ckm_alias_list handle and releases resources of ckm_alias_list from the provided first handle cascadingly.
+ * @brief Destroys the ckmc_alias_list handle and releases resources of ckmc_alias_list from the provided first handle cascadingly.
+ *
+ * @remarks It does not destroy an alias itself in ckmc_alias_list.
*
- * @remarks It does not destroy an alias itself in ckm_alias_list.
+ * @param[in] buffer the first ckmc_alias_list handle to destroy
+ * @see ckmc_alias_list_new()
+ * @see ckmc_alias_list_add()
+ * @see ckmc_alias_list_all_free()
+ * @see #ckmc_alias_list
*
- * @param[in] buffer the first ckm_alias_list handle to destroy
- * @see ckm_alias_list_new()
- * @see ckm_alias_list_add()
- * @see ckm_alias_list_all_free()
- * @see #ckm_alias_list
+ * @since 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/keymanager *
*/
-void ckm_alias_list_free(ckm_alias_list *first);
+void ckmc_alias_list_free(ckmc_alias_list *first);
/**
- * @brief Destroys the ckm_alias_list handle and releases all its resources from the provided first handle cascadingly.
+ * @brief Destroys the ckmc_alias_list handle and releases all its resources from the provided first handle cascadingly.
+ *
+ * @remarks It also destroy an alias in ckmc_alias_list.
*
- * @remarks It also destroy an alias in ckm_alias_list.
+ * @param[in] buffer the first ckmc_alias_list handle to destroy
+ * @see ckmc_alias_list_new()
+ * @see ckmc_alias_list_add()
+ * @see ckmc_alias_list_free()
+ * @see #ckmc_alias_list
*
- * @param[in] buffer the first ckm_alias_list handle to destroy
- * @see ckm_alias_list_new()
- * @see ckm_alias_list_add()
- * @see ckm_alias_list_free()
- * @see #ckm_alias_list
+ * @since 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/keymanager *
*/
-void ckm_alias_list_all_free(ckm_alias_list *cert_list);
+void ckmc_alias_list_all_free(ckmc_alias_list *cert_list);
/**
- * @brief Creates a new ckm_cert_list handle and returns it. The cert pointer in the returned ckm_cert_list handle points to the provided ckm_cert and the next is null.
- *
- * @remarks A newly created ckm_cert_list should be destroyed by calling ckm_cert_list_free() or ckm_cert_list_all_free() if it is no longer needed.
- *
- * @param[in] cert is the first item to be set in the newly created ckm_cert_list.
- * @return a newly created ckm_cert_list handle
- * @retval If successful, a newly created ckm_cert_list handle will be returned
- * @retval If out of memory, returns a null value.
- * @see ckm_cert_list_add()
- * @see ckm_cert_list_free()
- * @see ckm_cert_list_all_free()
- * @see #ckm_cert_list
+ * @brief Creates a new ckmc_cert_list handle and returns it. The cert pointer in the returned ckmc_cert_list handle points to the provided ckmc_cert and the next is null.
+ *
+ * @remarks A newly created ckmc_cert_list should be destroyed by calling ckmc_cert_list_free() or ckmc_cert_list_all_free() if it is no longer needed.
+ *
+ * @param[in] cert is the first item to be set in the newly created ckmc_cert_list.
+ * @return a newly created ckmc_cert_list handle
+ * @exception If successful, a newly created ckmc_cert_list handle will be returned
+ * @exception If out of memory, returns a null value.
+ * @see ckmc_cert_list_add()
+ * @see ckmc_cert_list_free()
+ * @see ckmc_cert_list_all_free()
+ * @see #ckmc_cert_list
+ *
+ * @since 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/keymanager *
*/
-ckm_cert_list *ckm_cert_list_new(ckm_cert *cert);
+ckmc_cert_list *ckmc_cert_list_new(ckmc_cert *cert);
/**
- * @brief Creates a new ckm_cert_list handle, add it to a previous ckm_cert_list and returns it. The cert pointer in the returned ckm_alias_list handle points to the provided ckm_cert and the next is null.
- *
- * @param[in] previous the last ckm_cert_list handle to which a newly created ckm_cert_list is added
- * @param[in] cert is an item to be set in the newly created ckm_cert_list.
- * @return a newly added ckm_cert_list handle. It should be given as previous when ckm_cert_list_add() is called again.
- * @retval If successful, a newly created ckm_cert_list handle will be returned
- * @retval If out of memory, returns a null value.
- * @see ckm_cert_list_add()
- * @see ckm_cert_list_free()
- * @see ckm_cert_list_all_free()
- * @see #ckm_cert_list
+ * @brief Creates a new ckmc_cert_list handle, add it to a previous ckmc_cert_list and returns it. The cert pointer in the returned ckmc_alias_list handle points to the provided ckmc_cert and the next is null.
+ *
+ * @param[in] previous the last ckmc_cert_list handle to which a newly created ckmc_cert_list is added
+ * @param[in] cert is an item to be set in the newly created ckmc_cert_list.
+ * @return a newly added ckmc_cert_list handle. It should be given as previous when ckmc_cert_list_add() is called again.
+ * @exception If successful, a newly created ckmc_cert_list handle will be returned
+ * @exception If out of memory, returns a null value.
+ * @see ckmc_cert_list_add()
+ * @see ckmc_cert_list_free()
+ * @see ckmc_cert_list_all_free()
+ * @see #ckmc_cert_list
+ *
+ * @since 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/keymanager *
*/
-ckm_cert_list *ckm_cert_list_add(ckm_cert_list *previous, ckm_cert *cert);
+ckmc_cert_list *ckmc_cert_list_add(ckmc_cert_list *previous, ckmc_cert *cert);
/**
- * @brief Destroys the ckm_cert_list handle and releases resources of ckm_cert_list from the provided first handle cascadingly.
+ * @brief Destroys the ckmc_cert_list handle and releases resources of ckmc_cert_list from the provided first handle cascadingly.
*
- * @remarks It does not destroy an ckm_cert itself in ckm_cert_list.
+ * @remarks It does not destroy an ckmc_cert itself in ckmc_cert_list.
*
- * @param[in] buffer the first ckm_cert_list handle to destroy
- * @see ckm_cert_list_new()
- * @see ckm_cert_list_add()
- * @see ckm_cert_list_all_free()
- * @see #ckm_cert_list
+ * @param[in] buffer the first ckmc_cert_list handle to destroy
+ * @see ckmc_cert_list_new()
+ * @see ckmc_cert_list_add()
+ * @see ckmc_cert_list_all_free()
+ * @see #ckmc_cert_list
+ *
+ * @since 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/keymanager *
*/
-void ckm_cert_list_free(ckm_cert_list *first);
+void ckmc_cert_list_free(ckmc_cert_list *first);
/**
- * @brief Destroys the ckm_cert_list handle and releases all its resources from the provided first handle cascadingly.
+ * @brief Destroys the ckmc_cert_list handle and releases all its resources from the provided first handle cascadingly.
+ *
+ * @remarks It also destroy an ckmc_cert in ckmc_cert_list.
*
- * @remarks It also destroy an ckm_cert in ckm_cert_list.
+ * @param[in] buffer the first ckmc_cert_list handle to destroy
+ * @see ckmc_cert_list_new()
+ * @see ckmc_cert_list_add()
+ * @see ckmc_cert_list_free()
+ * @see #ckmc_cert_list
*
- * @param[in] buffer the first ckm_cert_list handle to destroy
- * @see ckm_cert_list_new()
- * @see ckm_cert_list_add()
- * @see ckm_cert_list_free()
- * @see #ckm_cert_list
+ * @since 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/keymanager *
*/
-void ckm_cert_list_all_free(ckm_cert_list *cert_list);
+void ckmc_cert_list_all_free(ckmc_cert_list *cert_list);
/**
#include <ckmc/ckmc-error.h>
KEY_MANAGER_CAPI
-int ckm_unlock_user_key(uid_t user, const char *password)
+int ckmc_unlock_user_key(uid_t user, const char *password)
{
CKM::Control control;
return control.unlockUserKey(user, std::string(password));
}
KEY_MANAGER_CAPI
-int ckm_lock_user_key(uid_t user)
+int ckmc_lock_user_key(uid_t user)
{
CKM::Control control;
return control.lockUserKey(user);
}
KEY_MANAGER_CAPI
-int ckm_remove_user_data(uid_t user)
+int ckmc_remove_user_data(uid_t user)
{
CKM::Control control;
return control.removeUserData(user);
}
KEY_MANAGER_CAPI
-int ckm_change_user_password(uid_t user, const char *oldPassword, const char *newPassword)
+int ckmc_change_user_password(uid_t user, const char *oldPassword, const char *newPassword)
{
CKM::Control control;
return control.changeUserPassword(user, std::string(oldPassword), std::string(newPassword));
}
KEY_MANAGER_CAPI
-int ckm_reset_user_password(uid_t user, const char *newPassword)
+int ckmc_reset_user_password(uid_t user, const char *newPassword)
{
CKM::Control control;
return control.resetUserPassword(user, std::string(newPassword));
#include <ckmc/ckmc-error.h>
#include <ckm/ckm-type.h>
-const char * ckm_error_to_string(int error) {
+const char * ckmc_error_to_string(int error) {
return CKM::ErrorToString(error);
}
CKM::RawBuffer buffer(key.raw_key, key.raw_key + key.key_size);
CKM::Key ckmKey(buffer, _tostring(key.password));
+ if(ckmKey.getDER().size() <= 0) {
+ return CKM_API_ERROR_INVALID_FORMAT;
+ }
+
CKM::Policy storePolicy(_tostring(policy.password), _toBool(policy.extractable), _toBool(policy.restricted));
return mgr.saveKey(ckmAlias, ckmKey, storePolicy);
int ret;
CKM::Key ckmKey;
- if(alias == NULL) {
+ if(alias == NULL || key == NULL) {
return CKM_API_ERROR_INPUT_PARAM;
}
CKM::Alias ckmAlias(alias);
int ret;
CKM::Key ckmKey;
+ if(alias_list == NULL) {
+ return CKM_API_ERROR_INPUT_PARAM;
+ }
+
CKM::AliasVector aliasVector;
CKM::Manager mgr;
if( (ret = mgr.getKeyAliasVector(aliasVector)) != CKM_API_SUCCESS) {
return CKM_API_ERROR_INPUT_PARAM;
}
CKM::Certificate ckmCert = _toCkmCertificate(&cert);
+ if(ckmCert.getDER().size() <= 0) {
+ return CKM_API_ERROR_INVALID_FORMAT;
+ }
CKM::Policy storePolicy(_tostring(policy.password), _toBool(policy.extractable), _toBool(policy.restricted));
CKM::Certificate ckmCert;
int ret;
- if(alias == NULL) {
+ if(alias == NULL || cert == NULL) {
return CKM_API_ERROR_INPUT_PARAM;
}
CKM::Alias ckmAlias(alias);
int ret;
CKM::Key ckmKey;
+ if(alias_list == NULL) {
+ return CKM_API_ERROR_INPUT_PARAM;
+ }
+
CKM::AliasVector aliasVector;
CKM::Manager mgr;
if( (ret = mgr.getCertificateAliasVector(aliasVector)) != CKM_API_SUCCESS) {
CKM::RawBuffer ckmBuff;
int ret;
- if(alias == NULL) {
+ if(alias == NULL || data == NULL) {
return CKM_API_ERROR_INPUT_PARAM;
}
CKM::Alias ckmAlias(alias);
int ret;
CKM::Key ckmKey;
+ if(alias_list == NULL) {
+ return CKM_API_ERROR_INPUT_PARAM;
+ }
+
CKM::AliasVector aliasVector;
CKM::Manager mgr;
if( (ret = mgr.getDataAliasVector(aliasVector)) != CKM_API_SUCCESS) {
int ret;
CKM::Manager mgr;
+ if(private_key_alias == NULL || public_key_alias == NULL) {
+ return CKM_API_ERROR_INPUT_PARAM;
+ }
+
CKM::Alias ckmPrivakeKeyAlias(private_key_alias);
CKM::Alias ckmPublicKeyAlias(public_key_alias);
CKM::Policy ckmPrivateKeyPolicy(_tostring(policy_private_key.password), _toBool(policy_private_key.extractable), _toBool(policy_private_key.restricted));
int ret;
CKM::Manager mgr;
+ if(private_key_alias == NULL || public_key_alias == NULL) {
+ return CKM_API_ERROR_INPUT_PARAM;
+ }
+
CKM::ElipticCurve ckmType = static_cast<CKM::ElipticCurve>(static_cast<int>(type));
CKM::Alias ckmPrivakeKeyAlias(private_key_alias);
CKM::Alias ckmPublicKeyAlias(public_key_alias);
CKM::Policy ckmPrivateKeyPolicy(_tostring(policy_private_key.password), _toBool(policy_private_key.extractable), _toBool(policy_private_key.restricted));
CKM::Policy ckmPublicKeyPolicy(_tostring(policy_public_key.password), _toBool(policy_public_key.extractable), _toBool(policy_public_key.restricted));
- if( (ret = mgr.createKeyPairECDSA(ckmType, ckmPrivakeKeyAlias, ckmPublicKeyAlias, ckmPrivateKeyPolicy, ckmPublicKeyPolicy))
+ if( (ret - mgr.createKeyPairECDSA(ckmType, ckmPrivakeKeyAlias, ckmPublicKeyAlias, ckmPrivateKeyPolicy, ckmPublicKeyPolicy))
!= CKM_API_SUCCESS) {
return ret;
}
CKM::Manager mgr;
CKM::RawBuffer ckmSignature;
+ if(private_key_alias == NULL || signature == NULL) {
+ return CKM_API_ERROR_INPUT_PARAM;
+ }
+
CKM::Alias ckmPrivakeKeyAlias(private_key_alias);
CKM::RawBuffer ckmMessage(message.data, message.data + message.size);
CKM::HashAlgorithm ckmHashAlgo = static_cast<CKM::HashAlgorithm>(static_cast<int>(hash));
int ret;
CKM::Manager mgr;
+ if(public_key_alias == NULL) {
+ return CKM_API_ERROR_INPUT_PARAM;
+ }
+
CKM::Alias ckmPublicKeyAlias(public_key_alias);
CKM::RawBuffer ckmMessage(message.data, message.data + message.size);
CKM::RawBuffer ckmSignature(signature.data, signature.data + signature.size);
CKM::Manager mgr;
CKM::CertificateVector ckmCertChain;
- if(cert->raw_cert == NULL || cert->cert_size <= 0) {
+ if(cert == NULL || cert->raw_cert == NULL || cert->cert_size <= 0 || cert_chain_list == NULL) {
return CKM_API_ERROR_INPUT_PARAM;
}
CKM::CertificateVector ckmCertChain;
- if(cert->raw_cert == NULL || cert->cert_size <= 0) {
+ if(cert == NULL || cert->raw_cert == NULL || cert->cert_size <= 0 || cert_chain_list == NULL) {
return CKM_API_ERROR_INPUT_PARAM;
}
CKM::RawBuffer buffer(cert->raw_cert, cert->raw_cert + cert->cert_size);
#include <openssl/evp.h>
#include <openssl/pem.h>
-int _ckm_load_cert_from_x509(X509 *xCert, ckm_cert **cert);
+int _ckmc_load_cert_from_x509(X509 *xCert, ckmc_cert **cert);
KEY_MANAGER_CAPI
-ckm_key *ckm_key_new(unsigned char *raw_key, size_t key_size, ckm_key_type key_type, char *password)
+ckmc_key *ckmc_key_new(unsigned char *raw_key, size_t key_size, ckmc_key_type key_type, char *password)
{
- ckm_key *pkey = new ckm_key;
+ ckmc_key *pkey = new ckmc_key;
if(pkey == NULL)
return NULL;
}
KEY_MANAGER_CAPI
-void ckm_key_free(ckm_key *key)
+void ckmc_key_free(ckmc_key *key)
{
if(key == NULL)
return;
}
KEY_MANAGER_CAPI
-ckm_raw_buffer * ckm_buffer_new(unsigned char *data, size_t size)
+ckmc_raw_buffer * ckmc_buffer_new(unsigned char *data, size_t size)
{
- ckm_raw_buffer *pbuff = new ckm_raw_buffer;
+ ckmc_raw_buffer *pbuff = new ckmc_raw_buffer;
if(pbuff == NULL)
return NULL;
}
KEY_MANAGER_CAPI
-void ckm_buffer_free(ckm_raw_buffer *buffer)
+void ckmc_buffer_free(ckmc_raw_buffer *buffer)
{
if(buffer == NULL)
return;
}
KEY_MANAGER_CAPI
-ckm_cert *ckm_cert_new(unsigned char *raw_cert, size_t cert_size, ckm_data_format data_format)
+ckmc_cert *ckmc_cert_new(unsigned char *raw_cert, size_t cert_size, ckmc_data_format data_format)
{
- ckm_cert *pcert = new ckm_cert;
+ ckmc_cert *pcert = new ckmc_cert;
if(pcert == NULL)
return NULL;
}
KEY_MANAGER_CAPI
-int ckm_load_cert_from_file(const char *file_path, ckm_cert **cert)
+int ckmc_load_cert_from_file(const char *file_path, ckmc_cert **cert)
{
OpenSSL_add_all_algorithms();
FILE *fp = fopen(file_path, "r");
if(fp == NULL)
- return CKM_API_ERROR_FILE_ACCESS_DENIED;
+ return CKMC_API_ERROR_FILE_ACCESS_DENIED;
X509 *pcert = NULL;
if(!(pcert = d2i_X509_fp(fp, NULL))) {
fseek(fp, 0, SEEK_SET);
}
fclose(fp);
if(pcert == NULL) {
- return CKM_API_ERROR_INVALID_FORMAT;
+ return CKMC_API_ERROR_INVALID_FORMAT;
}
- int ret = _ckm_load_cert_from_x509(pcert, cert);
- if(ret != CKM_API_SUCCESS) {
+ int ret = _ckmc_load_cert_from_x509(pcert, cert);
+ if(ret != CKMC_API_SUCCESS) {
X509_free(pcert);
}
return ret;
}
KEY_MANAGER_CAPI
-int ckm_load_from_pkcs12_file(const char *file_path, const char *passphrase, ckm_key **private_key, ckm_cert **ckmcert, ckm_cert_list **ca_cert_list)
+int ckmc_load_from_pkcs12_file(const char *file_path, const char *passphrase, ckmc_key **private_key, ckmc_cert **ckmcert, ckmc_cert_list **ca_cert_list)
{
class Pkcs12Converter {
private:
int ret;
public:
- ckm_key *retPrivateKey;
- ckm_cert *retCkmCert;
- ckm_cert_list *retCaCertList;
+ ckmc_key *retPrivateKey;
+ ckmc_cert *retCkmCert;
+ ckmc_cert_list *retCaCertList;
Pkcs12Converter(){
fp_in = NULL;
pkey = NULL;
x509Cert = NULL;
ca = NULL;
- ret = CKM_API_SUCCESS;
+ ret = CKMC_API_SUCCESS;
retPrivateKey = NULL;
retCkmCert = NULL;
retCaCertList = NULL;
sk_X509_pop_free(ca, X509_free);
EVP_cleanup();
- if(ret != CKM_API_SUCCESS) {
+ if(ret != CKMC_API_SUCCESS) {
if(retPrivateKey != NULL)
- ckm_key_free(retPrivateKey);
+ ckmc_key_free(retPrivateKey);
if(retCkmCert != NULL)
- ckm_cert_free(retCkmCert);
+ ckmc_cert_free(retCkmCert);
if(retCaCertList != NULL)
- ckm_cert_list_all_free(retCaCertList);
+ ckmc_cert_list_all_free(retCaCertList);
}
};
int parsePkcs12(const char *filePath, const char *pass) {
fp_in = NULL;
if(!(fp_in = fopen(filePath, "rb"))) {
- return CKM_API_ERROR_FILE_ACCESS_DENIED;
+ return CKMC_API_ERROR_FILE_ACCESS_DENIED;
}
if(!(p12 = d2i_PKCS12_fp(fp_in, NULL))) {
- return CKM_API_ERROR_INVALID_FORMAT;
+ return CKMC_API_ERROR_INVALID_FORMAT;
}
/* parse PKCS#12 certificate */
if((ret = PKCS12_parse(p12, pass, &pkey, &x509Cert, &ca)) != 1) {
- return CKM_API_ERROR_INVALID_FORMAT;
+ return CKMC_API_ERROR_INVALID_FORMAT;
}
- return CKM_API_SUCCESS;
+ return CKMC_API_SUCCESS;
}
int toCkmCert() {
- if( (ret =_ckm_load_cert_from_x509(x509Cert,&retCkmCert)) != CKM_API_SUCCESS) {
+ if( (ret =_ckmc_load_cert_from_x509(x509Cert,&retCkmCert)) != CKMC_API_SUCCESS) {
return ret;
}
- return CKM_API_SUCCESS;
+ return CKMC_API_SUCCESS;
}
int toCkmKey() {
int size = BIO_read(bkey, output.data(), output.size());
BIO_free_all(bkey);
if (size <= 0) {
- return CKM_API_ERROR_INVALID_FORMAT;
+ return CKMC_API_ERROR_INVALID_FORMAT;
}
output.resize(size);
int type = EVP_PKEY_type(pkey->type);
- ckm_key_type key_type = CKM_KEY_NONE;
+ ckmc_key_type key_type = CKMC_KEY_NONE;
switch(type) {
case EVP_PKEY_RSA :
- key_type = CKM_KEY_RSA_PRIVATE;
+ key_type = CKMC_KEY_RSA_PRIVATE;
break;
case EVP_PKEY_EC :
- key_type = CKM_KEY_ECDSA_PRIVATE;
+ key_type = CKMC_KEY_ECDSA_PRIVATE;
break;
}
- if(key_type == CKM_KEY_NONE) {
- return CKM_API_ERROR_INVALID_FORMAT;
+ if(key_type == CKMC_KEY_NONE) {
+ return CKMC_API_ERROR_INVALID_FORMAT;
}
char *nullPassword = NULL;
- retPrivateKey = ckm_key_new(output.data(), size, key_type, nullPassword);
+ retPrivateKey = ckmc_key_new(output.data(), size, key_type, nullPassword);
- return CKM_API_SUCCESS;
+ return CKMC_API_SUCCESS;
}
int toCaCkmCertList() {
X509* popedCert = NULL;
- ckm_cert *popedCkmCert = NULL;
- ckm_cert_list *tmpCertList = NULL;
+ ckmc_cert *popedCkmCert = NULL;
+ ckmc_cert_list *tmpCertList = NULL;
while((popedCert = sk_X509_pop(ca)) != NULL) {
- if( (ret =_ckm_load_cert_from_x509(popedCert, &popedCkmCert)) != CKM_API_SUCCESS) {
- return CKM_API_ERROR_OUT_OF_MEMORY;
+ if( (ret =_ckmc_load_cert_from_x509(popedCert, &popedCkmCert)) != CKMC_API_SUCCESS) {
+ return CKMC_API_ERROR_OUT_OF_MEMORY;
}
if(tmpCertList == NULL) { // first
- tmpCertList = ckm_cert_list_new(popedCkmCert);
+ tmpCertList = ckmc_cert_list_new(popedCkmCert);
retCaCertList = tmpCertList;
}else {
- tmpCertList = ckm_cert_list_add(tmpCertList, popedCkmCert);
+ tmpCertList = ckmc_cert_list_add(tmpCertList, popedCkmCert);
}
}
- return CKM_API_SUCCESS;
+ return CKMC_API_SUCCESS;
}
};
- int ret = CKM_API_SUCCESS;
+ int ret = CKMC_API_SUCCESS;
Pkcs12Converter converter;
- if((ret = converter.parsePkcs12(file_path, passphrase)) != CKM_API_SUCCESS) {
+ if((ret = converter.parsePkcs12(file_path, passphrase)) != CKMC_API_SUCCESS) {
return ret;
}
- if((ret = converter.toCkmCert()) != CKM_API_SUCCESS) {
+ if((ret = converter.toCkmCert()) != CKMC_API_SUCCESS) {
return ret;
}
- if((ret = converter.toCkmKey()) != CKM_API_SUCCESS) {
+ if((ret = converter.toCkmKey()) != CKMC_API_SUCCESS) {
return ret;
}
- if((ret = converter.toCaCkmCertList()) != CKM_API_SUCCESS) {
+ if((ret = converter.toCaCkmCertList()) != CKMC_API_SUCCESS) {
return ret;
}
*ckmcert = converter.retCkmCert;
*ca_cert_list = converter.retCaCertList;
- return CKM_API_SUCCESS;
+ return CKMC_API_SUCCESS;
}
KEY_MANAGER_CAPI
-void ckm_cert_free(ckm_cert *cert)
+void ckmc_cert_free(ckmc_cert *cert)
{
if(cert == NULL)
return;
}
KEY_MANAGER_CAPI
-ckm_alias_list *ckm_alias_list_new(char *alias)
+ckmc_alias_list *ckmc_alias_list_new(char *alias)
{
- ckm_alias_list *previous = NULL;
- return ckm_alias_list_add(previous, alias);
+ ckmc_alias_list *previous = NULL;
+ return ckmc_alias_list_add(previous, alias);
}
KEY_MANAGER_CAPI
-ckm_alias_list *ckm_alias_list_add(ckm_alias_list *previous, char *alias)
+ckmc_alias_list *ckmc_alias_list_add(ckmc_alias_list *previous, char *alias)
{
- ckm_alias_list *plist = new ckm_alias_list;
+ ckmc_alias_list *plist = new ckmc_alias_list;
plist->alias = alias;
plist->next = NULL;
}
KEY_MANAGER_CAPI
-void ckm_alias_list_free(ckm_alias_list *first)
+void ckmc_alias_list_free(ckmc_alias_list *first)
{
if(first == NULL)
return;
- ckm_alias_list *current = NULL;
- ckm_alias_list *next = first;
+ ckmc_alias_list *current = NULL;
+ ckmc_alias_list *next = first;
do {
current = next;
next = current->next;
}
KEY_MANAGER_CAPI
-void ckm_alias_list_all_free(ckm_alias_list *first)
+void ckmc_alias_list_all_free(ckmc_alias_list *first)
{
if(first == NULL)
return;
- ckm_alias_list *current = NULL;
- ckm_alias_list *next = first;
+ ckmc_alias_list *current = NULL;
+ ckmc_alias_list *next = first;
do {
current = next;
next = current->next;
}
KEY_MANAGER_CAPI
-ckm_cert_list *ckm_cert_list_new(ckm_cert *cert)
+ckmc_cert_list *ckmc_cert_list_new(ckmc_cert *cert)
{
- ckm_cert_list *previous = NULL;
- return ckm_cert_list_add(previous, cert);
+ ckmc_cert_list *previous = NULL;
+ return ckmc_cert_list_add(previous, cert);
}
KEY_MANAGER_CAPI
-ckm_cert_list *ckm_cert_list_add(ckm_cert_list *previous, ckm_cert *cert)
+ckmc_cert_list *ckmc_cert_list_add(ckmc_cert_list *previous, ckmc_cert *cert)
{
- ckm_cert_list *plist = new ckm_cert_list;
+ ckmc_cert_list *plist = new ckmc_cert_list;
plist->cert = cert;
plist->next = NULL;
}
KEY_MANAGER_CAPI
-void ckm_cert_list_free(ckm_cert_list *first)
+void ckmc_cert_list_free(ckmc_cert_list *first)
{
if(first == NULL)
return;
- ckm_cert_list *current = NULL;
- ckm_cert_list *next = first;
+ ckmc_cert_list *current = NULL;
+ ckmc_cert_list *next = first;
do {
current = next;
next = current->next;
}
KEY_MANAGER_CAPI
-void ckm_cert_list_all_free(ckm_cert_list *first)
+void ckmc_cert_list_all_free(ckmc_cert_list *first)
{
if(first == NULL)
return;
- ckm_cert_list *current = NULL;
- ckm_cert_list *next = first;
+ ckmc_cert_list *current = NULL;
+ ckmc_cert_list *next = first;
do {
current = next;
next = current->next;
if((current->cert)!=NULL) {
- ckm_cert_free(current->cert);
+ ckmc_cert_free(current->cert);
}
free(current);
}while(next != NULL);
}
-int _ckm_load_cert_from_x509(X509 *xCert, ckm_cert **cert)
+int _ckmc_load_cert_from_x509(X509 *xCert, ckmc_cert **cert)
{
if(xCert == NULL) {
- return CKM_API_ERROR_INVALID_FORMAT;
+ return CKMC_API_ERROR_INVALID_FORMAT;
}
BIO *bcert = BIO_new(BIO_s_mem());
int size = BIO_read(bcert, output.data(), output.size());
BIO_free_all(bcert);
if (size <= 0) {
- return CKM_API_ERROR_INVALID_FORMAT;
+ return CKMC_API_ERROR_INVALID_FORMAT;
}
output.resize(size);
- *cert = ckm_cert_new(output.data(), output.size(), CKM_FORM_DER);
+ *cert = ckmc_cert_new(output.data(), output.size(), CKMC_FORM_DER);
- return CKM_API_SUCCESS;
+ return CKMC_API_SUCCESS;
}