https://bz.apache.org/bugzilla/show_bug.cgi?id=60363
Bug ID: 60363 Summary: Missing Implementation for Encryption of XSSF Workbooks Product: POI Version: 3.14-FINAL Hardware: PC Status: NEW Severity: blocker Priority: P2 Component: POIFS Assignee: dev@poi.apache.org Reporter: sme...@gmx.de Target Milestone: --- To create a password protected workbook using Encryptor, an instance of POIFSFileSystem is required to create the encrypted data stream. There is no XSSF implementation of POIFSFileSystem and the encryption is therefore not possible. The following example illustrates the problem, an exception occures in the line where the POIFSFileSystem is created. public static void main(String[] args) { try(Workbook wb = new XSSFWorkbook()) { Sheet sheet = wb.createSheet(); Row r = sheet.createRow(0); Cell cell = r.createCell(0); cell.setCellType(Cell.CELL_TYPE_STRING); cell.setCellValue("Test"); try(ByteArrayOutputStream baos = new ByteArrayOutputStream()) { wb.write(baos); byte[] res = baos.toByteArray(); try(ByteArrayInputStream bais = new ByteArrayInputStream(res)) { try(POIFSFileSystem fileSystem = new POIFSFileSystem(bais);) // Exception here { EncryptionInfo info = new EncryptionInfo(EncryptionMode.agile); Encryptor enc = info.getEncryptor(); enc.confirmPassword("pass"); OutputStream encryptedDS = enc.getDataStream(fileSystem); OPCPackage opc = OPCPackage.open(new File("example.xlsx"), PackageAccess.READ_WRITE); opc.save(encryptedDS); opc.close(); } } } } catch(Exception e) { e.printStackTrace(); } } -- You are receiving this mail because: You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org For additional commands, e-mail: dev-h...@poi.apache.org