+++ /dev/null
-//
-// Open Service Platform
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.
-//
-// 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 FAppPkgPackageLicenseManager.h
- * @brief This is the header file for the %PackageLicenseManager class.
- *
- * This header file contains the declarations of the %PackageLicenseManager class.
- */
-
-#ifndef _FAPP_PKG_PACKAGE_LICENSE_MANAGER_H_
-#define _FAPP_PKG_PACKAGE_LICENSE_MANAGER_H_
-
-#include <FBase.h>
-#include <FAppTypes.h>
-
-namespace Tizen { namespace App { namespace Package
-{
-
-/**
- * @class PackageLicenseManager
- * @brief This class gets the information of a package's license and manages its installation.
- *
- * @since 2.1
- *
- * @remarks Do not use this class without obtaining prior permissions from the %Tizen platform team.
- *
- * The %PackageLicenseManager class gets the information of a package's license and manages its installation.
- */
-class _OSP_EXPORT_ PackageLicenseManager
-{
-public:
-
- /**
- * Generates a license request and URL.
- *
- * @since 2.1
- * @privlevel platform
- * @privilege %http://tizen.org/privilege/packagelicensemanager
- *
- * @return An error code
- * @param[in] licenseRequestInfo The string buffer of license request information
- * @param[out] licenseRequest The string buffer of Package DRM license request
- * @param[out] licenseUrl The URL for Package DRM license
- * @exception E_SUCCESS The method is successful.
- * @exception E_INVALID_ARG A specified input parameter is invalid.
- * @exception E_INVALID_DATA A specified XML field of input string is invalid. @n
- * For example, the requested ID is invalid.
- * @exception E_PARSING_FAILED An error has occurred when parsing the input string.
- * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
- * @remarks Do not use this method without obtaining prior permissions from the %Tizen platform team.
- */
- static result GenerateDrmLicenseRequest(const Tizen::Base::String& licenseRequestInfo, Tizen::Base::String& licenseRequest, Tizen::Base::String& licenseUrl);
-
- /**
- * Saves a Package DRM license(right object) to a DRM repository. @n
- * It stores the DRM license (right object) when it does not exist in the DRM repository.
- * When the same @c packgeId of DRM license(right object) already exists in the DRM repository, it is overwritten.
- *
- * @since 2.1
- * @privlevel platform
- * @privilege %http://tizen.org/privilege/packagelicensemanager
- *
- * @return An error code
- * @param[in] rightObject The Package DRM license (right object)
- * @exception E_SUCCESS The method is successful.
- * @exception E_INVALID_ARG The specified input parameter is invalid.
- * @exception E_DATABASE An error has occurred when handling the rights object repository.
- * @exception E_INVALID_BINDING The input right object is not binded to the device.
- * @exception E_INVALID_SIGNATURE The signature verification of the input string has failed.
- * @exception E_INVALID_CERTIFICATE The certificate chain verification of the input string has failed.
- * @exception E_INVALID_DATA A specified XML field of input string is invalid. @n
- * For example, the @c appId field is empty.
- * @exception E_PARSING_FAILED An error has occurred when parsing the input string.
- * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
- * @remarks Do not use this method without obtaining prior permissions from the %Tizen platform team.
- */
- static result SaveDrmLicense(const Tizen::Base::String& rightObject);
-
- /**
- * Gets the remaining time of the package until the DRM license expiration.
- *
- * @since 2.1
- * @privlevel platform
- * @privilege %http://tizen.org/privilege/packagelicensemanager
- *
- * @return The remaining time of the DRM license @n
- * If the remaining time is unlimited, the return value of Tizen::Base::TimeSpan's days will be set to @c 9999.
- * @param[in] pkgId The package ID with which to get the information of time-based constraint
- * @exception E_SUCCESS The method is successful.
- * @exception E_INVALID_ARG The specified input parameter is invalid.
- * @exception E_DATABASE An error has occurred when handling the rights object repository.
- * @exception E_OBJ_NOT_FOUND The specified @c pkgId does not exist in the rights management repository.
- * @exception E_RIGHT_EXPIRED The DRM license has expired.
- * @exception E_RIGHT_UNLIMITED The DRM license is unlimited.
- * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
- * @remarks The specific error code can be accessed using the GetLastResult() method.
- * @remarks Do not use this method without obtaining prior permissions from the %Tizen platform team.
- */
- static Tizen::Base::TimeSpan GetRemainingTimeUntilDrmExpiration(const Tizen::App::PackageId& pkgId);
-
- /**
- * Saves a CEK (Contents Encryption Key) to a DRM repository. @n
- * It stores the CEK when it does not exist in the DRM repository.
- * When the same @c PackageId of CEK already exists in the DRM repository, it is overwritten.
- *
- * @since 2.1
- * @privlevel platform
- * @privilege %http://tizen.org/privilege/packagelicensemanager
- *
- * @return An error code
- * @param[in] licenseInfo The CEK (Contents Encryption Key)
- * @exception E_SUCCESS The method is successful.
- * @exception E_INVALID_ARG The specified input parameter is invalid.
- * @exception E_INVALID_DATA A specified XML field of input string is invalid. @n
- * For example, the @c appId field is empty.
- * @exception E_DATABASE An error has occurred when handling the rights object repository.
- * @exception E_PARSING_FAILED An error has occurred when parsing the input string.
- * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
- * @remarks Do not use this method without obtaining prior permissions from the %Tizen platform team.
- */
- static result SaveLicenseInfoForPackage(const Tizen::Base::String& licenseInfo);
-
-private:
- PackageLicenseManager(void);
- ~PackageLicenseManager(void);
-
- PackageLicenseManager(const PackageLicenseManager& rhs);
- PackageLicenseManager& operator = (const PackageLicenseManager);
-
-}; // PackageLicenseManager
-
-}}} // Tizen::App::Package
-
-#endif // _FAPP_PKG_PACKAGE_LICENSE_MANAGER_H_
+++ /dev/null
-//
-// Open Service Platform
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.
-//
-// 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 FAppPkgPackageLicenseManager.cpp
- * @brief This is the implementation for the PackageLicenseManager class.
- */
-#include <FBaseErrorDefine.h>
-#include <FBase_StringConverter.h>
-#include <string.h>
-#include <FSec_AccessController.h>
-#include <FAppPkgPackageLicenseManager.h>
-#include <FBaseSysLog.h>
-
-#include <drm-oem-intel.h>
-
-using namespace Tizen::Base;
-using namespace Tizen::Security;
-
-namespace Tizen { namespace App { namespace Package
-{
-
-PackageLicenseManager::PackageLicenseManager(void)
-{
-}
-
-PackageLicenseManager::~PackageLicenseManager(void)
-{
-}
-
-result
-PackageLicenseManager::GenerateDrmLicenseRequest(const Tizen::Base::String& licenseRequestInfo, Tizen::Base::String& licenseRequest, Tizen::Base::String& licenseUrl)
-{
- result r = E_SUCCESS;
-
- r = _AccessController::CheckUserPrivilege(_PRV_PACKAGELICENSEMANAGER);
- SysTryReturnResult(NID_APP, !IsFailed(r), E_PRIVILEGE_DENIED, ("[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method."));
-
- return r;
-}
-
-result
-PackageLicenseManager::SaveDrmLicense(const Tizen::Base::String& rightObject)
-{
- result r = E_SUCCESS;
- char* pRo = null;
- int ret = 0;
-
- r = _AccessController::CheckUserPrivilege(_PRV_PACKAGELICENSEMANAGER);
- SysTryReturnResult(NID_APP, !IsFailed(r), E_PRIVILEGE_DENIED, ("[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method."));
-
- pRo = _StringConverter::CopyToCharArrayN(rightObject);
- SysAssertf(pRo != null, "[PackageLicenseManager] pRo is null");
-
- ret = drm_oem_intel_install_license(pRo, strlen(pRo));
-
- if(ret == 1)
- {
- SysLog(NID_APP, "SaveDrmLicense() called, ro successfully saved.");
- }
- else
- {
- SysLog(NID_APP, "SaveDrmLicense() called, failed.");
- r = E_INVALID_DATA;
- }
-
-CATCH:
- delete [] pRo;
- return r;
-}
-
-Tizen::Base::TimeSpan
-PackageLicenseManager::GetRemainingTimeUntilDrmExpiration(const Tizen::App::PackageId& pkgId)
-{
- result r = E_SUCCESS;
-
- r = _AccessController::CheckUserPrivilege(_PRV_PACKAGELICENSEMANAGER);
- SysTryReturnResult(NID_APP, !IsFailed(r), E_PRIVILEGE_DENIED, ("[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method."));
-
- TimeSpan temp(9999,9999,9999);
-
- return temp;
-}
-
-result
-PackageLicenseManager::SaveLicenseInfoForPackage(const Tizen::Base::String& licenseInfo)
-{
- result r = E_SUCCESS;
- char* pCek = null;
- int ret = 0;
-
- r = _AccessController::CheckUserPrivilege(_PRV_PACKAGELICENSEMANAGER);
- SysTryReturnResult(NID_APP, !IsFailed(r), E_PRIVILEGE_DENIED, ("[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method."));
-
- pCek = _StringConverter::CopyToCharArrayN(licenseInfo);
- SysAssertf(pCek !=null, "[PackageLicenseManager] pCek is null");
-
- ret = drm_oem_intel_install_cek(pCek, strlen(pCek));
-
- if(ret == 1)
- {
- SysLog(NID_APP, "SaveLicenseInfoForApp() called, ro successfully saved.");
- }
- else
- {
- SysLog(NID_APP, "SaveLicenseInfoForApp() called, failed.");
- r = E_INVALID_DATA;
- }
-
-CATCH:
- delete [] pCek;
- return r;
-}
-
-}}} // Tizen::App::Package