From 7362faf542bf6dafc6c59f2883141f8f23afedb9 Mon Sep 17 00:00:00 2001 From: Duyoung Jang Date: Tue, 13 Nov 2012 12:00:07 +0900 Subject: Register ApiVisibility in package db Change-Id: I04c4eda22e7617d3ca1cbb09cbf012e24da9028a --- inc/InstallerDefs.h | 7 ++++--- src/Manager/SignatureManager.cpp | 2 +- src/Step/SignatureStep.cpp | 37 ++++++++++++++++++++++++++++++++++--- src/Step/SignatureStep.h | 2 ++ 4 files changed, 41 insertions(+), 7 deletions(-) diff --git a/inc/InstallerDefs.h b/inc/InstallerDefs.h index 3e89413..e97ab77 100755 --- a/inc/InstallerDefs.h +++ b/inc/InstallerDefs.h @@ -21,7 +21,7 @@ #ifndef _INSTALLER_DEFS_H_ #define _INSTALLER_DEFS_H_ -#define OSP_INSTALLER_VERSION "osp-installer version = [2012/11/12]_RC[1]" +#define OSP_INSTALLER_VERSION "osp-installer version = [2012/11/13]_RC[1]" #define DIR_BIN L"/bin" #define DIR_INFO L"/info" @@ -183,9 +183,10 @@ enum RootCertificateType { ROOT_CERTIFICATE_NONE, ROOT_CERTIFICATE_DEVELOPER, - ROOT_CERTIFICATE_NORMAL, + ROOT_CERTIFICATE_PUBLIC, ROOT_CERTIFICATE_PARTNER, - ROOT_CERTIFICATE_OPERATOR, + ROOT_CERTIFICATE_PARTNER_OPERATOR, + ROOT_CERTIFICATE_PARTNER_MANUFACTURER, ROOT_CERTIFICATE_PRIVATE, }; diff --git a/src/Manager/SignatureManager.cpp b/src/Manager/SignatureManager.cpp index f7b6f5c..9a90bb9 100755 --- a/src/Manager/SignatureManager.cpp +++ b/src/Manager/SignatureManager.cpp @@ -268,7 +268,7 @@ SignatureManager::AddRootCertificate(X509CertificatePath* pCertPath, RootCertifi int length = 0; const char* pRootCert = null; - if (certType == ROOT_CERTIFICATE_NORMAL) + if (certType == ROOT_CERTIFICATE_PUBLIC) { pRootCert = "MIICozCCAgwCCQD9XW6kNg4bbjANBgkqhkiG9w0BAQUFADCBlTELMAkGA1UEBhMC" "S1IxDjAMBgNVBAgMBVN1d29uMQ4wDAYDVQQHDAVTdXdvbjEWMBQGA1UECgwNVGl6" diff --git a/src/Step/SignatureStep.cpp b/src/Step/SignatureStep.cpp index ebfcd26..745e653 100755 --- a/src/Step/SignatureStep.cpp +++ b/src/Step/SignatureStep.cpp @@ -144,7 +144,7 @@ SignatureStep::OnStateCertChain(void) { InstallerError error = INSTALLER_ERROR_NONE; bool ret = true; - int rootCert = ROOT_CERTIFICATE_NORMAL; + int rootCert = ROOT_CERTIFICATE_PUBLIC; ret = __pSignatureManager->AddCert(ROOT_CERTIFICATE_DEVELOPER); TryCatch(ret == true, error = INSTALLER_ERROR_INVALID_SIGNATURE, "[osp-installer] AddCert(DEVELOPER_ROOT_CERTIFICATE) failed"); @@ -152,7 +152,7 @@ SignatureStep::OnStateCertChain(void) ret = __pSignatureManager->VerifyChain(ROOT_CERTIFICATE_DEVELOPER); TryCatch(ret == true, error = INSTALLER_ERROR_INVALID_SIGNATURE, "[osp-installer] VerifyChain(DEVELOPER_ROOT_CERTIFICATE) failed"); - for(rootCert = ROOT_CERTIFICATE_NORMAL; rootCert <= ROOT_CERTIFICATE_PRIVATE; rootCert++) + for(rootCert = ROOT_CERTIFICATE_PUBLIC; rootCert <= ROOT_CERTIFICATE_PRIVATE; rootCert++) { ret = __pSignatureManager->AddCert((RootCertificateType)rootCert); TryCatch(ret == true, error = INSTALLER_ERROR_INVALID_SIGNATURE, "[osp-installer] AddCert() failed"); @@ -189,8 +189,9 @@ SignatureStep::OnStateRootCert(void) RootCertificateType certType = __pContext->GetRootCertType(); _PackageInfoImpl* pPackageInfoImpl = __pContext->GetPackageInfoImpl(); String appId = pPackageInfoImpl->GetAppId(); + int apiVisibility = GetApiVisibility(certType); - AppLogTag(OSP_INSTALLER, "AppId = [%ls], CertType = [%d]", appId.GetPointer(), certType); + AppLogTag(OSP_INSTALLER, "AppId = [%ls], CertType = [%d], ApiVisibility = [%d]", appId.GetPointer(), certType, apiVisibility); r = PrivilegeHandler::GenerateCipherPrivilege(appId, *pPrivilegeList, certType, privileges, hmacPrivileges); if (IsFailed(r)) @@ -200,6 +201,7 @@ SignatureStep::OnStateRootCert(void) TryCatch(!IsFailed(r), error = INSTALLER_ERROR_PRIVILEGE, "[osp-installer] privMgr.GeneratePrivilegeString() failed"); pPackageInfoImpl->SetPrivilegesValue(privileges, hmacPrivileges); + pPackageInfoImpl->SetCertType(apiVisibility); CATCH: GoNextState(); @@ -214,3 +216,32 @@ SignatureStep::OnStateDone(void) GoNextState(); return error; } + +int +SignatureStep::GetApiVisibility(RootCertificateType certType) +{ + int apiVisibility = _API_VISIBILITY_NONE; + + if (certType == ROOT_CERTIFICATE_PUBLIC) + { + apiVisibility = _API_VISIBILITY_PUBLIC; + } + else if (certType == ROOT_CERTIFICATE_PARTNER) + { + apiVisibility = _API_VISIBILITY_PARTNER; + } + else if (certType == ROOT_CERTIFICATE_PARTNER_OPERATOR) + { + apiVisibility = _API_VISIBILITY_PARTNER_OPERATOR; + } + else if (certType == ROOT_CERTIFICATE_PARTNER_MANUFACTURER) + { + apiVisibility = _API_VISIBILITY_PARTNER_MANUFACTURER; + } + else if (certType == ROOT_CERTIFICATE_PRIVATE) + { + apiVisibility = _API_VISIBILITY_PRIVATE; + } + + return apiVisibility; +} diff --git a/src/Step/SignatureStep.h b/src/Step/SignatureStep.h index 6cd743b..610d888 100755 --- a/src/Step/SignatureStep.h +++ b/src/Step/SignatureStep.h @@ -61,6 +61,8 @@ private: InstallerError OnStateRootCert(void); InstallerError OnStateDone(void); + int GetApiVisibility(RootCertificateType certType); + private: int __state; InstallationContext* __pContext; -- cgit v1.2.3