Browse Source

Bug 58616: Try to initialize with empty password if not done before

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1722407 13f79535-47bb-0310-9956-ffa450edef68
tags/REL_3_14_FINAL
Dominik Stadler 8 years ago
parent
commit
baee1a5599

+ 1
- 0
src/integrationtest/org/apache/poi/TestAllFiles.java View File

//EXPECTED_FAILURES.add("poifs/protected_sha512.xlsx"); //EXPECTED_FAILURES.add("poifs/protected_sha512.xlsx");
//EXPECTED_FAILURES.add("poifs/extenxls_pwd123.xlsx"); //EXPECTED_FAILURES.add("poifs/extenxls_pwd123.xlsx");
//EXPECTED_FAILURES.add("poifs/protected_agile.docx"); //EXPECTED_FAILURES.add("poifs/protected_agile.docx");
EXPECTED_FAILURES.add("spreadsheet/58616.xlsx");


// TODO: fails XMLExportTest, is this ok? // TODO: fails XMLExportTest, is this ok?
EXPECTED_FAILURES.add("spreadsheet/CustomXMLMapping-singleattributenamespace.xlsx"); EXPECTED_FAILURES.add("spreadsheet/CustomXMLMapping-singleattributenamespace.xlsx");

+ 3
- 0
src/java/org/apache/poi/poifs/crypt/standard/StandardDecryptor.java View File



_length = dis.readLong(); _length = dis.readLong();


if(getSecretKey() == null) {
verifyPassword(null);
}
// limit wrong calculated ole entries - (bug #57080) // limit wrong calculated ole entries - (bug #57080)
// standard encryption always uses aes encoding, so blockSize is always 16 // standard encryption always uses aes encoding, so blockSize is always 16
// http://stackoverflow.com/questions/3283787/size-of-data-after-aes-encryption // http://stackoverflow.com/questions/3283787/size-of-data-after-aes-encryption

+ 11
- 0
src/ooxml/testcases/org/apache/poi/poifs/crypt/TestDecryptor.java View File

import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.File; import java.io.File;
import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.security.GeneralSecurityException; import java.security.GeneralSecurityException;
import org.apache.poi.poifs.filesystem.NPOIFSFileSystem; import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
import org.apache.poi.poifs.filesystem.POIFSFileSystem; import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.util.IOUtils; import org.apache.poi.util.IOUtils;
import org.apache.poi.xssf.XSSFTestDataSamples;
import org.junit.Test; import org.junit.Test;
/** /**
zis.close(); zis.close();
fs.close(); fs.close();
} }
@Test
public void test58616() throws IOException, GeneralSecurityException {
POIFSFileSystem pfs = new POIFSFileSystem(new FileInputStream(XSSFTestDataSamples.getSampleFile("58616.xlsx")));
EncryptionInfo info = new EncryptionInfo(pfs);
Decryptor dec = Decryptor.getInstance(info);
//dec.verifyPassword(null);
dec.getDataStream(pfs);
}
} }

BIN
test-data/spreadsheet/58616.xlsx View File


Loading…
Cancel
Save