summaryrefslogtreecommitdiff
path: root/include/web_app_enc.h
diff options
context:
space:
mode:
authorDongsun Lee <ds73.lee@samsung.com>2015-05-26 00:42:38 (GMT)
committerDongsun Lee <ds73.lee@samsung.com>2015-07-24 01:58:41 (GMT)
commit7abaa019637e0a534969d304cae7f7f43c4ab0a6 (patch)
tree9a2bb4f95b6c50ac39394abf87022d4a1a95fef2 /include/web_app_enc.h
parentd6556f8d8b13aadc9907b6609b773e29d2e22e7a (diff)
downloadlibwebappenc-7abaa019637e0a534969d304cae7f7f43c4ab0a6.zip
libwebappenc-7abaa019637e0a534969d304cae7f7f43c4ab0a6.tar.gz
libwebappenc-7abaa019637e0a534969d304cae7f7f43c4ab0a6.tar.bz2
Change-Id: Ibb7891bee67bdd82f34187f5da2fc3c4bbfa8fcd Signed-off-by: Dongsun Lee <ds73.lee@samsung.com>
Diffstat (limited to 'include/web_app_enc.h')
-rw-r--r--include/web_app_enc.h120
1 files changed, 120 insertions, 0 deletions
diff --git a/include/web_app_enc.h b/include/web_app_enc.h
new file mode 100644
index 0000000..2e31a3c
--- /dev/null
+++ b/include/web_app_enc.h
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2014 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ *
+ * @file web_app_enc.h
+ * @version 1.0
+ * @brief This file contains APIs of WEB_APP_ENC module.
+*/
+
+#ifndef __WEB_APP_ENC__
+#define __WEB_APP_ENC__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @addtogroup CAPI_WEB_APP_ENC_MODULE
+ * @{
+ */
+
+
+typedef enum
+{
+ WAE_ERROR_NONE = 0x00, /**< Successful */
+ WAE_ERROR_INVALID_PARAMETER = - 0x01, /**< Invalid function parameter */
+ WAE_ERROR_PERMISSION_DENIED = - 0x02, /**< Permission denied */
+ WAE_ERROR_NO_KEY = - 0x03, /**< No key */
+ WAE_ERROR_KEY_EXISTS = - 0x04, /**< key already exists*/
+ WAE_ERROR_KEY_MANAGER = - 0x05, /**< key-manager internal error */
+ WAE_ERROR_CRYPTO = - 0x06, /**< failed in crypto operation */
+ WAE_ERROR_MEMORY = - 0x07, /**< failed to allocate memory */
+ WAE_ERROR_FILE = - 0x08, /**< failed to read or write a file*/
+ WAE_ERROR_UNKNOWN = - 0x09 /** < Unknown error */
+} wae_error_e;
+
+/**
+ * @brief Encrypts web application data with internal key(APP DEK: Application Data Encryption Key).
+ *
+ * @since_tizen 3.0
+ * @param[in] pPkgId The package id of an application.
+ * @param[in] isPreloaded True(!=0) if the application is preloaded, otherwise false(==0).
+ * @param[in] pData The data block to be encrypted.
+ * @param[in] dataLen The length of the data block.
+ * @param[out] ppEncryptedData The data block contaning encrypted data block. Memory allocated for ppEncryptedData. Has to be freed by free() function.
+ * @param[out] pEncDataLen The length of the encrypted data block.
+ *
+ * @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()
+ */
+int wae_encrypt_web_application(const char* pPkgId, int isPreloaded, const unsigned char* pData, size_t dataLen, unsigned char** ppEncryptedData, size_t* pEncDataLen);
+
+/**
+ * @brief Encrypts web application data with internal key.
+ *
+ * @since_tizen 3.0
+ * @param[in] pPkgId The package id of an application.
+ * @param[in] isPreloaded True(!=0) if the application is preloaded, otherwise false(==0).
+ * @param[in] pData The data block to be decrypted.
+ * @param[in] dataLen The length of the data block.
+ * @param[out] ppDecryptedData Data block contaning decrypted data block. Memory allocated for ppEncryptedData. Has to be freed by free() function.
+ * @param[out] pDecDataLen The length of the decrypted data block.
+ *
+ * @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_web_application()
+ */
+int wae_decrypt_web_application(const char* pPkgId, int isPreloaded, const unsigned char* pData, size_t dataLen, unsigned char** ppDecryptedData, size_t* pDecDataLen);
+
+/**
+ * @brief Remove a APP DEK(Application Data Encryption Key) used for encrytpion and decryption of a web application.
+ *
+ * @since_tizen 3.0
+ * @param[in] pPkgId The package id of an application.
+ *
+ * @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
+ *
+ */
+int wae_remove_app_dek(const char* pPkgId);
+
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __WEB_APP_ENC__ */
+