From ef39ef94cfe4d1c1d04901695b9a91b441108bff Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Wed, 27 Dec 2023 23:57:49 +0530 Subject: [PATCH] Revert "fix: check if passphrase is necessary before asking for it" Didn't fix the issue. This reverts commit d8f76b33e9ea74eb567a115dd63559f6b27b2fce. --- .../app/passwordstore/data/crypto/CryptoRepository.kt | 4 ---- .../app/passwordstore/ui/crypto/DecryptActivity.kt | 10 +--------- .../kotlin/app/passwordstore/crypto/CryptoHandler.kt | 6 ------ .../kotlin/app/passwordstore/crypto/PGPKeyManager.kt | 8 -------- .../passwordstore/crypto/PGPainlessCryptoHandler.kt | 6 ------ 5 files changed, 1 insertion(+), 33 deletions(-) diff --git a/app/src/main/java/app/passwordstore/data/crypto/CryptoRepository.kt b/app/src/main/java/app/passwordstore/data/crypto/CryptoRepository.kt index be3f8da3..0ce4b3e3 100644 --- a/app/src/main/java/app/passwordstore/data/crypto/CryptoRepository.kt +++ b/app/src/main/java/app/passwordstore/data/crypto/CryptoRepository.kt @@ -45,10 +45,6 @@ constructor( out: ByteArrayOutputStream, ) = withContext(dispatcherProvider.io()) { decryptPgp(password, identities, message, out) } - fun isPasswordProtected(message: ByteArrayInputStream): Boolean { - return pgpCryptoHandler.isPassphraseProtected(message) - } - suspend fun encrypt( identities: List, content: ByteArrayInputStream, diff --git a/app/src/main/java/app/passwordstore/ui/crypto/DecryptActivity.kt b/app/src/main/java/app/passwordstore/ui/crypto/DecryptActivity.kt index 56ac1fc0..9fb20af2 100644 --- a/app/src/main/java/app/passwordstore/ui/crypto/DecryptActivity.kt +++ b/app/src/main/java/app/passwordstore/ui/crypto/DecryptActivity.kt @@ -177,7 +177,7 @@ class DecryptActivity : BasePGPActivity() { } } - private suspend fun askPassphrase( + private fun askPassphrase( isError: Boolean, gpgIdentifiers: List, authResult: Result, @@ -187,14 +187,6 @@ class DecryptActivity : BasePGPActivity() { } else { finish() } - if ( - !repository.isPasswordProtected( - withContext(dispatcherProvider.io()) { File(fullPath).readBytes().inputStream() } - ) - ) { - decryptWithPassphrase(password = "", gpgIdentifiers = gpgIdentifiers) - return - } val dialog = PasswordDialog() if (isError) { dialog.setError() diff --git a/crypto/common/src/main/kotlin/app/passwordstore/crypto/CryptoHandler.kt b/crypto/common/src/main/kotlin/app/passwordstore/crypto/CryptoHandler.kt index 20a4d1d9..898cf058 100644 --- a/crypto/common/src/main/kotlin/app/passwordstore/crypto/CryptoHandler.kt +++ b/crypto/common/src/main/kotlin/app/passwordstore/crypto/CryptoHandler.kt @@ -41,10 +41,4 @@ public interface CryptoHandler