Module org.cryptomator.cryptolib
Package org.cryptomator.cryptolib.common
Class DecryptingReadableByteChannel
- java.lang.Object
-
- org.cryptomator.cryptolib.common.DecryptingReadableByteChannel
-
- All Implemented Interfaces:
Closeable,AutoCloseable,Channel,ReadableByteChannel
public class DecryptingReadableByteChannel extends Object implements ReadableByteChannel
-
-
Constructor Summary
Constructors Constructor Description DecryptingReadableByteChannel(ReadableByteChannel src, Cryptor cryptor, boolean authenticate)Creates a DecryptingReadableByteChannel that decrypts a whole ciphertext file beginning at its first byte.DecryptingReadableByteChannel(ReadableByteChannel src, Cryptor cryptor, boolean authenticate, FileHeader header, long firstChunk)Creates a DecryptingReadableByteChannel with a previously read header, allowing to start decryption at any chunk.
-
-
-
Constructor Detail
-
DecryptingReadableByteChannel
public DecryptingReadableByteChannel(ReadableByteChannel src, Cryptor cryptor, boolean authenticate)
Creates a DecryptingReadableByteChannel that decrypts a whole ciphertext file beginning at its first byte.- Parameters:
src- A ciphertext channel positioned at the begin of the file headercryptor- The cryptor to useauthenticate- Set tofalseto skip ciphertext authentication (may not be supported)
-
DecryptingReadableByteChannel
public DecryptingReadableByteChannel(ReadableByteChannel src, Cryptor cryptor, boolean authenticate, FileHeader header, long firstChunk)
Creates a DecryptingReadableByteChannel with a previously read header, allowing to start decryption at any chunk.- Parameters:
src- A ciphertext channel positioned at the beginning of the givenfirstChunkcryptor- The cryptor to useauthenticate- Set tofalseto skip ciphertext authentication (may not be supported)header- The file's headerfirstChunk- The index of the chunk at which thesrcchannel is positioned
-
-
Method Detail
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceChannel- Specified by:
closein interfaceCloseable- Throws:
IOException
-
read
public int read(ByteBuffer dst) throws IOException
- Specified by:
readin interfaceReadableByteChannel- Throws:
IOException
-
-