CKMC API: Add option to list aliases with information about password protection
[platform/core/security/key-manager.git] / src / include / ckmc / ckmc-manager.h
index 86ee07f..22a295c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000 - 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2000 - 2019 Samsung Electronics Co., Ltd All Rights Reserved
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -151,6 +151,31 @@ int ckmc_get_key(const char *alias, const char *password, ckmc_key_s **ppkey);
 int ckmc_get_key_alias_list(ckmc_alias_list_s **ppalias_list);
 
 
+/**
+ * @brief Gets the information about all the aliases of keys that the client can access.
+ * @since_tizen 5.5
+ * @remarks A client can access only data stored by the client and the entries from system database
+ * if it was explicitly permitted to.
+ * @remarks You must destroy the newly created @a ppalias_list by calling ckmc_alias_info_list_all_free()
+ *          if it is no longer needed.
+ * @param[out] ppalias_list The pointer to a newly created ckmc_alias_info_list_s handle containing
+ *                          information about all key aliases \n
+ *                          If there is no available key alias, *ppalias_list will be null
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @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 a database error
+ * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN Alias does not exist
+ * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
+ * @pre User is already logged in and the user key is already loaded into memory in plain text form.
+ * @see ckmc_save_key()
+ * @see ckmc_remove_alias()
+ * @see ckmc_get_key()
+ */
+int ckmc_get_key_alias_info_list(ckmc_alias_info_list_s **ppalias_list);
+
 
 /**
  * @brief Stores a certificate inside key manager based on the provided policy.
@@ -258,6 +283,32 @@ int ckmc_get_cert_alias_list(ckmc_alias_list_s **ppalias_list);
 
 
 /**
+ * @brief Gets the information about all the aliases of certificates that the client can access.
+ * @since_tizen 5.5
+ * @remarks A client can access only data stored by the client and the entries from system database
+ * if it was explicitly permitted to.
+ * @remarks You must destroy the newly created @a ppalias_list by calling ckmc_alias_info_list_all_free()
+ *          if it is no longer needed.
+ * @param[out] ppalias_list The pointer to a newly created ckmc_alias_info_list_s handle containing
+ *                          information about all certificate aliases \n
+ *                          If there is no available certificate alias, *ppalias_list will be null
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @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 a database error
+ * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN Alias does not exist
+ * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
+ * @pre User is already logged in and the user key is already loaded into memory in plain text form.
+ * @see ckmc_save_cert()
+ * @see ckmc_remove_alias()
+ * @see ckmc_get_cert()
+ */
+int ckmc_get_cert_alias_info_list(ckmc_alias_info_list_s **ppalias_list);
+
+
+/**
  * @brief Stores PKCS12's contents inside key manager based on the provided policies. All items from the PKCS12 will use the same alias.
  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
  * @remarks %http://tizen.org/privilege/keymanager (public level privilege) is no longer required to use this API since 3.0.
@@ -413,6 +464,32 @@ int ckmc_get_data_alias_list(ckmc_alias_list_s **ppalias_list);
 
 
 /**
+ * @brief Gets the information about all the aliases of data that the client can access.
+ * @since_tizen 5.5
+ * @remarks A client can access only data stored by the client and the entries from system database
+ * if it was explicitly permitted to.
+ * @remarks You must destroy the newly created @a ppalias_list by calling ckmc_alias_info_list_all_free()
+ * if it is no longer needed.
+ * @param[out] ppalias_list The pointer to a newly created ckmc_alias_info_list_s handle containing
+ *                          information about all data aliases \n
+ *                          If there is no available data alias, *ppalias_list will be null
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @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 does not exist
+ * @retval #CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
+ * @pre User is already logged in and the user key is already loaded into memory in plain text form.
+ * @see ckmc_save_data()
+ * @see ckmc_remove_alias()
+ * @see ckmc_get_data()
+ */
+int ckmc_get_data_alias_info_list(ckmc_alias_info_list_s **ppalias_list);
+
+
+/**
  * @brief Creates RSA private/public key pair and stores them inside key manager based on each policy.
  * @since_tizen 2.3
  * @remarks %http://tizen.org/privilege/keymanager (public level privilege) is no longer required to use this API since 3.0.