* @param[in] password used in decrypting a user key.
*
* @return 0 on success, otherwise a negative error value
- * @retval #CKMC_SUCCESS Successful
+ * @retval #CKMC_ERROR_NONE Successful
* @retval #CKMC_ERROR_SERVER_ERROR failed to unlock user key
- * @retval #CKMC_ERROR_INPUT_PARAM invalid input parameter
+ * @retval #CKMC_ERROR_INVALID_PARAMETER invalid input parameter
* @retval #CKMC_ERROR_AUTHENTICATION_FAILED not correct password
- * @retval #CKMC_ERROR_FILE_ACCESS_DENIED provided file doesn't exists or cannot be accessed
+ * @retval #CKMC_ERROR_PERMISSION_DENIED failed to access key manager
*
* @see ckmc_lock_user_key()
* @see ckmc_remove_user_data()
* @param[in] user a uid of a user whose key is removed from memory.
*
* @return 0 on success, otherwise a negative error value
- * @retval #CKMC_SUCCESS Successful
- * @retval #CKMC_ERROR_INPUT_PARAM invalid input parameter
- * @retval #CKMC_ERROR_FILE_ACCESS_DENIED provided file doesn't exists or cannot be accessed
+ * @retval #CKMC_ERROR_NONE Successful
+ * @retval #CKMC_ERROR_INVALID_PARAMETER invalid input parameter
+ * @retval #CKMC_ERROR_PERMISSION_DENIED failed to access key manager
*
* @see ckmc_unlock_user_key()
* @see ckmc_remove_user_data()
* @param[in] user a uid of a user whose data and key are removed
*
* @return 0 on success, otherwise a negative error value
- * @retval #CKMC_SUCCESS Successful
- * @retval #CKMC_ERROR_INPUT_PARAM invalid input parameter
- * @retval #CKMC_ERROR_FILE_ACCESS_DENIED provided file doesn't exists or cannot be accessed
+ * @retval #CKMC_ERROR_NONE Successful
+ * @retval #CKMC_ERROR_INVALID_PARAMETER invalid input parameter
+ * @retval #CKMC_ERROR_PERMISSION_DENIED failed to access key manager
*
* @see ckmc_unlock_user_key()
* @see ckmc_lock_user_key()
* @param[in] new_password used in re-encrypting a user key.
*
* @return 0 on success, otherwise a negative error value
- * @retval #CKMC_SUCCESS Successful
- * @retval #CKMC_ERROR_INPUT_PARAM invalid input parameter
+ * @retval #CKMC_ERROR_NONE Successful
+ * @retval #CKMC_ERROR_INVALID_PARAMETER invalid input parameter
* @retval #CKMC_ERROR_AUTHENTICATION_FAILED not correct password
* @retval #CKMC_ERROR_BAD_REQUEST no information about old password
- * @retval #CKMC_ERROR_FILE_ACCESS_DENIED provided file doesn't exists or cannot be accessed
+ * @retval #CKMC_ERROR_PERMISSION_DENIED failed to access key manager
*
* @see ckmc_unlock_user_key()
* @see ckmc_lock_user_key()
* @param[in] new_password is used in re-encrypting a user key.
*
* @return 0 on success, otherwise a negative error value
- * @retval #CKMC_SUCCESS Successful
- * @retval #CKMC_ERROR_INPUT_PARAM invalid input parameter
+ * @retval #CKMC_ERROR_NONE Successful
+ * @retval #CKMC_ERROR_INVALID_PARAMETER invalid input parameter
* @retval #CKMC_ERROR_BAD_REQUEST a user key is not unlocked.
- * @retval #CKMC_ERROR_FILE_ACCESS_DENIED provided file doesn't exists or cannot be accessed
+ * @retval #CKMC_ERROR_PERMISSION_DENIED failed to access key manager
*
* @pre User must be already logged in and his user key is already loaded into memory in plain text form.
*
* @since_tizen 2.3
*/
typedef enum{
- CKMC_SUCCESS = TIZEN_ERROR_NONE, /**< Successful */
- CKMC_ERROR_INPUT_PARAM = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid function parameter */
+ CKMC_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
+ CKMC_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid function parameter */
CKMC_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
- CKMC_ERROR_ACCESS_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
- CKMC_ERROR_BAD_REQUEST = TIZEN_ERROR_INVALID_OPERATION, /**< Invalid request from client */
+ CKMC_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
CKMC_ERROR_SOCKET = KEY_MANAGER_ERROR_CLASS | 0x01, /**< Socket error between client and Central Key Manager */
- CKMC_ERROR_BAD_RESPONSE = KEY_MANAGER_ERROR_CLASS | 0x02, /**< Invalid response from Central Key Manager */
- CKMC_ERROR_SEND_FAILED = KEY_MANAGER_ERROR_CLASS | 0x03, /**< Transmitting request failed */
- CKMC_ERROR_RECV_FAILED = KEY_MANAGER_ERROR_CLASS | 0x04, /**< Receiving response failed */
- CKMC_ERROR_AUTHENTICATION_FAILED = KEY_MANAGER_ERROR_CLASS | 0x05, /**< Authentication between client and manager failed */
- CKMC_ERROR_BUFFER_TOO_SMALL = KEY_MANAGER_ERROR_CLASS | 0x06, /**< The output buffer size which is passed as parameter is too small */
- CKMC_ERROR_SERVER_ERROR = KEY_MANAGER_ERROR_CLASS | 0x07, /**< Central Key Manager has been failed for some reason */
- CKMC_ERROR_DB_LOCKED = KEY_MANAGER_ERROR_CLASS | 0x08, /**< The database was not unlocked - user did not login */
- CKMC_ERROR_DB_ERROR = KEY_MANAGER_ERROR_CLASS | 0x09, /**< An internal error inside the database */
- CKMC_ERROR_DB_ALIAS_EXISTS = KEY_MANAGER_ERROR_CLASS | 0x0A, /**< Provided alias already exists in the database */
- CKMC_ERROR_DB_ALIAS_UNKNOWN = KEY_MANAGER_ERROR_CLASS | 0x0B, /**< No data for given alias */
- CKMC_ERROR_VERIFICATION_FAILED = KEY_MANAGER_ERROR_CLASS | 0x0C, /**< CA certificate(s) were unknown and chain could not be created */
- CKMC_ERROR_INVALID_FORMAT = KEY_MANAGER_ERROR_CLASS | 0x11, /**< A provided file or binary has not a valid format */
- CKMC_ERROR_FILE_ACCESS_DENIED = KEY_MANAGER_ERROR_CLASS | 0x12, /**< A provided file or binary has not a valid format */
- CKMC_ERROR_UNKNOWN = KEY_MANAGER_ERROR_CLASS | 0x13, /**< A provided file or binary has not a valid format */
+ CKMC_ERROR_BAD_REQUEST = KEY_MANAGER_ERROR_CLASS | 0x02, /**< Invalid request from client */
+ CKMC_ERROR_BAD_RESPONSE = KEY_MANAGER_ERROR_CLASS | 0x03, /**< Invalid response from Central Key Manager */
+ CKMC_ERROR_SEND_FAILED = KEY_MANAGER_ERROR_CLASS | 0x04, /**< Transmitting request failed */
+ CKMC_ERROR_RECV_FAILED = KEY_MANAGER_ERROR_CLASS | 0x05, /**< Receiving response failed */
+ CKMC_ERROR_AUTHENTICATION_FAILED = KEY_MANAGER_ERROR_CLASS | 0x06, /**< Authentication between client and manager failed */
+ CKMC_ERROR_BUFFER_TOO_SMALL = KEY_MANAGER_ERROR_CLASS | 0x07, /**< The output buffer size which is passed as parameter is too small */
+ CKMC_ERROR_SERVER_ERROR = KEY_MANAGER_ERROR_CLASS | 0x08, /**< Central Key Manager has been failed for some reason */
+ CKMC_ERROR_DB_LOCKED = KEY_MANAGER_ERROR_CLASS | 0x09, /**< The database was not unlocked - user did not login */
+ CKMC_ERROR_DB_ERROR = KEY_MANAGER_ERROR_CLASS | 0x0A, /**< An internal error inside the database */
+ CKMC_ERROR_DB_ALIAS_EXISTS = KEY_MANAGER_ERROR_CLASS | 0x0B, /**< Provided alias already exists in the database */
+ CKMC_ERROR_DB_ALIAS_UNKNOWN = KEY_MANAGER_ERROR_CLASS | 0x0C, /**< No data for given alias */
+ CKMC_ERROR_VERIFICATION_FAILED = KEY_MANAGER_ERROR_CLASS | 0x0D, /**< CA certificate(s) were unknown and chain could not be created */
+ CKMC_ERROR_INVALID_FORMAT = KEY_MANAGER_ERROR_CLASS | 0x0E, /**< A provided file or binary has not a valid format */
+ CKMC_ERROR_FILE_ACCESS_DENIED = KEY_MANAGER_ERROR_CLASS | 0x0F, /**< A provided file or binary has not a valid format */
+ CKMC_ERROR_UNKNOWN = KEY_MANAGER_ERROR_CLASS | 0x10, /**< A provided file or binary has not a valid format */
} key_manager_error_e;
* @param[in] policy about how to store a key securely.
*
* @return 0 on success, otherwise a negative error value
- * @retval #CKMC_SUCCESS Successful
- * @retval #CKMC_ERROR_INPUT_PARAM input parameter is invalid
+ * @retval #CKMC_ERROR_NONE Successful
+ * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
* @retval #CKMC_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
* @retval #CKMC_ERROR_DB_ALIAS_EXISTS alias already exists.
* @retval #CKMC_ERROR_INVALID_FORMAT the format of raw_key is not valid.
* @retval #CKMC_ERROR_DB_ERROR failed due to other DB transaction unexpectedly.
- * @retval #CKMC_ERROR_FILE_ACCESS_DENIED provided file doesn't exists or cannot be accessed
+ * @retval #CKMC_ERROR_PERMISSION_DENIED failed to access key manager
*
* @pre User must be already logged in and his user key is already loaded into memory in plain text form.
*
* @param[in] alias the name of a key to be removed
*
* @return 0 on success, otherwise a negative error value
- * @retval #CKMC_SUCCESS Successful
- * @retval #CKMC_ERROR_INPUT_PARAM input parameter is invalid
+ * @retval #CKMC_ERROR_NONE Successful
+ * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
* @retval #CKMC_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
* @retval #CKMC_ERROR_DB_ERROR failed due to the error with unknown reason
* @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN alias doesn't exists.
- * @retval #CKMC_ERROR_FILE_ACCESS_DENIED provided file doesn't exists or cannot be accessed
+ * @retval #CKMC_ERROR_PERMISSION_DENIED failed to access key manager
*
* @pre User must be already logged in and his user key is already loaded into memory in plain text form.
*
* @param[out] ppkey a pointer to a newly created ckmc_key_s handle
*
* @return 0 on success, otherwise a negative error value
- * @retval #CKMC_SUCCESS Successful
- * @retval #CKMC_ERROR_INPUT_PARAM input parameter is invalid
+ * @retval #CKMC_ERROR_NONE Successful
+ * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
* @retval #CKMC_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
* @retval #CKMC_ERROR_DB_ERROR failed due to the error with unknown reason
* @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN alias doesn't exists.
- * @retval #CKMC_ERROR_FILE_ACCESS_DENIED provided file doesn't exists or cannot be accessed
+ * @retval #CKMC_ERROR_PERMISSION_DENIED failed to access key manager
*
* @pre User must be already logged in and his user key is already loaded into memory in plain text form.
*
* @param[out] ppalias_list a pointer to a newly created ckmc_alias_list_s handle containing all available alias of keys. If there is no available key alias, *ppalias_list will be null.
*
* @return 0 on success, otherwise a negative error value
- * @retval #CKMC_SUCCESS Successful
- * @retval #CKMC_ERROR_INPUT_PARAM input parameter is invalid
+ * @retval #CKMC_ERROR_NONE Successful
+ * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
* @retval #CKMC_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
* @retval #CKMC_ERROR_DB_ERROR failed due to the error with unknown reason
- * @retval #CKMC_ERROR_FILE_ACCESS_DENIED provided file doesn't exists or cannot be accessed
+ * @retval #CKMC_ERROR_PERMISSION_DENIED failed to access key manager
*
* @pre User must be already logged in and his user key is already loaded into memory in plain text form.
*
* @param[in] policy about how to store a certificate securely.
*
* @return 0 on success, otherwise a negative error value
- * @retval #CKMC_SUCCESS Successful
- * @retval #CKMC_ERROR_INPUT_PARAM input parameter is invalid
+ * @retval #CKMC_ERROR_NONE Successful
+ * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
* @retval #CKMC_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
* @retval #CKMC_ERROR_DB_ALIAS_EXISTS alias already exists.
* @retval #CKMC_ERROR_INVALID_FORMAT the format of raw_cert is not valid.
* @retval #CKMC_ERROR_DB_ERROR failed due to other DB transaction unexpectedly.
- * @retval #CKMC_ERROR_FILE_ACCESS_DENIED provided file doesn't exists or cannot be accessed
+ * @retval #CKMC_ERROR_PERMISSION_DENIED failed to access key manager
*
* @pre User must be already logged in and his user key is already loaded into memory in plain text form.
*
* @param[in] alias the name of a certificate to be removed
*
* @return 0 on success, otherwise a negative error value
- * @retval #CKMC_SUCCESS Successful
- * @retval #CKMC_ERROR_INPUT_PARAM input parameter is invalid
+ * @retval #CKMC_ERROR_NONE Successful
+ * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
* @retval #CKMC_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
* @retval #CKMC_ERROR_DB_ERROR failed due to the error with unknown reason
* @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN alias doesn't exists.
- * @retval #CKMC_ERROR_FILE_ACCESS_DENIED provided file doesn't exists or cannot be accessed
+ * @retval #CKMC_ERROR_PERMISSION_DENIED failed to access key manager
*
* @pre User must be already logged in and his user key is already loaded into memory in plain text form.
*
* @param[out] ppcert a pointer to a newly created ckmc_cert_s handle
*
* @return 0 on success, otherwise a negative error value
- * @retval #CKMC_SUCCESS Successful
- * @retval #CKMC_ERROR_INPUT_PARAM input parameter is invalid
+ * @retval #CKMC_ERROR_NONE Successful
+ * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
* @retval #CKMC_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
* @retval #CKMC_ERROR_DB_ERROR failed due to the error with unknown reason
* @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN alias doesn't exists.
- * @retval #CKMC_ERROR_FILE_ACCESS_DENIED provided file doesn't exists or cannot be accessed
+ * @retval #CKMC_ERROR_PERMISSION_DENIED failed to access key manager
*
* @pre User must be already logged in and his user key is already loaded into memory in plain text form.
*
* @param[out] ppalias_list a pointer to a newly created ckmc_alias_list_s handle containing all available alias of keys. If there is no available key alias, *ppalias_list will be null.
*
* @return 0 on success, otherwise a negative error value
- * @retval #CKMC_SUCCESS Successful
- * @retval #CKMC_ERROR_INPUT_PARAM input parameter is invalid
+ * @retval #CKMC_ERROR_NONE Successful
+ * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
* @retval #CKMC_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
* @retval #CKMC_ERROR_DB_ERROR failed due to the error with unknown reason
- * @retval #CKMC_ERROR_FILE_ACCESS_DENIED provided file doesn't exists or cannot be accessed
+ * @retval #CKMC_ERROR_PERMISSION_DENIED failed to access key manager
*
* @pre User must be already logged in and his user key is already loaded into memory in plain text form.
*
* @param[in] policy about how to store a data securely.
*
* @return 0 on success, otherwise a negative error value
- * @retval #CKMC_SUCCESS Successful
- * @retval #CKMC_ERROR_INPUT_PARAM input parameter is invalid
+ * @retval #CKMC_ERROR_NONE Successful
+ * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
* @retval #CKMC_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
* @retval #CKMC_ERROR_DB_ALIAS_EXISTS alias already exists.
* @retval #CKMC_ERROR_DB_ERROR failed due to other DB transaction unexpectedly.
- * @retval #CKMC_ERROR_FILE_ACCESS_DENIED provided file doesn't exists or cannot be accessed
+ * @retval #CKMC_ERROR_PERMISSION_DENIED failed to access key manager
*
* @pre User must be already logged in and his user key is already loaded into memory in plain text form.
*
* @param[in] alias the name of a data to be removed
*
* @return 0 on success, otherwise a negative error value
- * @retval #CKMC_SUCCESS Successful
- * @retval #CKMC_ERROR_INPUT_PARAM input parameter is invalid
+ * @retval #CKMC_ERROR_NONE Successful
+ * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
* @retval #CKMC_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
* @retval #CKMC_ERROR_DB_ERROR failed due to the error with unknown reason
* @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN alias doesn't exists.
- * @retval #CKMC_ERROR_FILE_ACCESS_DENIED provided file doesn't exists or cannot be accessed
+ * @retval #CKMC_ERROR_PERMISSION_DENIED failed to access key manager
*
* @pre User must be already logged in and his user key is already loaded into memory in plain text form.
*
* @param[out] ppdata a pointer to a newly created ckmc_raw_buffer_s handle
*
* @return 0 on success, otherwise a negative error value
- * @retval #CKMC_SUCCESS Successful
- * @retval #CKMC_ERROR_INPUT_PARAM input parameter is invalid
+ * @retval #CKMC_ERROR_NONE Successful
+ * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
* @retval #CKMC_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
* @retval #CKMC_ERROR_DB_ERROR failed due to the error with unknown reason
* @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN alias doesn't exists.
- * @retval #CKMC_ERROR_FILE_ACCESS_DENIED provided file doesn't exists or cannot be accessed
+ * @retval #CKMC_ERROR_PERMISSION_DENIED failed to access key manager
*
* @pre User must be already logged in and his user key is already loaded into memory in plain text form.
*
* @param[out] ppalias_list a pointer to a newly created ckmc_alias_list_s handle containing all available alias of keys. If there is no available key alias, *ppalias_list will be null.
*
* @return 0 on success, otherwise a negative error value
- * @retval #CKMC_SUCCESS Successful
- * @retval #CKMC_ERROR_INPUT_PARAM input parameter is invalid
+ * @retval #CKMC_ERROR_NONE Successful
+ * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
* @retval #CKMC_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
* @retval #CKMC_ERROR_DB_ERROR failed due to the error with unknown reason
- * @retval #CKMC_ERROR_FILE_ACCESS_DENIED provided file doesn't exists or cannot be accessed
+ * @retval #CKMC_ERROR_PERMISSION_DENIED failed to access key manager
*
* @pre User must be already logged in and his user key is already loaded into memory in plain text form.
*
* @param[in] policy_public_key about how to store a public key securely.
*
* @return 0 on success, otherwise a negative error value
- * @retval #CKMC_SUCCESS Successful
- * @retval #CKMC_ERROR_INPUT_PARAM input parameter is invalid
+ * @retval #CKMC_ERROR_NONE Successful
+ * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
* @retval #CKMC_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
* @retval #CKMC_ERROR_DB_ALIAS_EXISTS alias already exists.
* @retval #CKMC_ERROR_DB_ERROR failed due to other DB transaction unexpectedly.
- * @retval #CKMC_ERROR_FILE_ACCESS_DENIED provided file doesn't exists or cannot be accessed
+ * @retval #CKMC_ERROR_PERMISSION_DENIED failed to access key manager
*
* @pre User must be already logged in and his user key is already loaded into memory in plain text form.
*
* @param[in] policy_public_key about how to store a public key securely.
*
* @return 0 on success, otherwise a negative error value
- * @retval #CKMC_SUCCESS Successful
- * @retval #CKMC_ERROR_INPUT_PARAM input parameter is invalid
+ * @retval #CKMC_ERROR_NONE Successful
+ * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
* @retval #CKMC_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
* @retval #CKMC_ERROR_DB_ALIAS_EXISTS alias already exists.
* @retval #CKMC_ERROR_DB_ERROR failed due to other DB transaction unexpectedly.
- * @retval #CKMC_ERROR_FILE_ACCESS_DENIED provided file doesn't exists or cannot be accessed
+ * @retval #CKMC_ERROR_PERMISSION_DENIED failed to access key manager
*
* @pre User must be already logged in and his user key is already loaded into memory in plain text form.
*
* @param[out] ppsignature 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 #CKMC_SUCCESS Successful
- * @retval #CKMC_ERROR_INPUT_PARAM input parameter is invalid
+ * @retval #CKMC_ERROR_NONE Successful
+ * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
* @retval #CKMC_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
* @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN alias doesn't exists.
- * @retval #CKMC_ERROR_FILE_ACCESS_DENIED provided file doesn't exists or cannot be accessed
+ * @retval #CKMC_ERROR_PERMISSION_DENIED failed to access key manager
*
* @pre User must be already logged in and his user key is already loaded into memory in plain text form.
*
* @param[in] padding 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 #CKMC_SUCCESS Successful
+ * @retval #CKMC_ERROR_NONE Successful
* @retval #CKMC_ERROR_VERIFICATION_FAILED the signature is invalid
- * @retval #CKMC_ERROR_INPUT_PARAM input parameter is invalid
+ * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
* @retval #CKMC_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
* @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN alias doesn't exists.
- * @retval #CKMC_ERROR_FILE_ACCESS_DENIED provided file doesn't exists or cannot be accessed
+ * @retval #CKMC_ERROR_PERMISSION_DENIED failed to access key manager
*
* @pre User must be already logged in and his user key is already loaded into memory in plain text form.
*
* @param[out] ppcert_chain_list a pointer to a newly created certificate chain's handle. If an error occurs, *ppcert_chain_list will be null.
*
* @return 0 on success and the signature is valid, otherwise a negative error value
- * @retval #CKMC_SUCCESS Successful
+ * @retval #CKMC_ERROR_NONE Successful
* @retval #CKMC_ERROR_VERIFICATION_FAILED the certificate chain is not valid
- * @retval #CKMC_ERROR_INPUT_PARAM input parameter is invalid
+ * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
* @retval #CKMC_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
* @retval #CKMC_ERROR_INVALID_FORMAT the format of certificate is not valid.
- * @retval #CKMC_ERROR_FILE_ACCESS_DENIED provided file doesn't exists or cannot be accessed
+ * @retval #CKMC_ERROR_PERMISSION_DENIED failed to access key manager
*
* @pre User must be already logged in and his user key is already loaded into memory in plain text form.
*
* @param[out] ppcert_chain_list a pointer to a newly created certificate chain's handle. If an error occurs, *ppcert_chain_list will be null.
*
* @return 0 on success and the signature is valid, otherwise a negative error value
- * @retval #CKMC_SUCCESS Successful
+ * @retval #CKMC_ERROR_NONE Successful
* @retval #CKMC_ERROR_VERIFICATION_FAILED the certificate chain is not valid
- * @retval #CKMC_ERROR_INPUT_PARAM input parameter is invalid
+ * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
* @retval #CKMC_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
* @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN alias doesn't exists.
* @retval #CKMC_ERROR_INVALID_FORMAT the format of certificate is not valid.
- * @retval #CKMC_ERROR_FILE_ACCESS_DENIED provided file doesn't exists or cannot be accessed
+ * @retval #CKMC_ERROR_PERMISSION_DENIED failed to access key manager
*
* @pre User must be already logged in and his user key is already loaded into memory in plain text form.
*
* @param[in] password byte array used to decrypt raw_key inside key manager. If raw_key is not encrypted, password can be null.
* @param[out] ppkey a pointer to a newly created ckmc_key_s handle
* @return 0 on success, otherwise a negative error value
- * @retval #CKMC_ERROR_INPUT_PARAM input parameter is invalid
+ * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
* @retval #CKMC_ERROR_OUT_OF_MEMORY not enough memory
* @see ckmc_key_free()
* @see #ckmc_key_s
* @param[in] size the byte size of buffer
* @param[out] ppbuffer a pointer to a newly created ckmc_buffer_s handle
* @return 0 on success, otherwise a negative error value
- * @retval #CKMC_ERROR_INPUT_PARAM input parameter is invalid
+ * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
* @retval #CKMC_ERROR_OUT_OF_MEMORY not enough memory
* @see ckmc_buffer_free()
* @see #ckmc_raw_buffer_s
* @param[in] data_format the encoding format of raw_cert
* @param[out] ppcert a pointer to a newly created ckmc_cert_s handle
* @return 0 on success, otherwise a negative error value
- * @retval #CKMC_ERROR_INPUT_PARAM input parameter is invalid
+ * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
* @retval #CKMC_ERROR_OUT_OF_MEMORY not enough memory
* @see ckmc_cert_free()
* @see ckmc_load_cert_from_file()
*
* @param[in] file_path a path of certificate file to be loaded. The only DER or PEM encoded certificate file is supported.
* @param[out] cert the pointer of newly created ckmc_cert_s handle
- * @return #CKMC_SUCCESS on success, otherwise a negative error value
- * @retval #CKMC_SUCCESS Successful
+ * @return #CKMC_ERROR_NONE on success, otherwise a negative error value
+ * @retval #CKMC_ERROR_NONE Successful
* @retval #CKMC_ERROR_OUT_OF_MEMORY not enough memory space
* @retval #CKMC_ERROR_INVALID_FORMAT invalid certificate file format
* @retval #CKMC_ERROR_FILE_ACCESS_DENIED provided file doesn't exists or cannot be accessed
* @param[out] private_key the pointer of newly created ckmc_key_s handle for a private key
* @param[out] cert the pointer of newly created ckmc_cert_s handle for a certificate. It is null if the PKCS12 file doesn't contain a certificate.
* @param[out] ca_cert_list the pointer of newly created ckmc_cert_list_s handle for CA certificates. It is null if the PKCS12 file doesn't contain CA certificates.
- * @return #CKMC_SUCCESS on success, otherwise a negaprevious == NULL || tive error value
- * @retval #CKMC_SUCCESS Successful
+ * @return #CKMC_ERROR_NONE on success, otherwise a negative error value
+ * @retval #CKMC_ERROR_NONE Successful
* @retval #CKMC_ERROR_OUT_OF_MEMORY not enough memory space
* @retval #CKMC_ERROR_INVALID_FORMAT invalid PKCS12 file format
* @retval #CKMC_ERROR_FILE_ACCESS_DENIED provided file doesn't exists or cannot be accessed
* @param[in] alias the first item to be set in the newly created ckmc_alias_list_s.
* @param[out] ppalias_list a pointer to a newly created ckmc_alias_list_s handle
* @return 0 on success, otherwise a negative error value
- * @retval #CKMC_ERROR_INPUT_PARAM input parameter is invalid
+ * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
* @retval #CKMC_ERROR_OUT_OF_MEMORY not enough memory
* @see ckmc_alias_list_add()
* @see ckmc_alias_list_free()
* @param[in] alias an item to be set in the newly created ckmc_alias_list_s.
* @param[out] pplast a pointer to a newly created and added ckmc_alias_list_s handle
* @return 0 on success, otherwise a negative error value
- * @retval #CKMC_ERROR_INPUT_PARAM input parameter is invalid
+ * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
* @retval #CKMC_ERROR_OUT_OF_MEMORY not enough memory
* @see ckmc_alias_list_add()
* @see ckmc_alias_list_free()
* @param[in] cert the first item to be set in the newly created ckmc_cert_list_s.
* @param[out] ppalias_list a pointer to a newly created ckmc_alias_list_s handle
* @return 0 on success, otherwise a negative error value
- * @retval #CKMC_ERROR_INPUT_PARAM input parameter is invalid
+ * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
* @retval #CKMC_ERROR_OUT_OF_MEMORY not enough memory
* @see ckmc_cert_list_add()
* @see ckmc_cert_list_free()
* @param[in] cert an item to be set in the newly created ckmc_cert_list_s.
* @param[out] pplast a pointer to a newly created and added ckmc_alias_list_s handle
* @return 0 on success, otherwise a negative error value
- * @retval #CKMC_ERROR_INPUT_PARAM input parameter is invalid
+ * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
* @retval #CKMC_ERROR_OUT_OF_MEMORY not enough memory
* @see ckmc_cert_list_add()
* @see ckmc_cert_list_free()
}else {
ret = ckmc_cert_list_add(plist, pcert, &plist);
}
- if(ret != CKMC_SUCCESS) {
+ if(ret != CKMC_ERROR_NONE) {
ckmc_cert_list_all_free(start);
return NULL;
}
CKM::ManagerShPtr mgr = CKM::Manager::create();
if(alias == NULL) {
- return CKMC_ERROR_INPUT_PARAM;
+ return CKMC_ERROR_INVALID_PARAMETER;
}
CKM::Alias ckmAlias(alias);
if(key.raw_key == NULL || key.key_size <= 0) {
- return CKMC_ERROR_INPUT_PARAM;
+ return CKMC_ERROR_INVALID_PARAMETER;
}
CKM::RawBuffer buffer(key.raw_key, key.raw_key + key.key_size);
CKM::KeyShPtr ckmKey = CKM::Key::create(buffer, _tostring(key.password));
CKM::ManagerShPtr mgr = CKM::Manager::create();
if(alias == NULL) {
- return CKMC_ERROR_INPUT_PARAM;
+ return CKMC_ERROR_INVALID_PARAMETER;
}
CKM::Alias ckmAlias(alias);
CKM::KeyShPtr ckmKey;
if(alias == NULL || key == NULL) {
- return CKMC_ERROR_INPUT_PARAM;
+ return CKMC_ERROR_INVALID_PARAMETER;
}
CKM::Alias ckmAlias(alias);
int ret;
if(alias_list == NULL) {
- return CKMC_ERROR_INPUT_PARAM;
+ return CKMC_ERROR_INVALID_PARAMETER;
}
CKM::AliasVector aliasVector;
}else {
ret = ckmc_alias_list_add(plist, alias, &plist);
}
- if(ret != CKMC_SUCCESS) {
+ if(ret != CKMC_ERROR_NONE) {
ckmc_alias_list_all_free(*alias_list);
return ret;
}
}
- return CKMC_SUCCESS;
+ return CKMC_ERROR_NONE;
}
KEY_MANAGER_CAPI
int ckmc_save_cert(const char *alias, const ckmc_cert_s cert, const ckmc_policy_s policy)
{
if(alias == NULL) {
- return CKMC_ERROR_INPUT_PARAM;
+ return CKMC_ERROR_INVALID_PARAMETER;
}
CKM::Alias ckmAlias(alias);
if(cert.raw_cert == NULL || cert.cert_size <= 0) {
- return CKMC_ERROR_INPUT_PARAM;
+ return CKMC_ERROR_INVALID_PARAMETER;
}
CKM::CertificateShPtr ckmCert = _toCkmCertificate(&cert);
if(ckmCert.get() == NULL) {
int ckmc_remove_cert(const char *alias)
{
if(alias == NULL) {
- return CKMC_ERROR_INPUT_PARAM;
+ return CKMC_ERROR_INVALID_PARAMETER;
}
CKM::Alias ckmAlias(alias);
int ret;
if(alias == NULL || cert == NULL) {
- return CKMC_ERROR_INPUT_PARAM;
+ return CKMC_ERROR_INVALID_PARAMETER;
}
CKM::Alias ckmAlias(alias);
int ret;
if(alias_list == NULL) {
- return CKMC_ERROR_INPUT_PARAM;
+ return CKMC_ERROR_INVALID_PARAMETER;
}
CKM::AliasVector aliasVector;
ret = ckmc_alias_list_add(plist, alias, &plist);
}
- if(ret != CKMC_SUCCESS) {
+ if(ret != CKMC_ERROR_NONE) {
ckmc_alias_list_all_free(*alias_list);
return ret;
}
}
- return CKMC_SUCCESS;
+ return CKMC_ERROR_NONE;
}
KEY_MANAGER_CAPI
int ckmc_save_data(const char *alias, ckmc_raw_buffer_s data, const ckmc_policy_s policy)
{
if(alias == NULL) {
- return CKMC_ERROR_INPUT_PARAM;
+ return CKMC_ERROR_INVALID_PARAMETER;
}
CKM::Alias ckmAlias(alias);
if(data.data == NULL || data.size <= 0) {
- return CKMC_ERROR_INPUT_PARAM;
+ return CKMC_ERROR_INVALID_PARAMETER;
}
CKM::RawBuffer buffer(data.data, data.data + data.size);
int ckmc_remove_data(const char *alias)
{
if(alias == NULL) {
- return CKMC_ERROR_INPUT_PARAM;
+ return CKMC_ERROR_INVALID_PARAMETER;
}
CKM::Alias ckmAlias(alias);
int ret;
if(alias == NULL || data == NULL) {
- return CKMC_ERROR_INPUT_PARAM;
+ return CKMC_ERROR_INVALID_PARAMETER;
}
CKM::Alias ckmAlias(alias);
int ret;
if(alias_list == NULL) {
- return CKMC_ERROR_INPUT_PARAM;
+ return CKMC_ERROR_INVALID_PARAMETER;
}
CKM::AliasVector aliasVector;
}else {
ret = ckmc_alias_list_add(plist, alias, &plist);
}
- if(ret != CKMC_SUCCESS) {
+ if(ret != CKMC_ERROR_NONE) {
ckmc_alias_list_all_free(*alias_list);
return ret;
}
}
- return CKMC_SUCCESS;
+ return CKMC_ERROR_NONE;
}
KEY_MANAGER_CAPI
CKM::ManagerShPtr mgr = CKM::Manager::create();
if(private_key_alias == NULL || public_key_alias == NULL) {
- return CKMC_ERROR_INPUT_PARAM;
+ return CKMC_ERROR_INVALID_PARAMETER;
}
CKM::Alias ckmPrivakeKeyAlias(private_key_alias);
CKM::ManagerShPtr mgr = CKM::Manager::create();
if(private_key_alias == NULL || public_key_alias == NULL) {
- return CKMC_ERROR_INPUT_PARAM;
+ return CKMC_ERROR_INVALID_PARAMETER;
}
CKM::ElipticCurve ckmType = static_cast<CKM::ElipticCurve>(static_cast<int>(type));
CKM::RawBuffer ckmSignature;
if(private_key_alias == NULL || signature == NULL) {
- return CKMC_ERROR_INPUT_PARAM;
+ return CKMC_ERROR_INVALID_PARAMETER;
}
CKM::Alias ckmPrivakeKeyAlias(private_key_alias);
CKM::ManagerShPtr mgr = CKM::Manager::create();
if(public_key_alias == NULL) {
- return CKMC_ERROR_INPUT_PARAM;
+ return CKMC_ERROR_INVALID_PARAMETER;
}
CKM::Alias ckmPublicKeyAlias(public_key_alias);
return to_ckmc_error(ret);
}
- return CKMC_SUCCESS;
+ return CKMC_ERROR_NONE;
}
KEY_MANAGER_CAPI
CKM::CertificateShPtrVector ckmCertChain;
if(cert == NULL || cert->raw_cert == NULL || cert->cert_size <= 0 || cert_chain_list == NULL) {
- return CKMC_ERROR_INPUT_PARAM;
+ return CKMC_ERROR_INVALID_PARAMETER;
}
CKM::CertificateShPtr ckmCert = _toCkmCertificate(cert);
*cert_chain_list = _toNewCkmCertList(ckmCertChain);
- return CKMC_SUCCESS;
+ return CKMC_ERROR_NONE;
}
KEY_MANAGER_CAPI
if(cert == NULL || cert->raw_cert == NULL || cert->cert_size <= 0 || cert_chain_list == NULL) {
- return CKMC_ERROR_INPUT_PARAM;
+ return CKMC_ERROR_INVALID_PARAMETER;
}
CKM::CertificateShPtr ckmCert = _toCkmCertificate(cert);
next = current->next;
if(current->alias == NULL){
- return CKMC_ERROR_INPUT_PARAM;
+ return CKMC_ERROR_INVALID_PARAMETER;
}
CKM::Alias ckmAlias(current->alias);
ckmUntrustedAliases.push_back(ckmAlias);
*cert_chain_list = _toNewCkmCertList(ckmCertChain);
- return CKMC_SUCCESS;
+ return CKMC_ERROR_NONE;
}
ckmc_key_s *pkey;
if(raw_key == NULL || key_size <= 0 || ppkey == NULL) {
- return CKMC_ERROR_INPUT_PARAM;
+ return CKMC_ERROR_INVALID_PARAMETER;
}
pkey = new ckmc_key_s;
*ppkey = pkey;
- return CKMC_SUCCESS;
+ return CKMC_ERROR_NONE;
}
KEY_MANAGER_CAPI
ckmc_raw_buffer_s *pbuff;
if(data == NULL || size <= 0 || ppbuffer == NULL) {
- return CKMC_ERROR_INPUT_PARAM;
+ return CKMC_ERROR_INVALID_PARAMETER;
}
pbuff = new ckmc_raw_buffer_s;
pbuff->size = size;
*ppbuffer = pbuff;
- return CKMC_SUCCESS;
+ return CKMC_ERROR_NONE;
}
KEY_MANAGER_CAPI
ckmc_cert_s *pcert;
if(raw_cert == NULL || cert_size <= 0 || ppcert == NULL) {
- return CKMC_ERROR_INPUT_PARAM;
+ return CKMC_ERROR_INVALID_PARAMETER;
}
pcert = new ckmc_cert_s;
pcert->data_format = data_format;
*ppcert = pcert;
- return CKMC_SUCCESS;
+ return CKMC_ERROR_NONE;
}
KEY_MANAGER_CAPI
}
int ret = _ckmc_load_cert_from_x509(pcert, cert);
- if(ret != CKMC_SUCCESS) {
+ if(ret != CKMC_ERROR_NONE) {
X509_free(pcert);
}
return ret;
pkey = NULL;
x509Cert = NULL;
ca = NULL;
- ret = CKMC_SUCCESS;
+ ret = CKMC_ERROR_NONE;
retPrivateKey = NULL;
retCkmCert = NULL;
retCaCertList = NULL;
sk_X509_pop_free(ca, X509_free);
EVP_cleanup();
- if(ret != CKMC_SUCCESS) {
+ if(ret != CKMC_ERROR_NONE) {
if(retPrivateKey != NULL){
ckmc_key_free(retPrivateKey);
retPrivateKey = NULL;
if((ret = PKCS12_parse(p12, pass, &pkey, &x509Cert, &ca)) != 1) {
return CKMC_ERROR_INVALID_FORMAT;
}
- return CKMC_SUCCESS;
+ return CKMC_ERROR_NONE;
}
int toCkmCert() {
- if( (ret =_ckmc_load_cert_from_x509(x509Cert,&retCkmCert)) != CKMC_SUCCESS) {
+ if( (ret =_ckmc_load_cert_from_x509(x509Cert,&retCkmCert)) != CKMC_ERROR_NONE) {
return ret;
}
- return CKMC_SUCCESS;
+ return CKMC_ERROR_NONE;
}
int toCkmKey() {
ckmc_cert_s *popedCkmCert = NULL;
ckmc_cert_list_s *tmpCertList = NULL;
while((popedCert = sk_X509_pop(ca)) != NULL) {
- if( (tmpRet =_ckmc_load_cert_from_x509(popedCert, &popedCkmCert)) != CKMC_SUCCESS) {
+ if( (tmpRet =_ckmc_load_cert_from_x509(popedCert, &popedCkmCert)) != CKMC_ERROR_NONE) {
return CKMC_ERROR_OUT_OF_MEMORY;
}
if(tmpCertList == NULL) { // first
}else {
tmpRet = ckmc_cert_list_add(tmpCertList, popedCkmCert, &tmpCertList);
}
- if(tmpRet != CKMC_SUCCESS) {
+ if(tmpRet != CKMC_ERROR_NONE) {
ckmc_cert_list_all_free(retCaCertList);
retCaCertList = NULL;
return tmpRet;
}
}
- return CKMC_SUCCESS;
+ return CKMC_ERROR_NONE;
}
};
- int ret = CKMC_SUCCESS;
+ int ret = CKMC_ERROR_NONE;
Pkcs12Converter converter;
- if((ret = converter.parsePkcs12(file_path, passphrase)) != CKMC_SUCCESS) {
+ if((ret = converter.parsePkcs12(file_path, passphrase)) != CKMC_ERROR_NONE) {
return ret;
}
- if((ret = converter.toCkmCert()) != CKMC_SUCCESS) {
+ if((ret = converter.toCkmCert()) != CKMC_ERROR_NONE) {
return ret;
}
- if((ret = converter.toCkmKey()) != CKMC_SUCCESS) {
+ if((ret = converter.toCkmKey()) != CKMC_ERROR_NONE) {
return ret;
}
- if((ret = converter.toCaCkmCertList()) != CKMC_SUCCESS) {
+ if((ret = converter.toCaCkmCertList()) != CKMC_ERROR_NONE) {
return ret;
}
*ckmcert = converter.retCkmCert;
*ca_cert_list = converter.retCaCertList;
- return CKMC_SUCCESS;
+ return CKMC_ERROR_NONE;
}
KEY_MANAGER_CAPI
ckmc_alias_list_s *plist;
if(alias == NULL || pplast == NULL) {
- return CKMC_ERROR_INPUT_PARAM;
+ return CKMC_ERROR_INVALID_PARAMETER;
}
plist = new ckmc_alias_list_s;
}
*pplast = plist;
- return CKMC_SUCCESS;
+ return CKMC_ERROR_NONE;
}
KEY_MANAGER_CAPI
ckmc_cert_list_s *plist;
if(cert == NULL || pplast == NULL) {
- return CKMC_ERROR_INPUT_PARAM;
+ return CKMC_ERROR_INVALID_PARAMETER;
}
plist = new ckmc_cert_list_s;
*pplast = plist;
- return CKMC_SUCCESS;
+ return CKMC_ERROR_NONE;
}
KEY_MANAGER_CAPI
int to_ckmc_error(int ckm_error) {
switch(ckm_error) {
- case CKM_API_SUCCESS: return CKMC_SUCCESS;
+ case CKM_API_SUCCESS: return CKMC_ERROR_NONE;
case CKM_API_ERROR_SOCKET: return CKMC_ERROR_SOCKET;
case CKM_API_ERROR_BAD_REQUEST: return CKMC_ERROR_BAD_REQUEST;
case CKM_API_ERROR_BAD_RESPONSE: return CKMC_ERROR_BAD_RESPONSE;
case CKM_API_ERROR_SEND_FAILED: return CKMC_ERROR_SEND_FAILED;
case CKM_API_ERROR_RECV_FAILED: return CKMC_ERROR_RECV_FAILED;
case CKM_API_ERROR_AUTHENTICATION_FAILED: return CKMC_ERROR_AUTHENTICATION_FAILED;
- case CKM_API_ERROR_INPUT_PARAM: return CKMC_ERROR_INPUT_PARAM;
+ case CKM_API_ERROR_INPUT_PARAM: return CKMC_ERROR_INVALID_PARAMETER;
case CKM_API_ERROR_BUFFER_TOO_SMALL: return CKMC_ERROR_BUFFER_TOO_SMALL;
case CKM_API_ERROR_OUT_OF_MEMORY: return CKMC_ERROR_OUT_OF_MEMORY;
- case CKM_API_ERROR_ACCESS_DENIED: return CKMC_ERROR_ACCESS_DENIED;
+ case CKM_API_ERROR_ACCESS_DENIED: return CKMC_ERROR_PERMISSION_DENIED;
case CKM_API_ERROR_SERVER_ERROR: return CKMC_ERROR_SERVER_ERROR;
case CKM_API_ERROR_DB_LOCKED: return CKMC_ERROR_DB_LOCKED;
case CKM_API_ERROR_DB_ERROR: return CKMC_ERROR_DB_ERROR;