return result;
}
+
+CertificatePtr getOldAuthorSignerCertificate(DPL::String appid)
+{
+ WidgetDAOReadOnly dao(appid);
+ CertificateChainList chainList = dao.getWidgetCertificate(SIGNATURE_AUTHOR);
+
+ FOREACH(it, chainList)
+ {
+ ValidationCore::CertificateCollection chain;
+ if (false == chain.load(*it)) {
+ LogError("Chain is broken");
+ }
+
+ if (!chain.sort()) {
+ LogError("Chain failed at sorting");
+ }
+
+ ValidationCore::CertificateList list = chain.getCertificateList();
+
+ FOREACH(cert, list)
+ {
+ if (!(*cert)->isRootCert() && !(*cert)->isCA()) {
+ return *cert;
+ }
+ }
+ }
+ return CertificatePtr(NULL);
+}
} // namespace anonymous
namespace Jobs {
m_contextData(inCont)
{
AddStep(&TaskCertify::stepSignature);
+ // certi comparison determines whether the update.
+ if (true == m_contextData.existingWidgetInfo.isExist) {
+ AddStep(&TaskCertify::stepVerifyUpdate);
+ }
// Block until fixed popup issues
if (!GlobalSettings::PopupsTestModeEnabled()
using namespace ValidationCore;
LogInfo("DNS Identity match!");
// this signature is verified or widget is distributor signed
- m_contextData.wacSecurity.getAuthorCertificatePtr() =
- data.getEndEntityCertificatePtr();
+ m_contextData.wacSecurity.setAuthorCertificatePtr(data.getEndEntityCertificatePtr());
+ CertificatePtr test = m_contextData.wacSecurity.getAuthorCertificatePtr();
+
m_contextData.wacSecurity.getCertificateListRef().push_back(
toWidgetCertificateData(data, true));
m_contextData.wacSecurity.getCertificateListRef().push_back(
return ret;
}
+
+void TaskCertify::stepVerifyUpdate()
+{
+ LogInfo("Step: <<Check Update>>");
+ CertificatePtr newCertificate =
+ m_contextData.wacSecurity.getAuthorCertificatePtr();
+ CertificatePtr oldCertificate =
+ getOldAuthorSignerCertificate(m_installContext.widgetConfig.tzAppid);
+
+ if (!!newCertificate && !!oldCertificate) {
+ if (0 != newCertificate->getBase64().compare(oldCertificate->getBase64())) {
+ LogDebug("old widget's author signer certificate : " <<
+ oldCertificate->getBase64());
+ LogDebug("new widget's author signer certificate : " <<
+ newCertificate->getBase64());
+ ThrowMsg(Exceptions::InvalidPackage,
+ "Author signer certificates doesn't match \
+ between old widget and installing widget");
+ }
+ } else {
+ if (NULL == newCertificate.Get() )
+ LogDebug("@@@@ new certificate nul");
+
+ if (NULL == oldCertificate.Get() )
+ LogDebug("@@@@ old certificate nul");
+
+ if (!(NULL == newCertificate.Get() && NULL == oldCertificate.Get())) {
+ LogDebug("@@@@");
+ ThrowMsg(Exceptions::InvalidPackage,
+ "Author signer certificates doesn't match \
+ between old widget and installing widget");
+ }
+ }
+}
} //namespace WidgetInstall
} //namespace Jobs