diff options
author | Duyoung Jang <duyoung.jang@samsung.com> | 2013-08-13 16:49:27 +0900 |
---|---|---|
committer | Duyoung Jang <duyoung.jang@samsung.com> | 2013-08-13 16:51:27 +0900 |
commit | 7eadd6de2f485249765b281c126c5dc44b109d02 (patch) | |
tree | 295fe9fc3e12010b8d9fdf2feaf7c33fd0e0cd45 | |
parent | 12ee9a063a70941933acb8ee6cafb0e228c3f3b1 (diff) | |
download | installer-7eadd6de2f485249765b281c126c5dc44b109d02.tar.gz installer-7eadd6de2f485249765b281c126c5dc44b109d02.tar.bz2 installer-7eadd6de2f485249765b281c126c5dc44b109d02.zip |
Remove unused logic
Change-Id: Ib432aa79a3325b1e3d681c78f57224a35fcf00ab
Signed-off-by: Duyoung Jang <duyoung.jang@samsung.com>
-rwxr-xr-x | CMakeLists.txt | 1 | ||||
-rwxr-xr-x | inc/InstallerDefs.h | 2 | ||||
-rwxr-xr-x | src/Context/InstallationContext.cpp | 8 | ||||
-rwxr-xr-x | src/Context/InstallationContext.h | 2 | ||||
-rwxr-xr-x | src/Manager/DeviceManager.cpp | 315 | ||||
-rwxr-xr-x | src/Manager/DeviceManager.h | 57 | ||||
-rwxr-xr-x | src/Manager/SignatureManager.cpp | 385 | ||||
-rwxr-xr-x | src/Manager/SignatureManager.h | 14 | ||||
-rwxr-xr-x | src/Step/SignatureStep.cpp | 52 | ||||
-rwxr-xr-x | src/Step/SignatureStep.h | 4 | ||||
-rwxr-xr-x | src/Step/SystemCheckStep.cpp | 7 | ||||
-rwxr-xr-x | src/Step/UninstallStep.cpp | 7 |
12 files changed, 2 insertions, 852 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 4ef0bb9..5c16308 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,7 +47,6 @@ SET (${this_target}_SOURCE_FILES src/Manager/CompatibilityManager.cpp src/Manager/ConfigurationManager.cpp src/Manager/DatabaseManager.cpp - src/Manager/DeviceManager.cpp src/Manager/InstallerManager.cpp src/Manager/PermissionManager.cpp src/Manager/SignatureManager.cpp diff --git a/inc/InstallerDefs.h b/inc/InstallerDefs.h index d950161..ebab4a7 100755 --- a/inc/InstallerDefs.h +++ b/inc/InstallerDefs.h @@ -23,7 +23,7 @@ #include "InstallerUtil.h" -#define OSP_INSTALLER_VERSION "version=[20130813.1]" +#define OSP_INSTALLER_VERSION "version=[20130813.2]" #define DIR_BIN L"/bin" #define DIR_INFO L"/info" diff --git a/src/Context/InstallationContext.cpp b/src/Context/InstallationContext.cpp index 9ce1e63..c4efb1a 100755 --- a/src/Context/InstallationContext.cpp +++ b/src/Context/InstallationContext.cpp @@ -62,8 +62,6 @@ InstallationContext::InstallationContext(void) ,__pPrivilegeList(null) ,__pStringPrivilegeList(null) ,__pContentDataList(null) -,__pAuthorCertPath(null) -,__pDistributorCertPath(null) ,__pAuthorCertList(null) ,__pDistributorCertList(null) ,__pDistributorCertList2(null) @@ -80,12 +78,6 @@ InstallationContext::~InstallationContext(void) delete __pDrmLicense; __pDrmLicense = null; - delete __pAuthorCertPath; - __pAuthorCertPath = null; - - delete __pDistributorCertPath; - __pDistributorCertPath = null; - if (__pPrivilegeList) { __pPrivilegeList->RemoveAll(); diff --git a/src/Context/InstallationContext.h b/src/Context/InstallationContext.h index 8529718..1519d75 100755 --- a/src/Context/InstallationContext.h +++ b/src/Context/InstallationContext.h @@ -113,8 +113,6 @@ public: Tizen::Base::Collection::ArrayList* __pPrivilegeList; Tizen::Base::Collection::ArrayList* __pStringPrivilegeList; Tizen::Base::Collection::ArrayList* __pContentDataList; - Tizen::Security::Cert::X509CertificatePath* __pAuthorCertPath; - Tizen::Security::Cert::X509CertificatePath* __pDistributorCertPath; Tizen::Base::Collection::ArrayListT<Tizen::Base::String *>* __pAuthorCertList; Tizen::Base::Collection::ArrayListT<Tizen::Base::String *>* __pDistributorCertList; diff --git a/src/Manager/DeviceManager.cpp b/src/Manager/DeviceManager.cpp deleted file mode 100755 index 5ecfb40..0000000 --- a/src/Manager/DeviceManager.cpp +++ /dev/null @@ -1,315 +0,0 @@ -// -// 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 DeviceManager.cpp - * @brief This is the implementation file for %DeviceManager class. - */ - -#include <dlfcn.h> -#include <unique_ptr.h> - -#include <FIoRegistry.h> -#include <FBase_StringConverter.h> - -#include "DeviceManager.h" -#include "InstallerDefs.h" - -using namespace Tizen::Base; -using namespace Tizen::Base::Collection; -using namespace Tizen::Io; - -DeviceManager::DeviceManager(void) -:__pContext(null) -,__isMdmEnable(false) -{ - if (IsMdmEnable() == true) - { - __isMdmEnable = true; - } -} - -DeviceManager::~DeviceManager(void) -{ - if (__isMdmEnable == true) - { - ReleaseService(); - } -} - -bool -DeviceManager::Construct(InstallationContext* pContext) -{ - __pContext = pContext; - - return true; -} - -bool -DeviceManager::IsInstallationDisabled() const -{ - if (__isMdmEnable == false) - { - return false; - } - - TryReturn(__pContext, false, "__pContext is null."); - TryReturn(__pContext->__packageId.IsEmpty() == false, false, "packageId is empty."); - - std::unique_ptr<char[]> pPackageId(_StringConverter::CopyToCharArrayN(__pContext->__packageId)); - TryReturn(pPackageId, false, "pPackageId is null."); - - int res = IsInstallationDisabled(pPackageId.get()); - if (res == 1) - { - AppLog("[%s] can't be installed.", pPackageId.get()); - return true; - } - else - { - AppLog("[%s] can be installed.", pPackageId.get()); - return false; - } -} - -bool -DeviceManager::IsUninstallationDisabled() const -{ - if (__isMdmEnable == false) - { - return false; - } - - TryReturn(__pContext, false, "__pContext is null."); - TryReturn(__pContext->__packageId.IsEmpty() == false, false, "packageId is empty."); - - std::unique_ptr<char[]> pPackageId(_StringConverter::CopyToCharArrayN(__pContext->__packageId)); - TryReturn(pPackageId, false, "pPackageId is null."); - - int res = IsUninstallationDisabled(pPackageId.get()); - if (res == 1) - { - AppLog("[%s] can't be uninstalled.", pPackageId.get()); - return true; - } - else - { - AppLog("[%s] can be uninstalled.", pPackageId.get()); - return false; - } -} - -bool -DeviceManager::IsPrivilegeBlacklist() const -{ - if (__isMdmEnable == false) - { - return true; - } - - TryReturn(__pContext, false, "__pContext is null."); - TryReturn(__pContext->__pPrivilegeList, false, "pPrivilegeList is null."); - - return IsPrivilegeBlacklist(__pContext->__pPrivilegeList); -} - -bool -DeviceManager::IsSignatureBlacklist() const -{ - if (__isMdmEnable == false) - { - return true; - } - - TryReturn(__pContext, false, "__pContext is null."); - TryReturn(__pContext->__pAuthorCertList, false, "pAuthorCertList is null."); - - return IsSignatureBlacklist(__pContext->__pAuthorCertList); -} - -bool -DeviceManager::IsMdmEnable() const -{ - result r; - Registry reg; - String section(L"feature"); - String entry(L"mdm"); - String value; - - r = reg.Construct(CONFIG_PATH, "r"); - TryReturn(!IsFailed(r), false, "CONFIG file is not found."); - - r = reg.GetValue(section, entry, value); - TryReturn(!IsFailed(r), false, "GetValue is failed. entry = [%ls]", entry.GetPointer()); - - AppLog("[%ls is %ls.]", entry.GetPointer(), value.GetPointer()); - - if (value == L"on") - { - if (GetService() == 0) - { - return true; - } - } - - return false; -} - -int -DeviceManager::GetService() const -{ - int ret = 0; - void* pHandle = null; - char* pErrorMsg = null; - int (*mdm_get_service)(void) = null; - - pHandle = dlopen("/usr/lib/libmdm.so.1", RTLD_LAZY | RTLD_GLOBAL); - if (!pHandle) - { - AppLog("dlopen() failed. [%s]", dlerror()); - return -1; - } - - mdm_get_service = reinterpret_cast <int (*)(void)>(dlsym(pHandle, "mdm_get_service")); - pErrorMsg = dlerror(); - if ((pErrorMsg != null) || (mdm_get_service == null)) - { - AppLog("dlsym() failed. [%s]", pErrorMsg); - dlclose(pHandle); - return -1; - } - - AppLog("[mdm] mdm_get_service()"); - ret = mdm_get_service(); - AppLog("[mdm] mdm_get_service, result = [%d]", ret); - - dlclose(pHandle); - - return ret; -} - -int -DeviceManager::ReleaseService() const -{ - int ret = 0; - void* pHandle = null; - char* pErrorMsg = null; - int (*mdm_release_service)(void) = null; - - pHandle = dlopen("/usr/lib/libmdm.so.1", RTLD_LAZY | RTLD_GLOBAL); - if (!pHandle) - { - AppLog("dlopen() failed. [%s]", dlerror()); - return -1; - } - - mdm_release_service = reinterpret_cast <int (*)(void)>(dlsym(pHandle, "mdm_release_service")); - pErrorMsg = dlerror(); - if ((pErrorMsg != null) || (mdm_release_service == null)) - { - AppLog("dlsym() failed. [%s]", pErrorMsg); - dlclose(pHandle); - return -1; - } - - AppLog("[mdm] mdm_release_service()"); - ret = mdm_release_service(); - AppLog("[mdm] mdm_release_service, result = [%d]", ret); - - dlclose(pHandle); - - return ret; -} - -int -DeviceManager::IsInstallationDisabled(const char* pPackageId) const -{ - int ret = 0; - void* pHandle = null; - char* pErrorMsg = null; - int (*mdm_get_application_installation_disabled)(const char*) = null; - - pHandle = dlopen("/usr/lib/libmdm.so.1", RTLD_LAZY | RTLD_GLOBAL); - if (!pHandle) - { - AppLog("dlopen() failed. [%s]", dlerror()); - return -1; - } - - mdm_get_application_installation_disabled = reinterpret_cast <int (*)(const char*)>(dlsym(pHandle, "mdm_get_application_installation_disabled")); - pErrorMsg = dlerror(); - if ((pErrorMsg != null) || (mdm_get_application_installation_disabled == null)) - { - AppLog("dlsym() failed. [%s]", pErrorMsg); - dlclose(pHandle); - return -1; - } - - AppLog("[mdm] mdm_get_application_installation_disabled(%s)", pPackageId); - ret = mdm_get_application_installation_disabled(pPackageId); - AppLog("[mdm] mdm_get_application_installation_disabled(%s), result = [%d]", pPackageId, ret); - - dlclose(pHandle); - - return ret; -} - -int -DeviceManager::IsUninstallationDisabled(const char* pPackageId) const -{ - int ret = 0; - void* pHandle = null; - char* pErrorMsg = null; - int (*mdm_get_application_uninstallation_disabled)(const char*) = null; - - pHandle = dlopen("/usr/lib/libmdm.so.1", RTLD_LAZY | RTLD_GLOBAL); - if (!pHandle) - { - AppLog("dlopen() failed. [%s]", dlerror()); - return -1; - } - - mdm_get_application_uninstallation_disabled = reinterpret_cast <int (*)(const char*)>(dlsym(pHandle, "mdm_get_application_uninstallation_disabled")); - pErrorMsg = dlerror(); - if ((pErrorMsg != null) || (mdm_get_application_uninstallation_disabled == null)) - { - AppLog("dlsym() failed. [%s]", pErrorMsg); - dlclose(pHandle); - return -1; - } - - AppLog("[mdm] mdm_get_application_uninstallation_disabled(%s)", pPackageId); - ret = mdm_get_application_uninstallation_disabled(pPackageId); - AppLog("[mdm] mdm_get_application_uninstallation_disabled(%s), result = [%d]", pPackageId, ret); - - dlclose(pHandle); - - return ret; -} - -bool -DeviceManager::IsPrivilegeBlacklist(ArrayList* pPrivilegeList) const -{ - //mdm_data_t *mdm_get_app_privilege_blacklist(void); - return true; -} - -bool -DeviceManager::IsSignatureBlacklist(IListT<String *>* pSignatureList) const -{ - //mdm_data_t *mdm_get_app_signature_blacklist(void); - return true; -} diff --git a/src/Manager/DeviceManager.h b/src/Manager/DeviceManager.h deleted file mode 100755 index 5a9f731..0000000 --- a/src/Manager/DeviceManager.h +++ /dev/null @@ -1,57 +0,0 @@ -// -// 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 DeviceManager.h - * @brief This is the header file for the %DeviceManager class. - * - * This header file contains the declarations of the %DeviceManager class. - */ -#ifndef _DEVICE_MANAGER_H_ -#define _DEVICE_MANAGER_H_ - -#include "InstallationContext.h" - -class DeviceManager -{ -public: - DeviceManager(void); - virtual ~DeviceManager(void); - bool Construct(InstallationContext* pContext); - - bool IsInstallationDisabled() const; - bool IsUninstallationDisabled() const; - bool IsPrivilegeBlacklist() const; - bool IsSignatureBlacklist() const; - -private: - bool IsMdmEnable() const; - int GetService() const; - int ReleaseService() const; - - int IsInstallationDisabled(const char* pPackageId) const; - int IsUninstallationDisabled(const char* pPackageId) const; - bool IsPrivilegeBlacklist(Tizen::Base::Collection::ArrayList* pPrivilegeList) const; - bool IsSignatureBlacklist(Tizen::Base::Collection::IListT<Tizen::Base::String *>* pSignatureList) const; - -private: - InstallationContext* __pContext; - bool __isMdmEnable; - - -}; // DeviceManager - -#endif // _DEVICE_MANAGER_H_ diff --git a/src/Manager/SignatureManager.cpp b/src/Manager/SignatureManager.cpp index 395c51c..0be9055 100755 --- a/src/Manager/SignatureManager.cpp +++ b/src/Manager/SignatureManager.cpp @@ -43,19 +43,11 @@ using namespace Tizen::Security::Cert; SignatureManager::SignatureManager(void) :__pContext(null) -//,__pAuthorSignature(null) -//,__pDistributorSignature(null) -//,__pAuthorCertPath(null) -//,__pDistributorCertPath(null) { } SignatureManager::~SignatureManager(void) { -// delete __pAuthorSignature; -// delete __pDistributorSignature; -// delete __pAuthorCertPath; -// delete __pDistributorCertPath; } bool @@ -473,116 +465,6 @@ SignatureManager::GetPrivilegeLevel(int apiVisibility) return PRIVILEGE_LEVEL_PUBLIC; } -#if 0 -bool -SignatureManager::SetSignature() -{ - TryReturn(__pContext, false, "__pContext is null."); - - bool ret = true; - char* pSignaturePath = _StringConverter::CopyToCharArrayN(__pContext->GetSignatureXmlPath()); - char* pAuthorSignaturePath = _StringConverter::CopyToCharArrayN(__pContext->GetAuthorSignatureXmlPath()); - - __pDistributorSignature = new (std::nothrow) SignatureHandler; - TryCatch(__pDistributorSignature, ret = false, "__pDistributorSignature is null"); - - ret = __pDistributorSignature->Construct(__pContext); - TryCatch(ret == true, ret = false, "__pDistributorSignature->Construct is failed."); - - ret = __pDistributorSignature->Parse(pSignaturePath); - TryCatch(ret == true, ret = false, "__pDistributorSignature->Parse is failed."); - - __pAuthorSignature = new (std::nothrow) SignatureHandler; - TryCatch(__pAuthorSignature, ret = false, "__pAuthorSignature is null"); - - ret = __pAuthorSignature->Construct(__pContext); - TryCatch(ret == true, ret = false, "__pAuthorSignature->Construct is failed."); - - ret = __pAuthorSignature->Parse(pAuthorSignaturePath); - TryCatch(ret == true, ret = false, "__pAuthorSignature->Parse is failed."); - -CATCH: - delete[] pSignaturePath; - delete[] pAuthorSignaturePath; - return ret; -} - -bool -SignatureManager::AddCert() -{ - TryReturn(__pAuthorSignature, false, "__pAuthorSignature is null."); - TryReturn(__pDistributorSignature, false, "__pDistributorSignature is null."); - - bool ret = true; - IList* pAuthorCertChain = __pAuthorSignature->GetAuthorCertChain(); - IList* pDistributorCertChain = __pDistributorSignature->GetDistributorCertChain(); - - if (pAuthorCertChain) - { - AppLog("AddCertificate - AuthorCertChain"); - - __pAuthorCertPath = new (std::nothrow) X509CertificatePath(); - TryCatch(__pAuthorCertPath, ret = false, "__pAuthorCertPath is null."); - - ret = AddCertificate(__pAuthorCertPath, pAuthorCertChain); - TryCatch(ret == true, ret = false, "AddCertificate(AuthorCert) is failed."); - - ret = AddAuthorRootCert(__pAuthorCertPath); - TryCatch(ret == true, ret = false, "AddAuthorRootCert(AuthorCertPath) is failed."); - } - - if (pDistributorCertChain) - { - AppLog("AddCertificate - DistributorCert"); - - __pDistributorCertPath = new (std::nothrow) X509CertificatePath(); - TryCatch(__pDistributorCertPath, ret = false, "__pDistributorCertPath is null."); - - ret = AddCertificate(__pDistributorCertPath, pDistributorCertChain); - TryCatch(ret == true, ret = false, "AddCertificate(DistributorCert) is failed."); - - ret = AddDistributorRootCert(__pDistributorCertPath); - TryCatch(ret == true, ret = false, "AddDistributorRootCert(DistributorCert) is failed."); - } - -CATCH: - return ret; -} - -bool -SignatureManager::VerifyChain() -{ - TryReturn(__pAuthorCertPath, false, "__pAuthorCertPath is null."); - TryReturn(__pDistributorCertPath, false, "__pDistributorCertPath is null."); - - bool ret = true; - - AppLog("AuthorCert Validate - START"); - ret = Validate(__pAuthorCertPath); - AppLog("AuthorCert Validate - END"); - TryCatch(ret == true, ret = false, "Validate(AuthorCert) is failed."); - - SetCertificatePath(SIGNATURE_FILE_TYPE_AUTHOR, __pAuthorCertPath); - __pAuthorCertPath = null; - - AppLog("DistributorCert Validate - START"); - ret = Validate(__pDistributorCertPath); - AppLog("DistributorCert Validate - END"); - TryCatch(ret == true, ret = false, "Validate(DistributorCert) is failed."); - - SetCertificatePath(SIGNATURE_FILE_TYPE_DISTRIBUTOR, __pDistributorCertPath); - __pDistributorCertPath = null; - -CATCH: - delete __pAuthorCertPath; - __pAuthorCertPath = null; - delete __pDistributorCertPath; - __pDistributorCertPath = null; - - return ret; -} -#endif - bool SignatureManager::SetAuthorCertValue(void* pHandle, IListT<String *>* pCertList) const { @@ -711,52 +593,6 @@ SignatureManager::SetDistributorCertValue(void* pHandle, IListT<String *>* pCert } bool -SignatureManager::SetCertificatePath(SignatureFileType type, X509CertificatePath* pCertPath) -{ - TryReturn(pCertPath, false, "pCertPath is null."); - TryReturn(__pContext, false, "__pContext is null."); - - IListT<String *>* pList = null; - - if (type == SIGNATURE_FILE_TYPE_AUTHOR) - { - pList = __pContext->__pAuthorCertList; - } - else if (type == SIGNATURE_FILE_TYPE_DISTRIBUTOR) - { - pList = __pContext->__pDistributorCertList; - } - else if (type == SIGNATURE_FILE_TYPE_DISTRIBUTOR2) - { - pList = __pContext->__pDistributorCertList2; - } - else - { - TryReturn(0, false, "SignatureFileType is unknown, type = [%d]", (int)type); - } - - for (int i = 0; i < pCertPath->GetLength(); i++) - { - std::unique_ptr<ICertificate> pCert(pCertPath->GetCertificateN(i)); - TryReturn(pCert, false, "pCert is null, [%i].", i); - - bool res = false; - String certValue; - res = GetCertValue(pCert.get(), certValue); - TryReturn(res == true, false, "GetCertValue() is failed, [%d].", i); - - result r = pList->Add(new String(certValue)); - TryReturn(!IsFailed(r), false, "pList->Add() is failed, [%d]", i); - - AppLog("------------------------------------------"); - AppLog("CertValue[%d], certType[%d]", i, (int)type); - AppLog("[%ls]", certValue.GetPointer()); - } - - return true; -} - -bool SignatureManager::GetCertValue(ICertificate* pCert, String& value) const { result r = E_SUCCESS; @@ -860,224 +696,3 @@ SignatureManager::Validate(X509CertificatePath* pCertPath) return true; } - -#if 0 -bool -SignatureManager::AddCertificate(X509CertificatePath* pCertPath, IList* pCertChain) -{ - TryReturn(pCertChain, false, "pCertChain is null."); - - bool ret = true; - result r = E_SUCCESS; - X509Certificate* pCertificate = null; - - for (int i = 0; i < pCertChain->GetCount(); i++) - { - Tizen::Base::ByteBuffer* pByteBuffer = dynamic_cast <ByteBuffer*>(pCertChain->GetAt(i)); - - if (pByteBuffer) - { - AppLog("[cert][%d]", i); - - pCertificate = new (std::nothrow) X509Certificate; - TryCatch(pCertificate, ret = false, "pCertificate is null."); - - r = pCertificate->Construct(*pByteBuffer); - TryCatch(!IsFailed(r), ret = false, "pCertificate->Construct() is failed."); - - r = pCertPath->AddCertificate(*pCertificate); - TryCatch(!IsFailed(r), ret = false, "AddCertificate is failed."); - - delete pCertificate; - pCertificate = null; - } - } - -CATCH: - delete pCertificate; - return ret; -} - -bool -SignatureManager::AddAuthorRootCert(X509CertificatePath* pCertPath) -{ - TryReturn(pCertPath, false, "pCertPath is null."); - - result r = E_SUCCESS; - bool ret = true; - ByteBuffer byteBuffer; - X509Certificate rootCert; - int length = 0; - const char* pAuthorRootCert = "MIICnzCCAggCCQCn+GGT4zh+BjANBgkqhkiG9w0BAQUFADCBkzELMAkGA1UEBhMC" - "S1IxDjAMBgNVBAgMBVN1d29uMQ4wDAYDVQQHDAVTdXdvbjEWMBQGA1UECgwNVGl6" - "ZW4gVGVzdCBDQTElMCMGA1UECwwcVGl6ZW4gVGVzdCBEZXZlbG9wZXIgUm9vdCBD" - "QTElMCMGA1UEAwwcVGl6ZW4gVGVzdCBEZXZlbG9wZXIgUm9vdCBDQTAeFw0xMjEw" - "MjYwOTUwMTNaFw0yMjEwMjQwOTUwMTNaMIGTMQswCQYDVQQGEwJLUjEOMAwGA1UE" - "CAwFU3V3b24xDjAMBgNVBAcMBVN1d29uMRYwFAYDVQQKDA1UaXplbiBUZXN0IENB" - "MSUwIwYDVQQLDBxUaXplbiBUZXN0IERldmVsb3BlciBSb290IENBMSUwIwYDVQQD" - "DBxUaXplbiBUZXN0IERldmVsb3BlciBSb290IENBMIGfMA0GCSqGSIb3DQEBAQUA" - "A4GNADCBiQKBgQDWT6ZH5JyGadTUK1QmNwU8j+py4WtuElJE+4/wPFP8/KBmvvmI" - "rGVjhUbKXToKIo8N6C/0SLxGEWuRAIoZHhg5JVbw1Ay7smgJJHizDUAqMTmV6LI9" - "yTFbBV+OlO2Dir4LVdQ/XDBiqqslr7pqXgsg1V2g7x+tOI/f3dn2kWoVZQIDAQAB" - "MA0GCSqGSIb3DQEBBQUAA4GBADGJYMtzUBDK+KKLZQ6zYmrKb+OWLlmEr/t/c2af" - "KjTKUtommcz8VeTPqrDBOwxlVPdxlbhisCYzzvwnWeZk1aeptxxU3kdW9N3/wocN" - "5nBzgqkkHJnj/ptqjrH2v/m0Z3hBuI4/akHIIfCBF8mUHwqcxYsRdcCIrkgp2Aiv" - "bSaM"; - - length = strlen(pAuthorRootCert); - byteBuffer.Construct(length); - - r = byteBuffer.SetArray((byte*)pAuthorRootCert, 0, length); - TryCatch(!IsFailed(r), ret = false, "SetArray() is failed."); - - byteBuffer.Flip(); - - r = rootCert.Construct(byteBuffer); - TryCatch(!IsFailed(r), ret = false, "rootCert.Construct() is failed."); - - r = pCertPath->AddCertificate(rootCert); - TryCatch(!IsFailed(r), ret = false, "AddCertificate(AuthorRootCert) is failed."); - -CATCH: - return ret; -} - -bool -SignatureManager::AddDistributorRootCert(X509CertificatePath* pCertPath) -{ - TryReturn(pCertPath, false, "pCertPath is null."); - - result r = E_SUCCESS; - bool ret = true; - ICertificate* pIntermediateCA = null; - String issuer; - - pIntermediateCA = pCertPath->GetCertificateN(1); - TryCatch(pIntermediateCA, ret = false, "pIntermediateCA is null."); - - issuer = pIntermediateCA->GetIssuer(); - - for(int certType = ROOT_CERTIFICATE_PUBLIC; certType <= ROOT_CERTIFICATE_PARTNER_MANUFACTURER; certType++) - { - const char* pRootCert = null; - ByteBuffer byteBuffer; - X509Certificate rootCert; - int length = 0; - - if (certType == ROOT_CERTIFICATE_PUBLIC) - { - pRootCert = "MIICozCCAgwCCQD9XW6kNg4bbjANBgkqhkiG9w0BAQUFADCBlTELMAkGA1UEBhMC" - "S1IxDjAMBgNVBAgMBVN1d29uMQ4wDAYDVQQHDAVTdXdvbjEWMBQGA1UECgwNVGl6" - "ZW4gVGVzdCBDQTEjMCEGA1UECwwaVFRpemVuIERpc3RyaWJ1dG9yIFRlc3QgQ0Ex" - "KTAnBgNVBAMMIFRpemVuIFB1YmxpYyBEaXN0cmlidXRvciBSb290IENBMB4XDTEy" - "MTAyNjA4MDAyN1oXDTIyMTAyNDA4MDAyN1owgZUxCzAJBgNVBAYTAktSMQ4wDAYD" - "VQQIDAVTdXdvbjEOMAwGA1UEBwwFU3V3b24xFjAUBgNVBAoMDVRpemVuIFRlc3Qg" - "Q0ExIzAhBgNVBAsMGlRUaXplbiBEaXN0cmlidXRvciBUZXN0IENBMSkwJwYDVQQD" - "DCBUaXplbiBQdWJsaWMgRGlzdHJpYnV0b3IgUm9vdCBDQTCBnzANBgkqhkiG9w0B" - "AQEFAAOBjQAwgYkCgYEA8o0kPY1U9El1BbBUF1k4jCq6mH8a6MmDJdjgsz+hILAY" - "sPWimRTXUcW8GAUWhZWgm1Fbb49xWcasA8b4bIJabC/6hLb8uWiozzpRXyQJbe7k" - "//RocskRqDmFOky8ANFsCCww72/Xbq8BFK1sxlGdmOWQiGwDWBDlS2Lw1XOMqb0C" - "AwEAATANBgkqhkiG9w0BAQUFAAOBgQBUotZqTNFr+SNyqeZqhOToRsg3ojN1VJUa" - "07qdlVo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hQeV3EADh6ft/lE8nalzAl9tALTxAmLtYvEYA7thvDoKi1k7bN48izL" - "gS9G4WEAUg=="; - } - else if (certType == ROOT_CERTIFICATE_PARTNER_OPERATOR) - { - pRootCert = "MIICzDCCAjWgAwIBAgIJAJrv22F9wyp/MA0GCSqGSIb3DQEBBQUAMIGeMQswCQYD" - "VQQGEwJLUjEOMAwGA1UECAwFU3V3b24xDjAMBgNVBAcMBVN1d29uMRYwFAYDVQQK" - "DA1UaXplbiBUZXN0IENBMSIwIAYDVQQLDBlUaXplbiBEaXN0cmlidXRvciBUZXN0" - "IENBMTMwMQYDVQQDDCpUaXplbiBQYXJ0bmVyLU9wZXJhdG9yIERpc3RyaWJ1dG9y" - "IFJvb3QgQ0EwHhcNMTIxMjEzMDUzOTMyWhcNMjIxMjExMDUzOTMyWjCBnjELMAkG" - "A1UEBhMCS1IxDjAMBgNVBAgMBVN1d29uMQ4wDAYDVQQHDAVTdXdvbjEWMBQGA1UE" - "CgwNVGl6ZW4gVGVzdCBDQTEiMCAGA1UECwwZVGl6ZW4gRGlzdHJpYnV0b3IgVGVz" - "dCBDQTEzMDEGA1UEAwwqVGl6ZW4gUGFydG5lci1PcGVyYXRvciBEaXN0cmlidXRv" - "ciBSb290IENBMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC9X0Hw0EfAuagg" - "De9h6Jtvh8Df4fyVbvLm9VNea/iVP3/qTbG8tNqoQ32lu0SwzAZBnjpvpbxzsWs9" - "pSYo7Ys1fymHlu+gf+kmTGTVscBrAHWkr4O0m33x2FYfy/wmu+IImnRDYDud83rN" - "tjQmMO6BihN9Lb6kLiEtVIa8ITwdQwIDAQABoxAwDjAMBgNVHRMEBTADAQH/MA0G" - "CSqGSIb3DQEBBQUAA4GBAHS2M2UnfEsZf80/sT84xTcfASXgpFL/1M5HiAVpR+1O" - "UwLpLyqHiGQaASuADDeGEfcIqEf8gP1SzvnAZqLx9GchbOrOKRleooVFH7PRxFBS" - "VWJ5Fq46d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qc3YtbuJHzoVu1jJ/akXU6y52D/J5CkYy2JSsV0KZuh2" - "ZeRWlV2f1Uo="; - } - - length = strlen(pRootCert); - byteBuffer.Construct(length); - - r = byteBuffer.SetArray((byte*)pRootCert, 0, length); - TryCatch(!IsFailed(r), ret = false, "SetArray() is failed."); - - byteBuffer.Flip(); - - r = rootCert.Construct(byteBuffer); - TryCatch(!IsFailed(r), ret = false, "rootCert.Construct() is failed."); - - String subject = rootCert.GetSubject(); - AppLog("------------------------------------------"); - AppLog("Issuer = [%ls]", issuer.GetPointer()); - AppLog("Subject = [%ls]", subject.GetPointer()); - AppLog("------------------------------------------"); - - if (subject == issuer) - { - AppLog("subject, issuer is matched."); - - r = pCertPath->AddCertificate(rootCert); - TryCatch(!IsFailed(r), ret = false, "AddCertificate(DistributorRootCert) is failed."); - - AppLog("AddCertificate() RootCert = [%d]", certType); - __pContext->__rootCertType = (RootCertificateType)certType; - - ret = true; - - break; - } - else - { - AppLog("subject, issuer is not matched."); - ret = false; - } - } - -CATCH: - delete pIntermediateCA; - return ret; -} -#endif diff --git a/src/Manager/SignatureManager.h b/src/Manager/SignatureManager.h index 83d9fdd..68f1360 100755 --- a/src/Manager/SignatureManager.h +++ b/src/Manager/SignatureManager.h @@ -51,10 +51,6 @@ public: int GetApiVisibility(RootCertificateType certType); int GetPrivilegeLevel(int apiVisibility); - //bool SetSignature(); - //bool AddCert(); - //bool VerifyChain(); - private: SignatureManager(const SignatureManager& value); SignatureManager& operator =(const SignatureManager& source); @@ -62,24 +58,16 @@ private: bool SetAuthorCertValue(void* pHandle, Tizen::Base::Collection::IListT<Tizen::Base::String *>* pCertList) const; bool SetDistributorCertValue(void* pHandle, Tizen::Base::Collection::IListT<Tizen::Base::String *>* pCertList, int sigFileNumber) const; - bool SetCertificatePath(SignatureFileType type, Tizen::Security::Cert::X509CertificatePath* pCertPath); bool GetCertValue(Tizen::Security::Cert::ICertificate* pCert, Tizen::Base::String& value) const; bool CompareReferences(Tizen::Base::Collection::HashMap* pDistributorRefMap, Tizen::Base::Collection::HashMap* pAuthorRefMap); bool PrintCertValue(const Tizen::Base::String& certValue) const; - // + bool Validate(Tizen::Security::Cert::X509CertificatePath* pCertPath); bool ValidateUpdate(); - //bool AddCertificate(Tizen::Security::Cert::X509CertificatePath* pCertPath, Tizen::Base::Collection::IList* pCertChain); - //bool AddDistributorRootCert(Tizen::Security::Cert::X509CertificatePath* pCertPath); - //bool AddAuthorRootCert(Tizen::Security::Cert::X509CertificatePath* pCertPath); private: InstallationContext* __pContext; -// SignatureHandler* __pAuthorSignature; -// SignatureHandler* __pDistributorSignature; -// Tizen::Security::Cert::X509CertificatePath* __pAuthorCertPath; -// Tizen::Security::Cert::X509CertificatePath* __pDistributorCertPath; }; // SignatureManager diff --git a/src/Step/SignatureStep.cpp b/src/Step/SignatureStep.cpp index 67b72af..798bd81 100755 --- a/src/Step/SignatureStep.cpp +++ b/src/Step/SignatureStep.cpp @@ -67,18 +67,6 @@ SignatureStep::Run(InstallationContext* pContext) error = OnStateSignerInit(); break; -#if 0 - case STATE_SIGNER_CERT: - AppLog("[STATE_SIGNER_CERT]"); - error = OnStateSignerCert(); - break; - - case STATE_CERT_CHAIN: - AppLog("[STATE_CERT_CHAIN]"); - error = OnStateCertChain(); - break; -#endif - case STATE_ROOT_CERT: AppLog("[STATE_ROOT_CERT]"); error = OnStateRootCert(); @@ -166,46 +154,6 @@ SignatureStep::OnStateSignerInit(void) return error; } -#if 0 -InstallerError -SignatureStep::OnStateSignerCert(void) -{ - InstallerError error = INSTALLER_ERROR_NONE; - bool ret = true; - - ret = __pSignatureManager->SetSignature(); - TryCatch(ret == true, error = INSTALLER_ERROR_SIGNATURE_INVALID, "SetSignature() failed"); - -CATCH: - GoNextState(); - return error; -} - -InstallerError -SignatureStep::OnStateCertChain(void) -{ - InstallerError error = INSTALLER_ERROR_NONE; - bool ret = true; - - ret = __pSignatureManager->AddCert(); - TryCatch(ret == true, error = INSTALLER_ERROR_CERTIFICATE_CHAIN_VERIFICATION_FAILED, "AddCert(DEVELOPER_ROOT_CERTIFICATE) failed"); - - ret = __pSignatureManager->VerifyChain(); - if (__pContext->__isPreloaded == true) - { - fprintf(stderr, " ## VerifyChain() result = [%d]\n", ret); - } - else - { - TryCatch(ret == true, error = INSTALLER_ERROR_CERTIFICATE_CHAIN_VERIFICATION_FAILED, "VerifyChain() failed"); - } - -CATCH: - GoNextState(); - return error; -} -#endif - InstallerError SignatureStep::OnStateRootCert(void) { diff --git a/src/Step/SignatureStep.h b/src/Step/SignatureStep.h index 96db371..4e7b89a 100755 --- a/src/Step/SignatureStep.h +++ b/src/Step/SignatureStep.h @@ -47,8 +47,6 @@ private: enum { STATE_SIGNER_INIT, - //STATE_SIGNER_CERT, - //STATE_CERT_CHAIN, STATE_ROOT_CERT, STATE_CONTEXT_AUDIT, STATE_DONE @@ -59,8 +57,6 @@ private: void GoNextState(void); InstallerError OnStateSignerInit(void); - //InstallerError OnStateSignerCert(void); - //InstallerError OnStateCertChain(void); InstallerError OnStateRootCert(void); InstallerError OnStateContextAudit(void); InstallerError OnStateDone(void); diff --git a/src/Step/SystemCheckStep.cpp b/src/Step/SystemCheckStep.cpp index cfc7651..98b85b6 100755 --- a/src/Step/SystemCheckStep.cpp +++ b/src/Step/SystemCheckStep.cpp @@ -29,7 +29,6 @@ #include "SystemCheckStep.h" #include "ConfigurationManager.h" #include "DatabaseManager.h" -#include "DeviceManager.h" using namespace Tizen::App; using namespace Tizen::App::Package; @@ -102,12 +101,6 @@ SystemCheckStep::OnStatePolicyCheck(void) { InstallerError error = INSTALLER_ERROR_NONE; - DeviceManager deviceManager; - deviceManager.Construct(__pContext); - - bool res = deviceManager.IsInstallationDisabled(); - TryReturn(res == false, INSTALLER_ERROR_DISABLED, "IsInstallationDisabled() failed."); - GoNextState(); return error; } diff --git a/src/Step/UninstallStep.cpp b/src/Step/UninstallStep.cpp index 02cd5b0..36d1993 100755 --- a/src/Step/UninstallStep.cpp +++ b/src/Step/UninstallStep.cpp @@ -32,7 +32,6 @@ #include "UninstallStep.h" #include "InstallerUtil.h" #include "CompatibilityManager.h" -#include "DeviceManager.h" using namespace Tizen::Base; using namespace Tizen::Base::Collection; @@ -204,12 +203,6 @@ UninstallStep::OnStatePolicyCheck(void) { InstallerError error = INSTALLER_ERROR_NONE; - DeviceManager deviceManager; - deviceManager.Construct(__pContext); - - bool res = deviceManager.IsUninstallationDisabled(); - TryReturn(res == false, INSTALLER_ERROR_DISABLED, "IsUninstallationDisabled() failed."); - GoNextState(); return error; } |