aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorHarsh Shandilya <me@msfjarvis.dev>2022-01-09 16:19:52 +0530
committerGitHub <noreply@github.com>2022-01-09 16:19:52 +0530
commit799f1393e49955d05f68b81af26d6cfaf9beadfd (patch)
treee1da29f5c1b3807016bea5f2f1d7046e92529e53 /app
parentccb33af854132f1b35b71393ff68d24850de6960 (diff)
Make CryptoHandler use Key as the abstraction layer (#1651)
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/dev/msfjarvis/aps/ui/autofill/AutofillDecryptActivityV2.kt3
-rw-r--r--app/src/main/java/dev/msfjarvis/aps/ui/crypto/DecryptActivityV2.kt3
-rw-r--r--app/src/main/java/dev/msfjarvis/aps/ui/crypto/PasswordCreationActivityV2.kt3
3 files changed, 6 insertions, 3 deletions
diff --git a/app/src/main/java/dev/msfjarvis/aps/ui/autofill/AutofillDecryptActivityV2.kt b/app/src/main/java/dev/msfjarvis/aps/ui/autofill/AutofillDecryptActivityV2.kt
index 5e722a54..8f4578cf 100644
--- a/app/src/main/java/dev/msfjarvis/aps/ui/autofill/AutofillDecryptActivityV2.kt
+++ b/app/src/main/java/dev/msfjarvis/aps/ui/autofill/AutofillDecryptActivityV2.kt
@@ -21,6 +21,7 @@ import com.github.michaelbull.result.onFailure
import com.github.michaelbull.result.onSuccess
import com.github.michaelbull.result.runCatching
import dagger.hilt.android.AndroidEntryPoint
+import dev.msfjarvis.aps.crypto.Key
import dev.msfjarvis.aps.data.passfile.PasswordEntry
import dev.msfjarvis.aps.injection.crypto.CryptoSet
import dev.msfjarvis.aps.ui.crypto.DecryptActivityV2
@@ -132,7 +133,7 @@ class AutofillDecryptActivityV2 : AppCompatActivity() {
withContext(Dispatchers.IO) {
val outputStream = ByteArrayOutputStream()
crypto.decrypt(
- DecryptActivityV2.PRIV_KEY,
+ Key(DecryptActivityV2.PRIV_KEY.encodeToByteArray()),
DecryptActivityV2.PASS,
encryptedInput,
outputStream,
diff --git a/app/src/main/java/dev/msfjarvis/aps/ui/crypto/DecryptActivityV2.kt b/app/src/main/java/dev/msfjarvis/aps/ui/crypto/DecryptActivityV2.kt
index d7d376cc..799ca32d 100644
--- a/app/src/main/java/dev/msfjarvis/aps/ui/crypto/DecryptActivityV2.kt
+++ b/app/src/main/java/dev/msfjarvis/aps/ui/crypto/DecryptActivityV2.kt
@@ -12,6 +12,7 @@ import android.view.MenuItem
import androidx.lifecycle.lifecycleScope
import dagger.hilt.android.AndroidEntryPoint
import dev.msfjarvis.aps.R
+import dev.msfjarvis.aps.crypto.Key
import dev.msfjarvis.aps.data.passfile.PasswordEntry
import dev.msfjarvis.aps.data.password.FieldItem
import dev.msfjarvis.aps.databinding.DecryptLayoutBinding
@@ -134,7 +135,7 @@ class DecryptActivityV2 : BasePgpActivity() {
val crypto = cryptos.first { it.canHandle(fullPath) }
val outputStream = ByteArrayOutputStream()
crypto.decrypt(
- PRIV_KEY,
+ Key(PRIV_KEY.encodeToByteArray()),
PASS,
message,
outputStream,
diff --git a/app/src/main/java/dev/msfjarvis/aps/ui/crypto/PasswordCreationActivityV2.kt b/app/src/main/java/dev/msfjarvis/aps/ui/crypto/PasswordCreationActivityV2.kt
index 7bea5e49..ab5b6371 100644
--- a/app/src/main/java/dev/msfjarvis/aps/ui/crypto/PasswordCreationActivityV2.kt
+++ b/app/src/main/java/dev/msfjarvis/aps/ui/crypto/PasswordCreationActivityV2.kt
@@ -36,6 +36,7 @@ import com.google.zxing.integration.android.IntentIntegrator.QR_CODE
import com.google.zxing.qrcode.QRCodeReader
import dagger.hilt.android.AndroidEntryPoint
import dev.msfjarvis.aps.R
+import dev.msfjarvis.aps.crypto.Key
import dev.msfjarvis.aps.data.passfile.PasswordEntry
import dev.msfjarvis.aps.databinding.PasswordCreationActivityBinding
import dev.msfjarvis.aps.injection.crypto.CryptoSet
@@ -368,7 +369,7 @@ class PasswordCreationActivityV2 : BasePgpActivity() {
withContext(Dispatchers.IO) {
val outputStream = ByteArrayOutputStream()
crypto.encrypt(
- listOf(PUB_KEY),
+ listOf(Key(PUB_KEY.encodeToByteArray())),
content.byteInputStream(),
outputStream,
)