+ ValidationCore::CertificateList certList = data.getCertList();
+ ValidationCore::CertificateList::iterator it = certList.begin();
+ ValidationCore::CertificateList::iterator it_end = certList.end();
+ for (; it != it_end; it++)
+ {
+ std::string value = (*it)->getBase64();
+
+ if (data.isAuthorSignature() == true)
+ {
+ __pContext->__pAuthorCertList->Add(new String(value.c_str()));
+ AppLog("Author cert value = [%s]", value.c_str());
+ }
+ else
+ {
+ if (sigFileNumber == SIGNATURE_FILE_NUMBER_DISTRIBUTOR)
+ {
+ __pContext->__pDistributorCertList->Add(new String(value.c_str()));
+ AppLog("Default distributor cert value = [%s]", value.c_str());
+ }
+ }
+ }
+
+ ValidationCore::SignatureValidator::Result valRes = ValidationCore::SignatureValidator::SIGNATURE_VALID;
+ ValidationCore::SignatureValidator::AppType appType = ValidationCore::SignatureValidator::TIZEN;
+ ValidationCore::SignatureValidator validator(appType, false, false, false);
+
+ std::list<std::string> uriList;
+ if (pAddedList)
+ {
+ for (int idx = 0; idx < pAddedList->GetCount(); idx++)
+ {
+ String* pFilePath = static_cast< String* >(pAddedList->GetAt(idx));
+ TryReturn(pFilePath, false, "pFilePath is null.");
+
+ std::unique_ptr<char[]> pPath(_StringConverter::CopyToCharArrayN(*pFilePath));
+ TryReturn(pPath, false, "pPath is null.");
+
+ uriList.push_back(pPath.get());
+ AppLog("added = [%s]", pPath.get());
+ }
+ }
+ if (pModifiedList)
+ {
+ for (int idx = 0; idx < pModifiedList->GetCount(); idx++)
+ {
+ String* pFilePath = static_cast< String* >(pModifiedList->GetAt(idx));
+ TryReturn(pFilePath, false, "pFilePath is null.");
+
+ std::unique_ptr<char[]> pPath(_StringConverter::CopyToCharArrayN(*pFilePath));
+ TryReturn(pPath, false, "pPath is null.");
+
+ if ((strcasecmp(pPath.get(), "author-signature.xml") != 0) &&
+ (strcasecmp(pPath.get(), "signature1.xml") != 0))
+ {
+ uriList.push_back(pPath.get());
+ AppLog("modified = [%s]", pPath.get());
+ }
+ }
+ }
+ TryReturn(uriList.size() != 0, false, "uriList.size is 0.");
+ AppLog("uriList.size = [%d]", uriList.size());
+
+ valRes = validator.checkList(data, rootPath, uriList);
+ TryReturn(valRes == ValidationCore::SignatureValidator::SIGNATURE_VERIFIED, false, "validator.checkList() is failed, valRes=[%d]", (int)valRes);
+ AppLog("Signature validator.checkList() success, file = [%s], number = [%d]", iter->getFileName().c_str(), iter->getFileNumber());
+ }
+ catch (ValidationCore::ParserSchemaException::Base)
+ {
+ if (sigFileNumber == SIGNATURE_FILE_NUMBER_DISTRIBUTOR2)
+ {
+ AppLog("ValidationCore::ParserSchemaException::Base occurred, but it's ok for DISTRIBUTOR2.");
+ continue;
+ }
+ TryReturn(0, false, "ParserSchemaException::Base exception occurred.");
+ }
+ catch (DPL::Exception)
+ {
+ if (sigFileNumber == SIGNATURE_FILE_NUMBER_DISTRIBUTOR2)
+ {
+ AppLog("DPL::Exception occurred, but it's ok for DISTRIBUTOR2.");
+ continue;
+ }
+ TryReturn(0, false, "DPL::Exception exception occurred.");
+ }
+ }
+
+ AppLog("ValidateSignatures done successfully <<");