diff options
author | Andreas Beeker <kiwiwings@apache.org> | 2014-04-21 12:16:54 +0000 |
---|---|---|
committer | Andreas Beeker <kiwiwings@apache.org> | 2014-04-21 12:16:54 +0000 |
commit | f566b57be081e6d426ef149009b808e8d06fd879 (patch) | |
tree | 3492835e1136df1db6bf8bebe1a78381861f5945 /src/testcases/org/apache/poi | |
parent | 740c46ef8451accdbbe035c968414d2d1ae71377 (diff) | |
download | poi-f566b57be081e6d426ef149009b808e8d06fd879.tar.gz poi-f566b57be081e6d426ef149009b808e8d06fd879.zip |
Some encryption fixes:
- don't rely on SecretKey object having the right algorithm set
- leave encryption-description parsing of string/stream to xmlbeans and refactor it to one location
- use namespaces of schema instead of hard-coded strings
- use CryptoFunctions.getMessageDigest() instead of code duplication
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1588874 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org/apache/poi')
-rw-r--r-- | src/testcases/org/apache/poi/ss/formula/function/ExcelFileFormatDocFunctionExtractor.java | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/testcases/org/apache/poi/ss/formula/function/ExcelFileFormatDocFunctionExtractor.java b/src/testcases/org/apache/poi/ss/formula/function/ExcelFileFormatDocFunctionExtractor.java index 4d6877f0f9..e6646ae826 100644 --- a/src/testcases/org/apache/poi/ss/formula/function/ExcelFileFormatDocFunctionExtractor.java +++ b/src/testcases/org/apache/poi/ss/formula/function/ExcelFileFormatDocFunctionExtractor.java @@ -31,7 +31,6 @@ import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; @@ -43,6 +42,8 @@ import java.util.Stack; import java.util.zip.ZipException; import java.util.zip.ZipFile; +import org.apache.poi.poifs.crypt.CryptoFunctions; +import org.apache.poi.poifs.crypt.HashAlgorithm; import org.xml.sax.Attributes; import org.xml.sax.ContentHandler; import org.xml.sax.InputSource; @@ -542,12 +543,7 @@ public final class ExcelFileFormatDocFunctionExtractor { * Helps identify the source file */ private static String getFileMD5(File f) { - MessageDigest m; - try { - m = MessageDigest.getInstance("MD5"); - } catch (NoSuchAlgorithmException e) { - throw new RuntimeException(e); - } + MessageDigest m = CryptoFunctions.getMessageDigest(HashAlgorithm.md5); byte[]buf = new byte[2048]; try { |