--- /dev/null 2016-02-10 22:13:15.924572000 +0900 +++ new/src/java.base/share/classes/java/util/zip/ZipCryption.java 2016-02-10 23:24:12.711772960 +0900 @@ -0,0 +1,71 @@ +package java.util.zip; + + +/** + * Interface for ZIP encrypt/decrypt engine. + * + * @since 1.9 + */ +interface ZipCryption { + + /** + * Calculate encription header + * + * @param e ZIP entry + * @return ZIP encryption header + */ + public byte[] getEncryptionHeader(ZipEntry e); + + /** + * Encrypt byte array. + * @param data Byte array to encrypt + * @param offset offset to start + * @param length array length + * @return Encrypted array. This instance is same to argument. + */ + public byte[] encryptBytes(byte[] data, int offset, int length); + + /** + * Encrypt byte array. + * @param data Byte array to encrypt + * @return Encrypted array. This instance is same to argument. + */ + public byte[] encryptBytes(byte[] data); + + /** + * Reset encryption engine. + */ + public void reset(); + + /** + * Get ZIP encryption header. + * @return sizeof encryption header. + */ + public int getEncryptionHeaderSize(); + + /** + * Check encryption header + * + * @param e ZipEntry + * @param encryptionHeader encryption header to be check + * @return true if this encryption header is valid. + */ + public boolean isValid(ZipEntry e, byte[] encryptionHeader); + + /** + * Decrypt byte array. + * @param data Byte array to decrypt + * @param offset offset to start + * @param length array length + * @return Decrypted array. This instance is same to argument. + */ + public byte[] decryptBytes(byte[] data, int offset, int length); + + /** + * Decrypt byte array. + * @param data Byte array to decrypt + * @return Decrypted array. This instance is same to argument. + */ + public byte[] decryptBytes(byte[] data); + +}