diff options
author | Andreas Beeker <kiwiwings@apache.org> | 2014-05-05 21:41:31 +0000 |
---|---|---|
committer | Andreas Beeker <kiwiwings@apache.org> | 2014-05-05 21:41:31 +0000 |
commit | a348d9530ff8108953e346f5048af77ce12d201d (patch) | |
tree | 004848c9890412ba79df5269872e1764e905880e /src/testcases/org/apache/poi/hssf/usermodel | |
parent | faa2a64d4af6e89b62bba899bfe1040675765a5a (diff) | |
download | poi-a348d9530ff8108953e346f5048af77ce12d201d.tar.gz poi-a348d9530ff8108953e346f5048af77ce12d201d.zip |
Bug 56486 - Add XOR obfuscation/decryption support to HSSF
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1592636 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org/apache/poi/hssf/usermodel')
-rw-r--r-- | src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java b/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java index 197531965d..3bd97827cc 100644 --- a/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java @@ -54,6 +54,7 @@ import org.apache.poi.hssf.record.aggregates.FormulaRecordAggregate; import org.apache.poi.hssf.record.aggregates.PageSettingsBlock; import org.apache.poi.hssf.record.aggregates.RecordAggregate; import org.apache.poi.hssf.record.common.UnicodeString; +import org.apache.poi.hssf.record.crypto.Biff8EncryptionKey; import org.apache.poi.poifs.filesystem.NPOIFSFileSystem; import org.apache.poi.poifs.filesystem.POIFSFileSystem; import org.apache.poi.ss.formula.ptg.Area3DPtg; @@ -2113,6 +2114,8 @@ public final class TestBugs extends BaseTestBugzillaIssues { */ @Test public void bug50833() throws Exception { + Biff8EncryptionKey.setCurrentUserPassword(null); + HSSFWorkbook wb = openSample("50833.xls"); HSSFSheet s = wb.getSheetAt(0); assertEquals("Sheet1", s.getSheetName()); @@ -2350,14 +2353,9 @@ public final class TestBugs extends BaseTestBugzillaIssues { * Normally encrypted files have BOF then FILEPASS, but * some may squeeze a WRITEPROTECT in the middle */ - @Test + @Test(expected=EncryptedDocumentException.class) public void bug51832() { - try { - openSample("51832.xls"); - fail("Encrypted file"); - } catch(EncryptedDocumentException e) { - // Good - } + openSample("51832.xls"); } @Test @@ -2480,10 +2478,15 @@ public final class TestBugs extends BaseTestBugzillaIssues { assertEquals(rstyle.getBorderBottom(), HSSFCellStyle.BORDER_DOUBLE); } - @Test(expected=EncryptedDocumentException.class) + @Test public void bug35897() throws Exception { // password is abc - openSample("xor-encryption-abc.xls"); + try { + Biff8EncryptionKey.setCurrentUserPassword("abc"); + openSample("xor-encryption-abc.xls"); + } finally { + Biff8EncryptionKey.setCurrentUserPassword(null); + } } @Test |