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;
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:
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
}
} 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