2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file FSec_PrivilegeManagerInfo.h
20 * @brief This is the header file for the FSec_PrivilegeInfo.
21 * This header file contains the declarations of the FSec_PrivilegeInfo.
24 #ifndef _FSEC_INTERNAL_PRIVILEGE_INFO_H_
25 #define _FSEC_INTERNAL_PRIVILEGE_INFO_H_
27 #include <FOspConfig.h>
28 #include "FSec_AccessControlTypes.h"
30 namespace Tizen { namespace Security
34 * @class _PrivilegeInfo
35 * @brief This class provides a basic information of privilege manager.
38 * This class provides a basic information of privilege manager.
42 : public Tizen::Base::Object
47 * This is the default constructor for this class. @n
48 * This method creates an uninitialized instance of _PrivilegeCache.
55 * This is the destructor for this class.
59 virtual ~_PrivilegeInfo(void);
62 * Initializes an instance of _PrivilegeInfo and sets its base information directly.
65 * @return An error code
66 * @param[in] appId The application ID.
67 * @param[in] pBitwisePrivilege The bitwise privilege information.
68 * @exception E_SUCCESS The method is successful.
69 * @exception E_INVALID_ARG A specified input parameter is invalid.
71 result Construct(const Tizen::App::AppId& appId, const byte* pBitwisePrivilege);
74 * Initializes an instance of _PrivilegeInfo and sets its base information using stored information.
77 * @return An error code
78 * @param[in] appId The application ID.
79 * @param[in] encryptedPrivileges A string containing encrypted privilege information.
80 * @param[in] checksum A string containing checksum of privilege information.
81 * @exception E_SUCCESS The method is successful.
82 * @exception E_INVALID_ARG A specified input parameter is invalid.
84 result Construct(const Tizen::App::AppId& appId, const Tizen::Base::String& encryptedPrivileges, const Tizen::Base::String& checksum);
85 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);
88 * Initializes an instance of _PrivilegeInfo and sets its base information using _PrivilegeInfo instance.
91 * @return An error code
92 * @param[in] privilegeInfo An instance of _PrivilegeInfo.
93 * @exception E_SUCCESS The method is successful.
94 * @exception E_AUTHENTICATION The authentication has failed.
95 * @exception E_INVALID_ARG A specified input parameter is invalid.
97 result Construct(const _PrivilegeInfo& privilegeInfo);
100 * CCreates and returns a polymorphic copy of _PrivilegeInfo instance.
102 * @return The clone of this instance
103 * @exception E_OUT_OF_MEMORY The memory is insufficient.
106 _PrivilegeInfo* CloneN(void) const;
109 * Gets the application ID.
112 * @return The application id
114 const Tizen::Base::String GetAppId(void) const;
117 * Gets the bitwise privilege information.
120 * @return An error code
121 * @param[out] pBitwisePrivilege The bitwise privilege information.
122 * @exception E_SUCCESS The method is successful.
123 * @exception E_OUT_OF_MEMORY The memory is insufficient.
125 result GetBitwisePrivilegeN(byte*& pBitwisePrivilege) const;
128 * Gets the encrypted string of bitwise privilege information.
131 * @return An error code
132 * @param[out] encryptedPrivileges A string containing encrypted privilege information.
133 * @exception E_SUCCESS The method is successful.
134 * @exception E_OUT_OF_MEMORY The memory is insufficient.
135 * @exception E_SYSTEM An unexpected system error occurred.
137 result GetEncryptedBitwise(Tizen::Base::String& encryptedPrivileges) const;
140 * Gets the checksum of bitwise privilege information.
143 * @return An error code
144 * @param[out] checksum A string containing checksum of privilege information.
145 * @exception E_SUCCESS The method is successful.
146 * @exception E_SYSTEM An unexpected system error occurred.
148 result GetChecksum(Tizen::Base::String& checksum) const;
151 * Checks whether the application has a privilege to invoke.
154 * @return A boolean value of the result
155 * @param[int] privilege A value of enumerator of the specified privilege group.
157 bool HasPrivilege(_Privilege privilege) const;
161 * Verify the checksum string.
164 * @return E_SUCCESS if the checksum is normal
165 * @param[in] appId The application ID.
166 * @param[int] targetBitwisePrivilege The bitwise privilege information.
167 * @param[in] storedChecksum The stored checksum.
168 * @param[out] pResult A boolean value of the result.
169 * @exception E_SUCCESS The method is successful.
170 * @exception E_INVALID_ARG The checksum is abnormal.
171 * @exception E_OUT_OF_MEMORY The memory is insufficient.
172 * @exception E_SYSTEM An unexpected system error occurred.
174 result VerifyIntegrity(const Tizen::App::AppId& appId, const byte* targetBitwisePrivilege, const Tizen::Base::String& storedChecksum, int length);
175 result VerifyIntegrityEx(const Tizen::App::AppId& appId, const byte* targetBitwisePrivilege, const Tizen::Base::String& storedChecksum, int length);
176 result VerifyIntegrity(const Tizen::App::AppId& appId, const byte* targetBitwisePrivilege, const Tizen::Base::String& storedChecksum, int length, int visibility, const Tizen::Base::String& storedVisibilityChecksum);
178 _PrivilegeInfo(const _PrivilegeInfo& rhs);
179 _PrivilegeInfo& operator =(const _PrivilegeInfo& rhs);
182 Tizen::App::AppId __appId;
184 byte __bitwisePrivilege[MAX_BITWISE_PRIV_SIZE];
189 }} // Tizen::Security
191 #endif // _FSEC_INTERNAL_PRIVILEGE_INFO_H_