From c9a34623724f1dce9acf902ca5bde1dba6cafb02 Mon Sep 17 00:00:00 2001 From: Fabian Henneke Date: Mon, 27 Jul 2020 08:05:35 +0200 Subject: Add specific warning for short key IDs in .gpg-id (#974) --- .../main/java/com/zeapo/pwdstore/crypto/PasswordCreationActivity.kt | 6 +++++- app/src/main/res/values/strings.xml | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'app/src/main') diff --git a/app/src/main/java/com/zeapo/pwdstore/crypto/PasswordCreationActivity.kt b/app/src/main/java/com/zeapo/pwdstore/crypto/PasswordCreationActivity.kt index 3c1757f1..45bde491 100644 --- a/app/src/main/java/com/zeapo/pwdstore/crypto/PasswordCreationActivity.kt +++ b/app/src/main/java/com/zeapo/pwdstore/crypto/PasswordCreationActivity.kt @@ -316,7 +316,11 @@ class PasswordCreationActivity : BasePgpActivity(), OpenPgpServiceConnection.OnB .filter { it.isNotBlank() } .map { line -> parseGpgIdentifier(line) ?: run { - snackbar(message = resources.getString(R.string.invalid_gpg_id)) + if (line.removePrefix("0x").matches("[a-fA-F0-9]{8}".toRegex())) { + snackbar(message = resources.getString(R.string.short_key_ids_unsupported)) + } else { + snackbar(message = resources.getString(R.string.invalid_gpg_id)) + } return@with } } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index a59d5965..9aaebf98 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -368,6 +368,7 @@ Exporting passwords… Failed to locate .gpg-id, is your store set up correctly? Found .gpg-id, but it contains an invalid key ID, fingerprint or user ID + A key ID in .gpg-id is too short, please use either long key IDs (16 characters) or fingerprints (40 characters) File name must not contain \'/\', set directory above Directory -- cgit v1.2.3