summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorKyungwook Tak <k.tak@samsung.com>2016-07-27 16:54:50 +0900
committerkyungwook tak <k.tak@samsung.com>2016-08-02 21:45:45 -0700
commitcc76acebe224f4b8a273752b2400190ab0aab679 (patch)
tree9f131a30f794d8a11174a3ef06c18c91976a8bd6 /include
parenta025df2ca4ae9a4e13b5b803674da4dd1bd133e9 (diff)
downloadlibwebappenc-cc76acebe224f4b8a273752b2400190ab0aab679.tar.gz
libwebappenc-cc76acebe224f4b8a273752b2400190ab0aab679.tar.bz2
libwebappenc-cc76acebe224f4b8a273752b2400190ab0aab679.zip
[API changed] Add uid parametersubmit/tizen/20160811.013634
Installer will be run as system (from user) so we cannot retrieve user id from client credential(by key-manager). Change-Id: I1e091bfc0b88fce418cd209a7a1adab021b6c0d2 Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
Diffstat (limited to 'include')
-rw-r--r--include/web_app_enc.h109
1 files changed, 88 insertions, 21 deletions
diff --git a/include/web_app_enc.h b/include/web_app_enc.h
index c876792..47cbe78 100644
--- a/include/web_app_enc.h
+++ b/include/web_app_enc.h
@@ -14,7 +14,7 @@
* limitations under the License
*
* @file web_app_enc.h
- * @version 1.0
+ * @version 2.0
* @brief APIs of WEB_APP_ENC module.
*/
#ifndef __WEB_APP_ENC__
@@ -25,6 +25,8 @@ extern "C" {
#endif
#include <stddef.h>
+#include <stdbool.h>
+#include <sys/types.h>
/**
* @addtogroup CAPI_WEB_APP_ENC_MODULE
@@ -49,24 +51,40 @@ typedef enum {
} wae_error_e;
/**
- * @brief Application Type.
+ * @brief Encrypts web application data
+ *
* @since_tizen 3.0
+ * @param[in] uid User id of the application being encrypted
+ * @param[in] pkg_id The package id of an application
+ * @param[in] data The data block to be encrypted
+ * @param[in] data_len The length of @a data
+ * @param[out] pencrypted_data The encrypted data block which must be freed by free()
+ * @param[out] pencrypted_data_len The length of data pointed by @a pencrypted_data
+ *
+ * @return #WAE_ERROR_NONE on success, otherwise a negative error value
+ * @retval #WAE_ERROR_INVALID_PARAMETER Invalid input parameter
+ * @retval #WAE_ERROR_PERMISSION_DENIED Non-authenticated application request
+ * @retval #WAE_ERROR_NO_KEY No internal key
+ * @retval #WAE_ERROR_KEY_MANAGER key-manager internal error
+ * @retval #WAE_ERROR_CRYPTO failed in crypto operation
+ * @retval #WAE_ERROR_UNKNOWN Failed with unknown reason
+ *
+ * @see wae_decrypt_web_application()
+ * @see wae_remove_app_dek()
*/
-typedef enum {
- WAE_DOWNLOADED_NORMAL_APP = 0, /**< Downloaded Normal Application*/
- WAE_DOWNLOADED_GLOBAL_APP = 1, /**< Downloaded Global Application*/
- WAE_PRELOADED_APP = 2 /**< Preloaded Application*/
-} wae_app_type_e;
+int wae_encrypt_web_application(uid_t uid, const char *pkg_id,
+ const unsigned char *data, size_t data_len,
+ unsigned char **pencrypted_data, size_t *pencrypted_data_len);
/**
- * @brief Encrypts web application data with internal key(APP DEK: Application Data Encryption Key).
+ * @brief Encrypts global web application data
*
* @since_tizen 3.0
* @param[in] pkg_id The package id of an application
- * @param[in] app_type The application type
+ * @param[in] is_preloaded Whether the package is preloaded or not
* @param[in] data The data block to be encrypted
* @param[in] data_len The length of @a data
- * @param[out] pencrypted_data The data block contaning encrypted data block which must be freed by free()
+ * @param[out] pencrypted_data The encrypted data block which must be freed by free()
* @param[out] pencrypted_data_len The length of data pointed by @a pencrypted_data
*
* @return #WAE_ERROR_NONE on success, otherwise a negative error value
@@ -77,21 +95,22 @@ typedef enum {
* @retval #WAE_ERROR_CRYPTO failed in crypto operation
* @retval #WAE_ERROR_UNKNOWN Failed with unknown reason
*
- * @see wae_decrypt_web_application()
+ * @see wae_decrypt_global_web_application()
+ * @see wae_remove_global_app_dek()
*/
-int wae_encrypt_web_application(const char *pkg_id, wae_app_type_e app_type,
- const unsigned char *data, size_t data_len,
- unsigned char **pencrypted_data, size_t *pencrypted_data_len);
+int wae_encrypt_global_web_application(const char *pkg_id, bool is_preloaded,
+ const unsigned char *data, size_t data_len,
+ unsigned char **pencrypted_data, size_t *pencrypted_data_len);
/**
- * @brief Encrypts web application data with internal key.
+ * @brief Decrypts web application data.
*
* @since_tizen 3.0
+ * @param[in] uid User id of the application being decrypted
* @param[in] pkg_id The package id of an application
- * @param[in] app_type The application type
* @param[in] data The data block to be decrypted
* @param[in] data_len The length of @a data
- * @param[out] pdecrypted_data Data block contaning decrypted data block which must be freed by free()
+ * @param[out] pdecrypted_data The decrypted data block which must be freed by free()
* @param[out] pdecrypted_data_len The length of data pointed by @a pdecrypted_data
*
* @return #WAE_ERROR_NONE on success, otherwise a negative error value
@@ -103,17 +122,44 @@ int wae_encrypt_web_application(const char *pkg_id, wae_app_type_e app_type,
* @retval #WAE_ERROR_UNKNOWN Failed with unknown reason
*
* @see wae_encrypt_web_application()
+ * @see wae_remove_app_dek()
*/
-int wae_decrypt_web_application(const char *pkg_id, wae_app_type_e app_type,
+int wae_decrypt_web_application(uid_t uid, const char *pkg_id,
const unsigned char *data, size_t data_len,
unsigned char **pdecrypted_data, size_t *pdecrypted_data_len);
/**
- * @brief Remove a APP DEK(Application Data Encryption Key) used for encrytpion and decryption of a web application.
+ * @brief Decrypts global web application data.
+ *
+ * @since_tizen 3.0
+ * @param[in] pkg_id The package id of an application
+ * @param[in] is_preloaded Whether the package is preloaded or not
+ * @param[in] data The data block to be decrypted
+ * @param[in] data_len The length of @a data
+ * @param[out] pdecrypted_data The decrypted data block which must be freed by free()
+ * @param[out] pdecrypted_data_len The length of data pointed by @a pdecrypted_data
+ *
+ * @return #WAE_ERROR_NONE on success, otherwise a negative error value
+ * @retval #WAE_ERROR_INVALID_PARAMETER Invalid input parameter
+ * @retval #WAE_ERROR_PERMISSION_DENIED Non-authenticated application request
+ * @retval #WAE_ERROR_NO_KEY No internal key
+ * @retval #WAE_ERROR_KEY_MANAGER key-manager internal error
+ * @retval #WAE_ERROR_CRYPTO failed in crypto operation
+ * @retval #WAE_ERROR_UNKNOWN Failed with unknown reason
+ *
+ * @see wae_encrypt_global_web_application()
+ * @see wae_remove_global_app_dek()
+ */
+int wae_decrypt_global_web_application(const char *pkg_id, bool is_preloaded,
+ const unsigned char *data, size_t data_len,
+ unsigned char **pdecrypted_data, size_t *pdecrypted_data_len);
+
+/**
+ * @brief Remove key used for encryption the web application.
*
* @since_tizen 3.0
+ * @param[in] uid User id of the application being uninstalled
* @param[in] pkg_id The package id of an application
- * @param[in] app_type The application type
*
* @return #WAE_ERROR_NONE on success, otherwise a negative error value
* @retval #WAE_ERROR_INVALID_PARAMETER Invalid input parameter
@@ -122,8 +168,29 @@ int wae_decrypt_web_application(const char *pkg_id, wae_app_type_e app_type,
* @retval #WAE_ERROR_KEY_MANAGER key-manager internal error
* @retval #WAE_ERROR_UNKNOWN Failed with unknown reason
*
+ * @see wae_encrypt_web_application()
+ * @see wae_decrypt_web_application()
+ */
+int wae_remove_app_dek(uid_t uid, const char *pkg_id);
+
+/**
+ * @brief Remove key used for encryption the global web application.
+ *
+ * @since_tizen 3.0
+ * @param[in] pkg_id The package id of an application
+ * @param[in] is_preloaded Whether the package is preloaded or not
+ *
+ * @return #WAE_ERROR_NONE on success, otherwise a negative error value
+ * @retval #WAE_ERROR_INVALID_PARAMETER Invalid input parameter
+ * @retval #WAE_ERROR_PERMISSION_DENIED Non-authenticated application request
+ * @retval #WAE_ERROR_NO_KEY No internal key
+ * @retval #WAE_ERROR_KEY_MANAGER key-manager internal error
+ * @retval #WAE_ERROR_UNKNOWN Failed with unknown reason
+ *
+ * @see wae_encrypt_global_web_application()
+ * @see wae_decrypt_global_web_application()
*/
-int wae_remove_app_dek(const char *pkg_id, wae_app_type_e app_type);
+int wae_remove_global_app_dek(const char *pkg_id, bool is_preloaded);
/**
* @}