File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed
library/src/main/java/network/loki/messenger/libsession_util/encrypt Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,15 @@ package network.loki.messenger.libsession_util.encrypt
3
3
import java.io.InputStream
4
4
import java.nio.ByteBuffer
5
5
6
+ /* *
7
+ * A stream for decrypting data that was encrypted using [EncryptionStream].
8
+ *
9
+ * Note that you don't need to specify the chunk size as it would have been encoded into the stream.
10
+ *
11
+ * @param inStream the underlying input stream to read encrypted data from.
12
+ * @param key the decryption key to use for decrypting data, must be 32 bytes long.
13
+ * @param autoClose whether to automatically close the underlying input stream when this stream is
14
+ */
6
15
class DecryptionStream (
7
16
private val inStream : InputStream ,
8
17
key : ByteArray ,
Original file line number Diff line number Diff line change @@ -3,6 +3,18 @@ package network.loki.messenger.libsession_util.encrypt
3
3
import java.io.OutputStream
4
4
import java.nio.ByteBuffer
5
5
6
+ /* *
7
+ * An [OutputStream] that encrypts data on the fly, using libsodium's encryption stream API.
8
+ *
9
+ * Note that you must ensure this stream is flushed at the end, or you can call [close] (which you
10
+ * should always do) to make sure all data is written out.
11
+ *
12
+ * @param out the underlying output stream to write encrypted data to.
13
+ * @param key the encryption key to use for encrypting data, must be 32 bytes long.
14
+ * @param chunkSize the size of chunks to write to the output stream. The bigger the chunk size,
15
+ * the more memory is used, but the less overhead there is for each write operation.
16
+ * @param autoClose whether to automatically close the underlying output stream when this stream is closed.
17
+ */
6
18
class EncryptionStream (
7
19
private val out : OutputStream ,
8
20
key : ByteArray ,
You can’t perform that action at this time.
0 commit comments