summaryrefslogtreecommitdiff
path: root/xmlsecurity/qa
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-11-04 09:13:02 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-11-04 09:13:32 +0100
commit3e610f8496a0b6ef126426b807e0af366a98b8f3 (patch)
tree52728e32275a50b2d9f61f9febb99fda49f4b9a9 /xmlsecurity/qa
parentf0167eced77657190226d24a19005a66ff7e739e (diff)
vcl: extract PDFWriter::GetDateTime() from PDFWriterImpl
And use it in xmlsecurity when signing an existing PDF. This is especially important on Windows, where the PKCS#7 blob doesn't have an (unsigned) timestamp. Change-Id: I4051dc19a43f8f8114d9f4d02309f28d6754e9ae
Diffstat (limited to 'xmlsecurity/qa')
-rw-r--r--xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx12
1 files changed, 11 insertions, 1 deletions
diff --git a/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx b/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx
index 49da58a2fbcd..5a95586e072b 100644
--- a/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx
+++ b/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx
@@ -12,6 +12,7 @@
#include <comphelper/processfactory.hxx>
#include <osl/file.hxx>
#include <test/bootstrapfixture.hxx>
+#include <tools/datetime.hxx>
#include <unotools/streamwrap.hxx>
#include <unotools/ucbstreamhelper.hxx>
@@ -152,7 +153,16 @@ void PDFSigningTest::testPDFAdd()
OUString aInURL = aSourceDir + "no.pdf";
OUString aTargetDir = m_directories.getURLFromWorkdir("/CppunitTest/xmlsecurity_pdfsigning.test.user/");
OUString aOutURL = aTargetDir + "add.pdf";
- sign(aInURL, aOutURL, 0);
+ bool bHadCertificates = sign(aInURL, aOutURL, 0);
+
+ if (bHadCertificates)
+ {
+ // Make sure the timestamp is correct.
+ std::vector<SignatureInformation> aInfos = verify(aOutURL, 1);
+ DateTime aDateTime(DateTime::SYSTEM);
+ // This was 0 (on Windows), as neither the /M key nor the PKCS#7 blob contained a timestamp.
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(aDateTime.GetYear()), aInfos[0].stDateTime.Year);
+ }
}
void PDFSigningTest::testPDFAdd2()