import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;
+import org.apache.poi.poifs.filesystem.DirectoryNode;
import org.apache.poi.poifs.filesystem.DocumentInputStream;
+import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.util.LittleEndian;
}
public InputStream getDataStream(POIFSFileSystem fs) throws IOException, GeneralSecurityException {
- DocumentInputStream dis = fs.createDocumentInputStream("EncryptedPackage");
+ return getDataStream(fs.getRoot());
+ }
+
+ public InputStream getDataStream(NPOIFSFileSystem fs) throws IOException, GeneralSecurityException {
+ return getDataStream(fs.getRoot());
+ }
+
+ @SuppressWarnings("unused")
+ public InputStream getDataStream(DirectoryNode dir) throws IOException, GeneralSecurityException {
+ DocumentInputStream dis = dir.createDocumentInputStream("EncryptedPackage");
- long size = dis.readLong();
+ long size = dis.readLong();
- return new CipherInputStream(dis, getCipher());
+ return new CipherInputStream(dis, getCipher());
}
}
==================================================================== */
package org.apache.poi.poifs.crypt;
+import org.apache.poi.poifs.filesystem.DirectoryNode;
import org.apache.poi.poifs.filesystem.DocumentInputStream;
+import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import java.io.IOException;
private final EncryptionVerifier verifier;
public EncryptionInfo(POIFSFileSystem fs) throws IOException {
- DocumentInputStream dis = fs.createDocumentInputStream("EncryptionInfo");
+ this(fs.getRoot());
+ }
+ public EncryptionInfo(NPOIFSFileSystem fs) throws IOException {
+ this(fs.getRoot());
+ }
+ public EncryptionInfo(DirectoryNode dir) throws IOException {
+ DocumentInputStream dis = dir.createDocumentInputStream("EncryptionInfo");
versionMajor = dis.readShort();
versionMinor = dis.readShort();