/** * Encrypted files: Note that the value in the "compressed size" fields of * the local file header and the central directory entry is the total size * of all the items listed above. In other words, it is the total size of * the salt value, password verification value, encrypted data, and * authentication code. * * @return data size only */ public long getEncryptedDataSize() { // authentication (10), salt (16), verification (2) return getCompressedSize() - 10 - 16 - 2; }
/** * Encrypted files: Note that the value in the "compressed size" fields of * the local file header and the central directory entry is the total size * of all the items listed above. In other words, it is the total size of * the salt value, password verification value, encrypted data, and * authentication code. * * @return data size only */ public long getEncryptedDataSize() { // authentication (10), salt (16), verification (2) return getCompressedSize() - 10 - 16 - 2; }
/** 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()); }
protected void writeFileInfo(ExtZipEntry entry) throws IOException { writeShort(ZIP_VERSION); // version needed to extract // general purpose bit flag - 0x0001 indicates encryption 2 bytes writeShort(entry.getFlag()); writeShort(entry.getPrimaryCompressionMethod()); // primary compression // method - // 0x63==encryption writeInt(entry.getDosTime()); // 2 bytes last mod file time + 2 bytes // last mod file date writeInt(entry.getCrc()); // 28 bytes is the encryption overhead (caused by 256-bit AES key) // 2 bytes pwVerification + 16 bytes SALT + 10 bytes AUTHENTICATION writeInt((int) entry.getCompressedSize()); // compressed size writeInt((int) entry.getSize()); // uncompressed size writeShort(entry.getName().length()); // file name length if (entry.getExtra() != null) { writeShort(entry.getExtra().length); // extra field length } else { writeShort(0); } }
protected void writeFileInfo(ExtZipEntry entry) throws IOException { writeShort(ZIP_VERSION); // version needed to extract // general purpose bit flag - 0x0001 indicates encryption 2 bytes writeShort(entry.getFlag()); writeShort(entry.getPrimaryCompressionMethod()); // primary compression // method - // 0x63==encryption writeInt(entry.getDosTime()); // 2 bytes last mod file time + 2 bytes // last mod file date writeInt(entry.getCrc()); // 28 bytes is the encryption overhead (caused by 256-bit AES key) // 2 bytes pwVerification + 16 bytes SALT + 10 bytes AUTHENTICATION writeInt((int) entry.getCompressedSize()); // compressed size writeInt((int) entry.getSize()); // uncompressed size writeShort(entry.getName().length()); // file name length if (entry.getExtra() != null) { writeShort(entry.getExtra().length); // extra field length } else { writeShort(0); } }