entry.setSize(inputLen); entry.setCompressedSize(data.length + 28); entry.setTime((new java.util.Date()).getTime()); entry.initEncryptedEntry();
entry.setSize(inputLen); entry.setCompressedSize(data.length + 28); entry.setTime((new java.util.Date()).getTime()); entry.initEncryptedEntry();
protected void add(ZipEntry zipEntry, ZipFileEntryInputStream zipData, String password) throws IOException, UnsupportedEncodingException { encrypter.init(password, 256); ExtZipEntry entry = new ExtZipEntry(zipEntry.getName()); entry.setMethod(zipEntry.getMethod()); entry.setSize(zipEntry.getSize()); entry.setCompressedSize(zipEntry.getCompressedSize() + 28); entry.setTime(zipEntry.getTime()); entry.initEncryptedEntry(); zipOS.putNextEntry(entry); // ZIP-file data contains: 1. salt 2. pwVerification 3. encryptedContent 4. authenticationCode zipOS.writeBytes(encrypter.getSalt()); zipOS.writeBytes(encrypter.getPwVerification()); byte[] data = new byte[1024]; int read = zipData.read(data); while (read != -1) { encrypter.encrypt(data, read); zipOS.writeBytes(data, 0, read); read = zipData.read(data); } byte[] finalAuthentication = encrypter.getFinalAuthentication(); if (LOG.isLoggable(Level.FINE)) { LOG.fine("finalAuthentication=" + Arrays.toString(finalAuthentication) + " at pos=" + zipOS.getWritten()); } zipOS.writeBytes(finalAuthentication); }
protected void add(ZipEntry zipEntry, ZipFileEntryInputStream zipData, String password) throws IOException, UnsupportedEncodingException { encrypter.init(password, 256); ExtZipEntry entry = new ExtZipEntry(zipEntry.getName()); entry.setMethod(zipEntry.getMethod()); entry.setSize(zipEntry.getSize()); entry.setCompressedSize(zipEntry.getCompressedSize() + 28); entry.setTime(zipEntry.getTime()); entry.initEncryptedEntry(); zipOS.putNextEntry(entry); // ZIP-file data contains: 1. salt 2. pwVerification 3. encryptedContent 4. authenticationCode zipOS.writeBytes(encrypter.getSalt()); zipOS.writeBytes(encrypter.getPwVerification()); byte[] data = new byte[1024]; int read = zipData.read(data); while (read != -1) { encrypter.encrypt(data, read); zipOS.writeBytes(data, 0, read); read = zipData.read(data); } byte[] finalAuthentication = encrypter.getFinalAuthentication(); if (LOG.isLoggable(Level.FINE)) { LOG.fine("finalAuthentication=" + Arrays.toString(finalAuthentication) + " at pos=" + zipOS.getWritten()); } zipOS.writeBytes(finalAuthentication); }
/** copy all "non-compression" attributes */ public ExtZipEntry(ExtZipEntry entry) { super(entry.getName()); setCompressedSize(entry.getCompressedSize()); setSize(entry.getSize()); setComment(entry.getComment()); setTime(entry.getTime()); setMethod(entry.getMethod()); }
/** copy all "non-compression" attributes */ public ExtZipEntry(ExtZipEntry entry) { super(entry.getName()); setCompressedSize(entry.getCompressedSize()); setSize(entry.getSize()); setComment(entry.getComment()); setTime(entry.getTime()); setMethod(entry.getMethod()); }
zipEntry.setTime( ExtZipEntry.dosToJavaTime(dosTime) );
zipEntry.setTime( ExtZipEntry.dosToJavaTime(dosTime) );