This repository was archived by the owner on Oct 15, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed
app/src/main/java/app/passwordstore/util/services
crypto/pgpainless/src/main/kotlin/app/passwordstore/crypto Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -89,7 +89,10 @@ class PasswordExportService : Service() {
8989 val destOutputStream = contentResolver.openOutputStream(targetPasswordFile.uri)
9090
9191 if (destOutputStream != null && sourceInputStream != null ) {
92- sourceInputStream.use { source -> destOutputStream.use { dest -> source.copyTo(dest) } }
92+ sourceInputStream.copyTo(destOutputStream, 1024 )
93+
94+ sourceInputStream.close()
95+ destOutputStream.close()
9396 }
9497 }
9598 }
Original file line number Diff line number Diff line change @@ -65,7 +65,8 @@ public class PGPainlessCryptoHandler @Inject constructor() :
6565 .addDecryptionKeys(keyringCollection, protector)
6666 .addDecryptionPassphrase(Passphrase .fromPassword(passphrase))
6767 )
68- decryptionStream.use { Streams .pipeAll(it, outputStream) }
68+ Streams .pipeAll(decryptionStream, outputStream)
69+ decryptionStream.close()
6970 return @runCatching
7071 }
7172 .mapError { error ->
@@ -120,7 +121,8 @@ public class PGPainlessCryptoHandler @Inject constructor() :
120121 .setAsciiArmor(options.isOptionEnabled(PGPEncryptOptions .ASCII_ARMOR ))
121122 val encryptionStream =
122123 PGPainless .encryptAndOrSign().onOutputStream(outputStream).withOptions(producerOptions)
123- encryptionStream.use { Streams .pipeAll(plaintextStream, it) }
124+ Streams .pipeAll(plaintextStream, encryptionStream)
125+ encryptionStream.close()
124126 val result = encryptionStream.result
125127 publicKeyRingCollection.forEach { keyRing ->
126128 require(result.isEncryptedFor(keyRing)) {
You can’t perform that action at this time.
0 commit comments