I have a password protected worksheet create with excel 95,97-2003 i have the password and i was trying to read this file in different ways Method 1: WorkbookFactory.create(inputStream, "password"); throws: org.apache.poi.EncryptedDocumentException: HSSF does not currently support CryptoAPI encryption Method 2: protected InputStream WorkbookProtectionUnlocker(NPOIFSFileSystem fs, String password) throws AAAAException { EncryptionInfo info; try { info = new EncryptionInfo(fs.getRoot()); } catch (IOException e) { throw new AAAException(e.getCause()); } Decryptor d = Decryptor.getInstance(info); org.apache.poi.EncryptedDocumentException: HSSF does not currently support CryptoAPI encryption also throw the same exception Method 3: org.apache.poi.hssf.record.crypto.Biff8EncryptionKey.setCurrentUserPassword("password"); Workbook wb = new HSSFWorkbook(new FileInputStream(file); same exception . Method 4: read about jxl.Workbook.getWorkbook but in this object the password is only allowed setting it to the sheet not the entire worksheet . throw this error: jxl.read.biff.PasswordException since its not possible setting the password to the worksheet . method 5 org.apache.poi.hssf.record.crypto.Biff8EncryptionKey.setCurrentUserPassword(fileInfo.getFileOptions().xlsWorkbookPasswordExpression); WorkbookFactory.create(new FileInputStream(fileInfo.getInputFile())); the same exception: org.apache.poi.EncryptedDocumentException: HSSF does not currently support CryptoAPI encryption what is the correct way of Opening HSSF workbook which is password protected ?
Can you try with a nightly? ... I have added CryptoAPI support just recently. If this fails, could you send me the file on my apache email?
Created attachment 34424 [details] Excel file with password password is 12345
Created attachment 34425 [details] Excel file 95 with password password is 12345
The "Excel file 95" is in Biff5 format, which is not supported by the HSSF classes - although there's an OldExcelExtractor class, I haven't implemented the crypto logic there. The other excel file opens just fine: Biff8EncryptionKey.setCurrentUserPassword("12345"); HSSFWorkbook wb = new HSSFWorkbook(new FileInputStream("Canada - 97-2003 Pass.xls")); With "nightly" I meant a development build: https://builds.apache.org/job/POI/lastSuccessfulBuild/artifact/build/dist/