98868be34af6939ebab282df49686cc89bb545f7
[platform/framework/native/installer.git] / src / XmlHandler / PrivilegeHandler.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
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.
16 //
17 /**
18  * @file        PrivilegeHandler.h
19  * @brief       This is the header file for the PrivilegeHandler class.
20  *
21  * This header file contains the declarations of the PrivilegeHandler class.
22  */
23
24 #ifndef _PRIVILEGE_HANDLER_H_
25 #define _PRIVILEGE_HANDLER_H_
26
27 #include <FSec_AccessControlTypes.h>
28
29 namespace Tizen { namespace Base { namespace Collection
30 {
31 class IList;
32 }}}
33
34 namespace Tizen { namespace Base
35 {
36 class String;
37 }}
38
39 static const wchar_t EXTERNAL_PRIVILEGE_DB_NAME[] = L"/opt/dbspace/.privilegelist.db";
40
41 /**
42  * @class               PrivilegeHandler
43  * @brief               This class represents the class of PrivilegeHandler.
44  * @since 2.1
45  *
46  * This class represents the class of PrivilegeHandler.
47  *
48  */
49 class PrivilegeHandler
50 {
51
52 public:
53                 static result GenerateCipherPrivilege(const Tizen::App::AppId& appId, const Tizen::Base::Collection::IList& privilegeList, Tizen::Base::String& encryptedPrivileges, Tizen::Base::String& checksum, Tizen::Base::Collection::IList& stringPrivilege);
54                 static result GenerateCipherPrivilege(const Tizen::App::AppId& appId, const Tizen::Base::Collection::IList& privilegeList, int visibilityLevel, Tizen::Base::String& encryptedPrivileges, Tizen::Base::String& checksum, Tizen::Base::Collection::IList& stringPrivilege);
55 private:
56                 static byte* PackPrivilegeN(const Tizen::Base::Collection::IList& privilegeList);
57                 static result PackPrivilegeN(const Tizen::Base::Collection::IList& privilegeList, int visibilityLevel, byte** ppBitwisePrivilege);
58                 static result GetEncryptedBitwise(byte* __bitwisePrivilege, Tizen::Base::String& encryptedPrivileges);
59                 static result GetChecksum(Tizen::App::AppId appId, byte* __bitwisePrivilege, Tizen::Base::String& checksum);
60                 static result PickExternalPrivilege(const Tizen::Base::Collection::IList& fullPrivilegeList, Tizen::Base::Collection::IList& normalPrivilegeList, Tizen::Base::Collection::IList& externalPrivilegeList);
61
62 }; // PrivilegeHandler
63
64 #endif // _PRIVILEGE_HANDLER_H_