diff options
author | Andreas Beeker <kiwiwings@apache.org> | 2014-12-05 20:20:23 +0000 |
---|---|---|
committer | Andreas Beeker <kiwiwings@apache.org> | 2014-12-05 20:20:23 +0000 |
commit | cce7a4180728963b772f1f5b4271923d1dcf3307 (patch) | |
tree | e2fe524ab8868f3fb9a85871279d8633e0d6dc0d /src/ooxml/testcases/org/apache/poi/poifs/crypt | |
parent | 42bb3f2194c23bffd60f7598d8055065e7c5754e (diff) | |
download | poi-cce7a4180728963b772f1f5b4271923d1dcf3307.tar.gz poi-cce7a4180728963b772f1f5b4271923d1dcf3307.zip |
XML signatures - ignore line breaks in Office 2007 .rels files
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1643415 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/ooxml/testcases/org/apache/poi/poifs/crypt')
-rw-r--r-- | src/ooxml/testcases/org/apache/poi/poifs/crypt/TestSignatureInfo.java | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/ooxml/testcases/org/apache/poi/poifs/crypt/TestSignatureInfo.java b/src/ooxml/testcases/org/apache/poi/poifs/crypt/TestSignatureInfo.java index 609a26d6b6..fe7a91bc02 100644 --- a/src/ooxml/testcases/org/apache/poi/poifs/crypt/TestSignatureInfo.java +++ b/src/ooxml/testcases/org/apache/poi/poifs/crypt/TestSignatureInfo.java @@ -23,7 +23,10 @@ ================================================================= */
package org.apache.poi.poifs.crypt;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
import java.io.File;
import java.io.FileInputStream;
@@ -109,6 +112,17 @@ public class TestSignatureInfo { }
@Test
+ public void office2007prettyPrintedRels() throws Exception {
+ OPCPackage pkg = OPCPackage.open(testdata.getFile("office2007prettyPrintedRels.docx"), PackageAccess.READ);
+ SignatureConfig sic = new SignatureConfig();
+ sic.setOpcPackage(pkg);
+ SignatureInfo si = new SignatureInfo();
+ si.setSignatureConfig(sic);
+ boolean isValid = si.verifySignature();
+ assertTrue(isValid);
+ }
+
+ @Test
public void getSignerUnsigned() throws Exception {
String testFiles[] = {
"hello-world-unsigned.docx",
@@ -222,7 +236,6 @@ public class TestSignatureInfo { public void testManipulation() throws Exception {
// sign & validate
String testFile = "hello-world-unsigned.xlsx";
- @SuppressWarnings("resource") // closed via XSSFWorkbook.close() below ?!
OPCPackage pkg = OPCPackage.open(copy(testdata.getFile(testFile)), PackageAccess.READ_WRITE);
sign(pkg, "Test", "CN=Test", 1);
@@ -523,14 +536,6 @@ public class TestSignatureInfo { si.confirmSignature();
boolean b = si.verifySignature();
assertTrue("Signature not correctly calculated for " + ha, b);
-// } catch (EncryptedDocumentException e) {
-// // see http://apache-poi.1045710.n5.nabble.com/org-apache-poi-poifs-crypt-TestSignatureInfo-failing-on-trunk-on-Java-6-tp5717032.html
-// Throwable cause = e.getCause();
-// if (cause instanceof ArrayIndexOutOfBoundsException) {
-// LOG.log(POILogger.ERROR, "ignoring AIOOBE - hopefully a SHA2 bug ...", e);
-// } else {
-// throw e;
-// }
} finally {
if (pkg != null) pkg.close();
}
|