summaryrefslogtreecommitdiff
path: root/sw/qa/extras/ooxmlexport
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2017-01-17 17:55:44 +0100
committerTomaž Vajngerl <quikee@gmail.com>2017-01-18 12:03:35 +0000
commit106c642b7542d587e961774cac515611982c6f0d (patch)
tree262775390516c2b001033b95130f334f2680df3f /sw/qa/extras/ooxmlexport
parent9ac64496440bd3b284fd9d360db107835433cdab (diff)
sw: roundtrip test of OOXML decryption/encryption
Change-Id: Idea2a46a692aed666eb8dbc6185ae001d30757c2 Reviewed-on: https://gerrit.libreoffice.org/33228 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'sw/qa/extras/ooxmlexport')
-rw-r--r--sw/qa/extras/ooxmlexport/data/Encrypted_MSO2007_abc.docxbin0 -> 18432 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/data/Encrypted_MSO2010_abc.docxbin0 -> 19456 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/data/Encrypted_MSO2013_abc.docxbin0 -> 17920 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlencryption.cxx47
4 files changed, 47 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/Encrypted_MSO2007_abc.docx b/sw/qa/extras/ooxmlexport/data/Encrypted_MSO2007_abc.docx
new file mode 100644
index 000000000000..27566d4a7334
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/Encrypted_MSO2007_abc.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/data/Encrypted_MSO2010_abc.docx b/sw/qa/extras/ooxmlexport/data/Encrypted_MSO2010_abc.docx
new file mode 100644
index 000000000000..4881e351db33
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/Encrypted_MSO2010_abc.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/data/Encrypted_MSO2013_abc.docx b/sw/qa/extras/ooxmlexport/data/Encrypted_MSO2013_abc.docx
new file mode 100644
index 000000000000..28fa85c26141
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/Encrypted_MSO2013_abc.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlencryption.cxx b/sw/qa/extras/ooxmlexport/ooxmlencryption.cxx
new file mode 100644
index 000000000000..6547676d82d1
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/ooxmlencryption.cxx
@@ -0,0 +1,47 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <swmodeltestbase.hxx>
+#include <string>
+
+class Test : public SwModelTestBase
+{
+public:
+ Test() : SwModelTestBase("/sw/qa/extras/ooxmlexport/data/", "Office Open XML Text") {}
+
+protected:
+ bool mustTestImportOf(const char* filename) const override {
+ return (OString(filename).endsWith(".docx"));
+ }
+};
+
+DECLARE_SW_ROUNDTRIP_TEST(testPassword2007, "Encrypted_MSO2007_abc.docx", "abc", Test)
+{
+ // Standard encryption format, AES 128, SHA1
+ uno::Reference<text::XTextRange> xParagraph(getParagraph(1));
+ CPPUNIT_ASSERT_EQUAL(OUString("abc"), xParagraph->getString());
+}
+
+DECLARE_SW_ROUNDTRIP_TEST(testPassword2010, "Encrypted_MSO2010_abc.docx", "abc", Test)
+{
+ // Agile encryption format, AES 128, CBC, SHA1
+ uno::Reference<text::XTextRange> xParagraph(getParagraph(1));
+ CPPUNIT_ASSERT_EQUAL(OUString("abc"), xParagraph->getString());
+}
+
+DECLARE_SW_ROUNDTRIP_TEST(testPassword2013, "Encrypted_MSO2013_abc.docx", "abc", Test)
+{
+ // Agile encryption format, AES 256, CBC, SHA512
+ uno::Reference<text::XTextRange> xParagraph(getParagraph(1));
+ CPPUNIT_ASSERT_EQUAL(OUString("ABC"), xParagraph->getString());
+}
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */