List of usage examples for org.apache.poi.poifs.crypt CipherAlgorithm aes128
CipherAlgorithm aes128
To view the source code for org.apache.poi.poifs.crypt CipherAlgorithm aes128.
Click Source Link
From source file:com.github.poi.AesZipFileZipEntrySource.java
License:Apache License
public static AesZipFileZipEntrySource createZipEntrySource(InputStream is) throws IOException, GeneralSecurityException { // generate session key SecureRandom sr = new SecureRandom(); byte[] ivBytes = new byte[16], keyBytes = new byte[16]; sr.nextBytes(ivBytes);//w ww.j av a2 s.c o m sr.nextBytes(keyBytes); final File tmpFile = TempFile.createTempFile("protectedXlsx", ".zip"); copyToFile(is, tmpFile, CipherAlgorithm.aes128, keyBytes, ivBytes); IOUtils.closeQuietly(is); return fileToSource(tmpFile, CipherAlgorithm.aes128, keyBytes, ivBytes); }