summaryrefslogtreecommitdiff
path: root/xmlsecurity/qa
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-11-10 08:38:31 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-11-10 10:29:14 +0100
commit9357e99450974a4bea5946129af126469199797b (patch)
tree70abceba7c2a42bdf4531f693c67a95df803a020 /xmlsecurity/qa
parent7983c946229d580ec825edbde765381035ae02f6 (diff)
xmlsecurity PDF sign: use a predictor when compressing the xref stream
With this our xref stream output is close enough to Acrobat so that the existing signature verifier runs without any problems. Change-Id: I6eca7966890365759c269b465e4bf4d86d335219
Diffstat (limited to 'xmlsecurity/qa')
-rw-r--r--xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx16
1 files changed, 16 insertions, 0 deletions
diff --git a/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx b/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx
index a6c764d6e3dd..7a8df3f4236e 100644
--- a/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx
+++ b/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx
@@ -58,6 +58,8 @@ public:
void testPDF14Adobe();
/// Test a PDF 1.6 document, signed by Adobe.
void testPDF16Adobe();
+ /// Test adding a signature to a PDF 1.6 document.
+ void testPDF16Add();
/// Test a PDF 1.4 document, signed by LO on Windows.
void testPDF14LOWin();
@@ -68,6 +70,7 @@ public:
CPPUNIT_TEST(testPDFRemoveAll);
CPPUNIT_TEST(testPDF14Adobe);
CPPUNIT_TEST(testPDF16Adobe);
+ CPPUNIT_TEST(testPDF16Add);
CPPUNIT_TEST(testPDF14LOWin);
CPPUNIT_TEST_SUITE_END();
};
@@ -270,6 +273,19 @@ void PDFSigningTest::testPDF16Adobe()
verify(m_directories.getURLFromSrc(DATA_DIRECTORY) + "pdf16adobe.pdf", 1);
}
+void PDFSigningTest::testPDF16Add()
+{
+ // Contains PDF 1.6 features, make sure we can add a signature using that
+ // markup correctly.
+ OUString aSourceDir = m_directories.getURLFromSrc(DATA_DIRECTORY);
+ OUString aInURL = aSourceDir + "pdf16adobe.pdf";
+ OUString aTargetDir = m_directories.getURLFromWorkdir("/CppunitTest/xmlsecurity_pdfsigning.test.user/");
+ OUString aOutURL = aTargetDir + "add.pdf";
+ // This failed: verification broke as incorrect xref stream was written as
+ // part of the new signature.
+ sign(aInURL, aOutURL, 1);
+}
+
void PDFSigningTest::testPDF14LOWin()
{
// mscrypto used SEC_OID_PKCS1_SHA1_WITH_RSA_ENCRYPTION as a digest