This is an automated email from the ASF dual-hosted git repository.
fanningpj pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/poi.git
The following commit(s) were added to refs/heads/trunk by this push:
new c7976440c3 Update TestRecordFactoryInputStream.java
c7976440c3 is described below
commit c7976440c35990e7ba2013cc699f9d77c05b83e6
Author: PJ Fanning <[email protected]>
AuthorDate: Fri Feb 20 15:10:26 2026 +0100
Update TestRecordFactoryInputStream.java
---
.../hssf/record/TestRecordFactoryInputStream.java | 24 +++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git
a/poi/src/test/java/org/apache/poi/hssf/record/TestRecordFactoryInputStream.java
b/poi/src/test/java/org/apache/poi/hssf/record/TestRecordFactoryInputStream.java
index cdd5c11341..a076f6dc46 100644
---
a/poi/src/test/java/org/apache/poi/hssf/record/TestRecordFactoryInputStream.java
+++
b/poi/src/test/java/org/apache/poi/hssf/record/TestRecordFactoryInputStream.java
@@ -133,6 +133,22 @@ final class TestRecordFactoryInputStream {
+ SAMPLE_WINDOW1_ENCR2
);
+ RecordFactoryInputStream rfis = createRFIS(dataCorrectDefault,
"passw0rd");
+ confirmReadInitialRecords(rfis);
+ }
+
+ @Test
+ void suppliedPasswordOKBiff8EncryptionKey() {
+ // This encoding depends on docId, password and stream position
+ final String SAMPLE_WINDOW1_ENCR2 = "3D 00 12 00"
+ + "45, B9, 90, FE, B6, C6, EC, 73, EE, 3F, 52, 45, 97, DB, E3,
C1, D6, FE";
+
+ byte[] dataCorrectDefault = HexRead.readFromString(""
+ + COMMON_HEX_DATA
+ + "C728659A C38E35E0 568A338F C3FC9D70" // correct saltHash
for supplied password (and docId/saltHash)
+ + SAMPLE_WINDOW1_ENCR2
+ );
+
Biff8EncryptionKey.setCurrentUserPassword("passw0rd");
try {
RecordFactoryInputStream rfis = createRFIS(dataCorrectDefault);
@@ -142,7 +158,6 @@ final class TestRecordFactoryInputStream {
}
}
-
/**
* makes sure the record stream starts with {@link BOFRecord}, {@link
FilePassRecord} and then {@link WindowOneRecord}
* The third record is decrypted so this method also checks its content.
@@ -157,4 +172,11 @@ final class TestRecordFactoryInputStream {
private static RecordFactoryInputStream createRFIS(byte[] data) {
return new RecordFactoryInputStream(new ByteArrayInputStream(data),
true);
}
+
+ private static RecordFactoryInputStream createRFIS(byte[] data, String
password) {
+ return new RecordFactoryInputStream(
+ new ByteArrayInputStream(data),
+ true,
+ password.toCharArray());
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]