X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fjobs%2Fwidget_install%2Ftask_certify.cpp;h=db0ebadc55f675fa0684d26d793087c09dbf5239;hb=6c643b796dc60f4f3e2870146ddb222246bba734;hp=8670d019dee50e9ad839bf73a3c40113ace617e6;hpb=42655b8f6796ff8d3354042ec7bfe6e26808418f;p=framework%2Fweb%2Fwrt-installer.git diff --git a/src/jobs/widget_install/task_certify.cpp b/src/jobs/widget_install/task_certify.cpp index 8670d01..db0ebad 100644 --- a/src/jobs/widget_install/task_certify.cpp +++ b/src/jobs/widget_install/task_certify.cpp @@ -40,7 +40,6 @@ #include #include #include -#include #include #include @@ -132,7 +131,7 @@ TaskCertify::TaskCertify(InstallerContext &inCont) : { AddStep(&TaskCertify::stepSignature); // certi comparison determines whether the update. - if (true == m_contextData.existingWidgetInfo.isExist) { + if (true == m_contextData.isUpdateMode) { AddStep(&TaskCertify::stepVerifyUpdate); } @@ -155,10 +154,6 @@ void TaskCertify::processDistributorSignature(const SignatureData &data) // no point in check domain WAC_ROOT and WAC_RECOGNIZED m_contextData.wacSecurity.setDistributorSigned(true); - if (data.getStorageType().contains(CertStoreId::WAC_ROOT)) { - m_contextData.wacSecurity.setWacSigned(true); - } - CertificateCollection collection; collection.load(data.getCertList()); Assert(collection.sort() && @@ -234,15 +229,13 @@ void TaskCertify::stepSignature() SignatureFinder signatureFinder(widgetPath); if (SignatureFinder::NO_ERROR != signatureFinder.find(signatureFiles)) { LogError("Error in Signature Finder"); - ThrowMsg(Exceptions::InvalidPackage, + ThrowMsg(Exceptions::SignatureNotFound, "Error openig temporary widget directory"); } SignatureFileInfoSet::reverse_iterator iter = signatureFiles.rbegin(); LogInfo("Number of signatures: " << signatureFiles.size()); - bool testCertificate = false; - bool complianceMode = GlobalDAOReadOnly::getComplianceMode(); for (; iter != signatureFiles.rend(); ++iter) { @@ -286,14 +279,14 @@ void TaskCertify::stepSignature() if (result == WrtSignatureValidator::SIGNATURE_REVOKED) { LogWarning("Certificate is REVOKED"); - ThrowMsg(Exceptions::InvalidPackage, + ThrowMsg(Exceptions::CertificateExpired, "Certificate is REVOKED"); } if (result == WrtSignatureValidator::SIGNATURE_INVALID) { LogWarning("Signature is INVALID"); // TODO change exception name - ThrowMsg(Exceptions::InvalidPackage, + ThrowMsg(Exceptions::SignatureInvalid, "Invalid Package"); } @@ -314,50 +307,11 @@ void TaskCertify::stepSignature() // now signature _must_ be verified processDistributorSignature(data); } - - bool developerMode = GlobalDAOReadOnly::GetDeveloperMode(); - - std::string realMEID; - /* - TapiHandle *tapiHandle = tel_init(NULL); - char *meid = tel_get_misc_me_sn_sync(tapiHandle); - if (meid) { - realMEID = meid; - free(meid); - } - tel_deinit(tapiHandle); - */ - - DeveloperModeValidator developerModeValidator( - complianceMode, - developerMode, - GlobalDAOReadOnly::getComplianceFakeImei(), - GlobalDAOReadOnly::getComplianceFakeMeid(), - realMEID); - - developerModeValidator.check(data); - - testCertificate |= - data.getStorageType().contains(CertStoreId::DEVELOPER); - - if (testCertificate && !developerMode) { - LogError("Widget signed by test certificate, " - "but developer mode is off."); - ThrowMsg(Exceptions::InvalidPackage, - "Widget signed by test certificate, " - "but developer mode is off."); - } - m_contextData.widgetConfig.isTestWidget = testCertificate; } Catch(ParserSchemaException::Base) { LogError("Error occured in ParserSchema."); - ReThrowMsg(Exceptions::InvalidPackage, + ReThrowMsg(Exceptions::SignatureInvalid, "Error occured in ParserSchema."); } - Catch(DeveloperModeValidator::Exception::Base) { - LogError("Cannot validate developer certificate."); - ReThrowMsg(Exceptions::InvalidPackage, - "Cannot validate developer certificate."); - } } if (signatureFiles.empty()) { @@ -523,13 +477,13 @@ void TaskCertify::stepVerifyUpdate() oldCertificate->getBase64()); LogDebug("new widget's author signer certificate : " << newCertificate->getBase64()); - ThrowMsg(Exceptions::InvalidPackage, + ThrowMsg(Exceptions::NotMatchedCertification, "Author signer certificates doesn't match \ between old widget and installing widget"); } } else { if (!(NULL == newCertificate.Get() && NULL == oldCertificate.Get())) { - ThrowMsg(Exceptions::InvalidPackage, + ThrowMsg(Exceptions::NotMatchedCertification, "Author signer certificates doesn't match \ between old widget and installing widget"); }