diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2017-01-17 17:55:44 +0100 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2017-01-18 12:03:35 +0000 |
commit | 106c642b7542d587e961774cac515611982c6f0d (patch) | |
tree | 262775390516c2b001033b95130f334f2680df3f /sw/qa/extras/ooxmlexport | |
parent | 9ac64496440bd3b284fd9d360db107835433cdab (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.docx | bin | 0 -> 18432 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/Encrypted_MSO2010_abc.docx | bin | 0 -> 19456 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/Encrypted_MSO2013_abc.docx | bin | 0 -> 17920 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlencryption.cxx | 47 |
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 Binary files differnew file mode 100644 index 000000000000..27566d4a7334 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/Encrypted_MSO2007_abc.docx diff --git a/sw/qa/extras/ooxmlexport/data/Encrypted_MSO2010_abc.docx b/sw/qa/extras/ooxmlexport/data/Encrypted_MSO2010_abc.docx Binary files differnew file mode 100644 index 000000000000..4881e351db33 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/Encrypted_MSO2010_abc.docx diff --git a/sw/qa/extras/ooxmlexport/data/Encrypted_MSO2013_abc.docx b/sw/qa/extras/ooxmlexport/data/Encrypted_MSO2013_abc.docx Binary files differnew file mode 100644 index 000000000000..28fa85c26141 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/Encrypted_MSO2013_abc.docx 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: */ |