add % before the privilege tag not to link to the linkage page
[platform/framework/native/appfw.git] / inc / FAppPkgPackageLicenseManager.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 /**
19  * @file        FAppPkgPackageLicenseManager.h
20  * @brief       This is the header file for the %PackageLicenseManager class.
21  *
22  * This header file contains the declarations of the %PackageLicenseManager class.
23  */
24
25 #ifndef _FAPP_PKG_PACKAGE_LICENSE_MANAGER_H_
26 #define _FAPP_PKG_PACKAGE_LICENSE_MANAGER_H_
27
28 #include <FBase.h>
29 #include <FAppTypes.h>
30
31 namespace Tizen { namespace App { namespace Package
32 {
33
34 /**
35  * @class   PackageLicenseManager
36  * @brief   This class gets the information of a package's license and manages its installation.
37  *
38  * @since 2.1
39  *
40  * @remarks  Do not use this class without obtaining prior permissions from the %Tizen platform team.
41  *
42  * The %PackageLicenseManager class gets the information of a package's license and manages its installation.
43  */
44 class _OSP_EXPORT_ PackageLicenseManager
45 {
46 public:
47
48         /**
49         * Generates a license request and URL.
50         *
51         * @since 2.1
52         * @privlevel    platform
53         * @privilege    %http://tizen.org/privilege/packagelicensemanager
54         *
55         * @return               An error code
56         * @param[in]    licenseRequestInfo      The string buffer of license request information
57         * @param[out]   licenseRequest          The string buffer of Package DRM license request
58         * @param[out]   licenseUrl                      The URL for Package DRM license
59         * @exception    E_SUCCESS                       The method is successful.
60         * @exception    E_INVALID_ARG           A specified input parameter is invalid.
61         * @exception    E_INVALID_DATA          A specified XML field of input string is invalid. @n
62         *                                                                       For example, the requested ID is invalid.
63         * @exception    E_PARSING_FAILED        An error has occurred when parsing the input string.
64         * @exception    E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
65         * @remarks      Do not use this method without obtaining prior permissions from the %Tizen platform team.
66         */
67         static result GenerateDrmLicenseRequest(const Tizen::Base::String& licenseRequestInfo, Tizen::Base::String& licenseRequest, Tizen::Base::String& licenseUrl);
68
69         /**
70         * Saves a Package DRM license(right object) to a DRM repository. @n
71         * It stores the DRM license (right object) when it does not exist in the DRM repository.
72         * When the same @c packgeId of DRM license(right object) already exists in the DRM repository, it is overwritten.
73         *
74         * @since 2.1
75         * @privlevel    platform
76         * @privilege    %http://tizen.org/privilege/packagelicensemanager
77         *
78         * @return               An error code
79         * @param[in]    rightObject                     The Package DRM license (right object)
80         * @exception    E_SUCCESS                       The method is successful.
81         * @exception    E_INVALID_ARG           The specified input parameter is invalid.
82         * @exception    E_DATABASE                      An error has occurred when handling the rights object repository.
83         * @exception    E_INVALID_BINDING       The input right object is not binded to the device.
84         * @exception    E_INVALID_SIGNATURE             The signature verification of the input string has failed.
85         * @exception    E_INVALID_CERTIFICATE   The certificate chain verification of the input string has failed.
86         * @exception    E_INVALID_DATA          A specified XML field of input string is invalid. @n
87         *                                                                       For example, the @c appId field is empty.
88         * @exception    E_PARSING_FAILED        An error has occurred when parsing the input string.
89         * @exception    E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
90         * @remarks      Do not use this method without obtaining prior permissions from the %Tizen platform team.
91         */
92         static result SaveDrmLicense(const Tizen::Base::String& rightObject);
93
94         /**
95         * Gets the remaining time of the package until the DRM license expiration.
96         *
97         * @since 2.1
98         * @privlevel    platform
99         * @privilege    %http://tizen.org/privilege/packagelicensemanager
100         *
101         * @return               The remaining time of the DRM license @n
102         *                               If the remaining time is unlimited, the return value of Tizen::Base::TimeSpan's days will be set to @c 9999.
103         * @param[in]    pkgId                           The package ID with which to get the information of time-based constraint
104         * @exception    E_SUCCESS                       The method is successful.
105         * @exception    E_INVALID_ARG           The specified input parameter is invalid.
106         * @exception    E_DATABASE                      An error has occurred when handling the rights object repository.
107         * @exception    E_OBJ_NOT_FOUND         The specified @c pkgId does not exist in the rights management repository.
108         * @exception    E_RIGHT_EXPIRED         The DRM license has expired.
109         * @exception    E_RIGHT_UNLIMITED       The DRM license is unlimited.
110         * @exception    E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
111         * @remarks              The specific error code can be accessed using the GetLastResult() method.
112         * @remarks      Do not use this method without obtaining prior permissions from the %Tizen platform team.
113         */
114         static Tizen::Base::TimeSpan GetRemainingTimeUntilDrmExpiration(const Tizen::App::PackageId& pkgId);
115
116         /**
117         * Saves a CEK (Contents Encryption Key) to a DRM repository. @n
118         * It stores the CEK when it does not exist in the DRM repository.
119         * When the same @c PackageId of CEK already exists in the DRM repository, it is overwritten.
120         *
121         * @since 2.1
122         * @privlevel    platform
123         * @privilege    %http://tizen.org/privilege/packagelicensemanager
124         *
125         * @return               An error code
126         * @param[in]    licenseInfo                     The CEK (Contents Encryption Key)
127         * @exception    E_SUCCESS                       The method is successful.
128         * @exception    E_INVALID_ARG           The specified input parameter is invalid.
129         * @exception    E_INVALID_DATA          A specified XML field of input string is invalid. @n
130         *                                                                       For example, the @c appId field is empty.
131         * @exception    E_DATABASE                      An error has occurred when handling the rights object repository.
132         * @exception    E_PARSING_FAILED        An error has occurred when parsing the input string.
133         * @exception    E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
134         * @remarks      Do not use this method without obtaining prior permissions from the %Tizen platform team.
135         */
136         static result SaveLicenseInfoForPackage(const Tizen::Base::String& licenseInfo);
137
138 private:
139         PackageLicenseManager(void);
140         ~PackageLicenseManager(void);
141
142         PackageLicenseManager(const PackageLicenseManager& rhs);
143         PackageLicenseManager& operator = (const PackageLicenseManager);
144
145 }; // PackageLicenseManager
146
147 }}} // Tizen::App::Package
148
149 #endif // _FAPP_PKG_PACKAGE_LICENSE_MANAGER_H_