//
-// Open Service Platform
// Copyright (c) 2012 Samsung Electronics Co., Ltd.
//
// Licensed under the Apache License, Version 2.0 (the License);
namespace Tizen { namespace Security
{
+class ISecretKey;
+
/**
* @class _PrivilegeInfo
* @brief This class provides a basic information of privilege manager.
* @exception E_SUCCESS The method is successful.
* @exception E_INVALID_ARG A specified input parameter is invalid.
*/
- result Construct(const Tizen::App::AppId& appId, const byte* pBitwisePrivilege);
+ result Construct(const Tizen::App::AppId& appId, const byte* pBitwisePrivilege, const Tizen::Base::Collection::ArrayList* pPrivilegeStringList);
/**
- * Initializes an instance of _PrivilegeInfo and sets its base information using stored information.
+ * Initializes an instance of _PrivilegeInfo and sets its base information using stored privilege information.
*
* @since 2.0
* @return An error code
* @exception E_SUCCESS The method is successful.
* @exception E_INVALID_ARG A specified input parameter is invalid.
*/
- result Construct(const Tizen::App::AppId& appId, const Tizen::Base::String& encryptedPrivileges, const Tizen::Base::String& checksum);
- result Construct(const Tizen::App::AppId& appId, const Tizen::Base::String& encryptedPrivileges, const Tizen::Base::String& checksum, const Tizen::Base::String& encryptedVisibiliity, const Tizen::Base::String& visibilityChecksum);
+ result Construct(const Tizen::App::AppId& appId, const Tizen::Base::String& encryptedPrivileges, const Tizen::Base::String& checksum,
+ const Tizen::Base::Collection::ArrayList* pPrivilegeStringList);
+
+ /**
+ * Initializes an instance of _PrivilegeInfo and sets its base information using stored privilege and visibility information.
+ *
+ * @since 2.0
+ * @return An error code
+ * @param[in] appId The application ID.
+ * @param[in] encryptedPrivileges A string containing encrypted privilege information.
+ * @param[in] checksum A string containing checksum of privilege information.
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG A specified input parameter is invalid.
+ */
+ result Construct(const Tizen::App::AppId& appId, const Tizen::Base::String& encryptedPrivileges, const Tizen::Base::String& checksum,
+ const Tizen::Base::String& encryptedVisibiliity, const Tizen::Base::String& visibilityChecksum, const Tizen::Base::Collection::ArrayList* pPrivilegeStringList);
/**
* Initializes an instance of _PrivilegeInfo and sets its base information using _PrivilegeInfo instance.
*
* @since 2.0
* @return A boolean value of the result
- * @param[int] privilege A value of enumerator of the specified privilege group.
+ * @param[int] privilege A value of enumerator of the specified privilege.
*/
bool HasPrivilege(_Privilege privilege) const;
-private:
/**
- * Verify the checksum string.
+ * Checks whether the application has a privilege to invoke. @n
+ * Unlike HasPrivilege, HasPrivilegeEx does not print the log.
*
- * @since 2.0
- * @return E_SUCCESS if the checksum is normal
- * @param[in] appId The application ID.
- * @param[int] targetBitwisePrivilege The bitwise privilege information.
- * @param[in] storedChecksum The stored checksum.
- * @param[out] pResult A boolean value of the result.
- * @exception E_SUCCESS The method is successful.
- * @exception E_INVALID_ARG The checksum is abnormal.
- * @exception E_OUT_OF_MEMORY The memory is insufficient.
- * @exception E_SYSTEM An unexpected system error occurred.
+ * @since 2.1
+ * @return A boolean value of the result
+ * @param[int] privilege A value of enumerator of the specified privilege.
+ */
+ bool HasPrivilegeEx(_Privilege privilege) const;
+
+ /**
+ * Checks whether the application has a privilege to invoke.
+ *
+ * @since 2.1
+ * @return A boolean value of the result
+ * @param[in] privilege A string of the specified privilege.
*/
+ bool HasPrivilege(const Tizen::Base::String& privilege) const;
+
+private:
+
result VerifyIntegrity(const Tizen::App::AppId& appId, const byte* targetBitwisePrivilege, const Tizen::Base::String& storedChecksum, int length);
- result VerifyIntegrityEx(const Tizen::App::AppId& appId, const byte* targetBitwisePrivilege, const Tizen::Base::String& storedChecksum, int length);
result VerifyIntegrity(const Tizen::App::AppId& appId, const byte* targetBitwisePrivilege, const Tizen::Base::String& storedChecksum, int length, int visibility, const Tizen::Base::String& storedVisibilityChecksum);
+ result VerifyIntegrityEx(const Tizen::App::AppId& appId, const byte* targetBitwisePrivilege, const Tizen::Base::String& storedChecksum, int length);
+
+ static int GetPrivilegeLevel(const Tizen::Base::String& privilegeLevel);
+ static ISecretKey* GetDeviceUniqueKeyN(void);
_PrivilegeInfo(const _PrivilegeInfo& rhs);
_PrivilegeInfo& operator =(const _PrivilegeInfo& rhs);
int __apiVisibility;
byte __bitwisePrivilege[MAX_BITWISE_PRIV_SIZE];
int __bitwiseLength;
+ Tizen::Base::Collection::HashMap __privilegeList;
}; // _PrivilegeInfo