Convert AttachmentCipherInputStream to kotlin.

This commit is contained in:
Greyson Parrelli
2025-06-16 17:13:23 -04:00
committed by Michelle Tang
parent 2e79e257a3
commit ee0ee98cb6
6 changed files with 445 additions and 449 deletions

View File

@@ -90,6 +90,11 @@ class PartDataSource implements DataSource {
try {
long streamLength = AttachmentCipherStreamUtil.getCiphertextLength(PaddingInputStream.getPaddedSize(attachment.size));
AttachmentCipherInputStream.StreamSupplier streamSupplier = () -> new TailerInputStream(() -> new FileInputStream(transferFile), streamLength);
if (attachment.remoteDigest == null) {
throw new InvalidMessageException("Missing digest!");
}
this.inputStream = AttachmentCipherInputStream.createForAttachment(streamSupplier, streamLength, attachment.size, decode, attachment.remoteDigest, attachment.getIncrementalDigest(), attachment.incrementalMacChunkSize, false);
} catch (InvalidMessageException e) {
throw new IOException("Error decrypting attachment stream!", e);