// Path: src/main/java/org/cryptomator/cryptolib/api/AuthenticationFailedException.java
// public class AuthenticationFailedException extends CryptoException {
// 
// 	public AuthenticationFailedException(String message) {
// 		super(message);
// 	}
// 
// 	public AuthenticationFailedException(String message, Throwable cause) {
// 		super(message, cause);
// 	}
// 
// }
// 
// Path: src/main/java/org/cryptomator/cryptolib/api/Cryptor.java
// public interface Cryptor extends Destroyable, AutoCloseable {
// 
// 	FileContentCryptor fileContentCryptor();
// 
// 	FileHeaderCryptor fileHeaderCryptor();
// 
// 	FileNameCryptor fileNameCryptor();
// 
// 	@Override
// 	void destroy();
// 
// 	/**
// 	 * Calls {@link #destroy()}.
// 	 */
// 	@Override
// 	default void close() {
// 		destroy();
// 	}
// 
// }
// 
// Path: src/main/java/org/cryptomator/cryptolib/api/FileHeader.java
// public interface FileHeader {
// 
// 	/**
// 	 * Returns the value of a currently unused 64 bit field in the file header.
// 	 * <p>
// 	 * Formerly used for storing the plaintext file size.
// 	 *
// 	 * @return 64 bit integer for future use.
// 	 * @deprecated Don't rely on this method. It may be redefined any time.
// 	 */
// 	@Deprecated
// 	long getReserved();
// 
// 	/**
// 	 * Sets the 64 bit field in the file header.
// 	 * <p>
// 	 * Formerly used for storing the plaintext file size.
// 	 *
// 	 * @param reserved 64 bit integer for future use
// 	 * @deprecated Don't rely on this method. It may be redefined any time.
// 	 */
// 	@Deprecated
// 	void setReserved(long reserved);
// 
// }


import org.cryptomator.cryptolib.api.AuthenticationFailedException;
import org.cryptomator.cryptolib.api.Cryptor;
import org.cryptomator.cryptolib.api.FileHeader;
import java.io.EOFException;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.ReadableByteChannel;
	 */
	public DecryptingReadableByteChannel(ReadableByteChannel src, Cryptor cryptor, boolean authenticate, FileHeader header, long firstChunk) {
		this.delegate = src;
		this.cryptor = cryptor;
		this.authenticate = authenticate;
		this.cleartextChunk = ByteBuffer.allocate(0); // empty buffer will trigger loadNextCleartextChunk() on first access.
		this.header = header;
		this.reachedEof = false;
		this.chunk = firstChunk;
	}

	@Override
	public boolean isOpen() {
		return delegate.isOpen();
	}

	@Override
	public void close() throws IOException {
		delegate.close();
	}

	@Override
	public synchronized int read(ByteBuffer dst) throws IOException {
		try {
			loadHeaderIfNecessary();
			if (reachedEof) {
				return -1;
			} else {
				return readInternal(dst);
			}
// Path: src/main/java/org/cryptomator/cryptolib/api/AuthenticationFailedException.java
// public class AuthenticationFailedException extends CryptoException {
// 
// 	public AuthenticationFailedException(String message) {
// 		super(message);
// 	}
// 
// 	public AuthenticationFailedException(String message, Throwable cause) {
// 		super(message, cause);
// 	}
// 
// }
// 
// Path: src/main/java/org/cryptomator/cryptolib/api/Cryptor.java
// public interface Cryptor extends Destroyable, AutoCloseable {
// 
// 	FileContentCryptor fileContentCryptor();
// 
// 	FileHeaderCryptor fileHeaderCryptor();
// 
// 	FileNameCryptor fileNameCryptor();
// 
// 	@Override
// 	void destroy();
// 
// 	/**
// 	 * Calls {@link #destroy()}.
// 	 */
// 	@Override
// 	default void close() {
// 		destroy();
// 	}
// 
// }
// 
// Path: src/main/java/org/cryptomator/cryptolib/api/FileHeader.java
// public interface FileHeader {
// 
// 	/**
// 	 * Returns the value of a currently unused 64 bit field in the file header.
// 	 * <p>
// 	 * Formerly used for storing the plaintext file size.
// 	 *
// 	 * @return 64 bit integer for future use.
// 	 * @deprecated Don't rely on this method. It may be redefined any time.
// 	 */
// 	@Deprecated
// 	long getReserved();
// 
// 	/**
// 	 * Sets the 64 bit field in the file header.
// 	 * <p>
// 	 * Formerly used for storing the plaintext file size.
// 	 *
// 	 * @param reserved 64 bit integer for future use
// 	 * @deprecated Don't rely on this method. It may be redefined any time.
// 	 */
// 	@Deprecated
// 	void setReserved(long reserved);
// 
// }


// Path: src/main/java/org/cryptomator/cryptolib/common/DecryptingReadableByteChannel.java
import org.cryptomator.cryptolib.api.AuthenticationFailedException;
import org.cryptomator.cryptolib.api.Cryptor;
import org.cryptomator.cryptolib.api.FileHeader;
import java.io.EOFException;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.ReadableByteChannel;

	 */
	public DecryptingReadableByteChannel(ReadableByteChannel src, Cryptor cryptor, boolean authenticate, FileHeader header, long firstChunk) {
		this.delegate = src;
		this.cryptor = cryptor;
		this.authenticate = authenticate;
		this.cleartextChunk = ByteBuffer.allocate(0); // empty buffer will trigger loadNextCleartextChunk() on first access.
		this.header = header;
		this.reachedEof = false;
		this.chunk = firstChunk;
	}

	@Override
	public boolean isOpen() {
		return delegate.isOpen();
	}

	@Override
	public void close() throws IOException {
		delegate.close();
	}

	@Override
	public synchronized int read(ByteBuffer dst) throws IOException {
		try {
			loadHeaderIfNecessary();
			if (reachedEof) {
				return -1;
			} else {
				return readInternal(dst);
			}
		} catch (AuthenticationFailedException e) {