FilePassRecord type of 4 is now documented as the same as 2 & 3, see bug #35897

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1636776 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nick Burch 2014-11-04 23:22:50 +00:00
parent fc89aa8af7
commit dc12c0ab12
4 changed files with 10 additions and 0 deletions

View File

@ -45,6 +45,7 @@ public final class FilePassRecord extends StandardRecord {
private static final int ENCRYPTION_OTHER_RC4 = 1;
private static final int ENCRYPTION_OTHER_CAPI_2 = 2;
private static final int ENCRYPTION_OTHER_CAPI_3 = 3;
private static final int ENCRYPTION_OTHER_CAPI_4 = 4;
private byte[] _salt;
private byte[] _encryptedVerifier;
@ -60,6 +61,7 @@ public final class FilePassRecord extends StandardRecord {
break;
case ENCRYPTION_OTHER_CAPI_2:
case ENCRYPTION_OTHER_CAPI_3:
case ENCRYPTION_OTHER_CAPI_4:
throw new EncryptedDocumentException(
"HSSF does not currently support CryptoAPI encryption");
default:

View File

@ -36,6 +36,7 @@ public class TestBiffViewer extends BaseXLSIteratingTest {
SILENT_EXCLUDED.add("43493.xls"); // HSSFWorkbook cannot open it as well
SILENT_EXCLUDED.add("password.xls");
SILENT_EXCLUDED.add("46904.xls");
SILENT_EXCLUDED.add("35897-type4.xls"); // unsupported crypto api header
SILENT_EXCLUDED.add("xor-encryption-abc.xls"); // unsupported XOR-encryption
}

View File

@ -2460,6 +2460,13 @@ public final class TestBugs extends BaseTestBugzillaIssues {
} finally {
Biff8EncryptionKey.setCurrentUserPassword(null);
}
// One using the only-recently-documented encryption header type 4,
// and the RC4 CryptoAPI encryption header structure
try {
openSample("35897-type4.xls");
fail("POI doesn't currently support the RC4 CryptoAPI encryption header structure");
} catch (EncryptedDocumentException e) {}
}
@Test

Binary file not shown.