Examples of validateWorkbookPassword()


Examples of org.apache.poi.xssf.usermodel.XSSFWorkbook.validateWorkbookPassword()

        XSSFWorkbook workbook;
        String password = "test";
       
        // validate password with an actual office file (Excel 2010)
        workbook = openSampleWorkbook("workbookProtection-workbook_password_user_range-2010.xlsx");
        assertTrue(workbook.validateWorkbookPassword(password));

        // validate with another office file (Excel 2013)
        workbook = openSampleWorkbook("workbookProtection-workbook_password-2013.xlsx");
        assertTrue(workbook.validateWorkbookPassword(password));
View Full Code Here

Examples of org.apache.poi.xssf.usermodel.XSSFWorkbook.validateWorkbookPassword()

        workbook = openSampleWorkbook("workbookProtection-workbook_password_user_range-2010.xlsx");
        assertTrue(workbook.validateWorkbookPassword(password));

        // validate with another office file (Excel 2013)
        workbook = openSampleWorkbook("workbookProtection-workbook_password-2013.xlsx");
        assertTrue(workbook.validateWorkbookPassword(password));

       
        workbook = openSampleWorkbook("workbookProtection_not_protected.xlsx");

        // setting a null password shouldn't introduce the protection element
View Full Code Here

Examples of org.apache.poi.xssf.usermodel.XSSFWorkbook.validateWorkbookPassword()

        // compare the hashes
        workbook.setWorkbookPassword(password, null);
        int hashVal = CryptoFunctions.createXorVerifier1(password);
        int actualVal = Integer.parseInt(workbook.getCTWorkbook().getWorkbookProtection().xgetWorkbookPassword().getStringValue(),16);
        assertEquals(hashVal, actualVal);
        assertTrue(workbook.validateWorkbookPassword(password));
       
        // removing the password again
        workbook.setWorkbookPassword(null, null);
        assertFalse(workbook.getCTWorkbook().getWorkbookProtection().isSetWorkbookPassword());
       
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.