summaryrefslogtreecommitdiff
path: root/xmlsecurity/source
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2020-09-22 21:15:19 +0200
committerMiklos Vajna <vmiklos@collabora.com>2020-09-23 08:17:39 +0200
commitc18356b49ce2f2a4f097b91cb74d578f9976d4d7 (patch)
tree7906c285a6b016d278b01e6be4cd6298b0976726 /xmlsecurity/source
parent808e8a8e9e96b6c3fac3ddf291e3900a40846409 (diff)
Executable_pdfverify: use PDFSignatureHelper for signature verification
Towards making vcl::filter::PDFDocument an implementation detail of PDFSignatureHelper during signature verification: so pdfverify, cppunit tests and the UI shares more code. Change-Id: Ibb68933d754e392bce0ebbf06be8916ab3f7efdc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103214 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'xmlsecurity/source')
-rw-r--r--xmlsecurity/source/helper/pdfsignaturehelper.cxx9
1 files changed, 7 insertions, 2 deletions
diff --git a/xmlsecurity/source/helper/pdfsignaturehelper.cxx b/xmlsecurity/source/helper/pdfsignaturehelper.cxx
index 7b570e20ce2e..b49cdd3e449f 100644
--- a/xmlsecurity/source/helper/pdfsignaturehelper.cxx
+++ b/xmlsecurity/source/helper/pdfsignaturehelper.cxx
@@ -126,8 +126,13 @@ bool PDFSignatureHelper::ReadAndVerifySignature(
}
std::unique_ptr<SvStream> pStream(utl::UcbStreamHelper::CreateStream(xInputStream, true));
+ return ReadAndVerifySignatureSvStream(*pStream);
+}
+
+bool PDFSignatureHelper::ReadAndVerifySignatureSvStream(SvStream& rStream)
+{
vcl::filter::PDFDocument aDocument;
- if (!aDocument.Read(*pStream))
+ if (!aDocument.Read(rStream))
{
SAL_WARN("xmlsecurity.helper", "failed to read the document");
return false;
@@ -143,7 +148,7 @@ bool PDFSignatureHelper::ReadAndVerifySignature(
{
SignatureInformation aInfo(i);
- if (!xmlsecurity::pdfio::ValidateSignature(*pStream, aSignatures[i], aInfo, aDocument))
+ if (!xmlsecurity::pdfio::ValidateSignature(rStream, aSignatures[i], aInfo, aDocument))
SAL_WARN("xmlsecurity.helper", "failed to determine digest match");
m_aSignatureInfos.push_back(aInfo);