poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n...@apache.org
Subject svn commit: r1085451 - in /poi/trunk/src/java/org/apache/poi/poifs/crypt: Decryptor.java EncryptionInfo.java
Date Fri, 25 Mar 2011 16:24:34 GMT
Author: nick
Date: Fri Mar 25 16:24:34 2011
New Revision: 1085451

URL: http://svn.apache.org/viewvc?rev=1085451&view=rev
Log:
More NPOIFS Constructor updates

Modified:
    poi/trunk/src/java/org/apache/poi/poifs/crypt/Decryptor.java
    poi/trunk/src/java/org/apache/poi/poifs/crypt/EncryptionInfo.java

Modified: poi/trunk/src/java/org/apache/poi/poifs/crypt/Decryptor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/poifs/crypt/Decryptor.java?rev=1085451&r1=1085450&r2=1085451&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/poifs/crypt/Decryptor.java (original)
+++ poi/trunk/src/java/org/apache/poi/poifs/crypt/Decryptor.java Fri Mar 25 16:24:34 2011
@@ -29,7 +29,9 @@ import javax.crypto.CipherInputStream;
 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;
 
@@ -148,10 +150,19 @@ public class Decryptor {
     }
 
     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());
     }
 }

Modified: poi/trunk/src/java/org/apache/poi/poifs/crypt/EncryptionInfo.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/poifs/crypt/EncryptionInfo.java?rev=1085451&r1=1085450&r2=1085451&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/poifs/crypt/EncryptionInfo.java (original)
+++ poi/trunk/src/java/org/apache/poi/poifs/crypt/EncryptionInfo.java Fri Mar 25 16:24:34
2011
@@ -16,7 +16,9 @@
 ==================================================================== */
 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;
@@ -33,7 +35,13 @@ public class EncryptionInfo {
     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();



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message