diff options
author | Vincent Breitmoser <valodim@mugenguild.com> | 2015-08-17 12:38:46 +0200 |
---|---|---|
committer | Vincent Breitmoser <valodim@mugenguild.com> | 2015-08-17 12:38:46 +0200 |
commit | 3c8028fc88af0b6af09d453fddc779e5972a59f9 (patch) | |
tree | a4a0299847760c71443285163ea066a2e7b28a4b /OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpHelper.java | |
parent | 7004d129a8546977c450bd40931b0b774cd2025e (diff) | |
download | open-keychain-3c8028fc88af0b6af09d453fddc779e5972a59f9.tar.gz open-keychain-3c8028fc88af0b6af09d453fddc779e5972a59f9.tar.bz2 open-keychain-3c8028fc88af0b6af09d453fddc779e5972a59f9.zip |
apply fixPgpMessage to plaintext/armored decrypt input
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpHelper.java')
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpHelper.java | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpHelper.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpHelper.java index 32718fb4e..e8d1d3111 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpHelper.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpHelper.java @@ -21,6 +21,7 @@ package org.sufficientlysecure.keychain.pgp; import android.content.Context; import android.content.pm.PackageInfo; import android.content.pm.PackageManager.NameNotFoundException; +import android.support.annotation.NonNull; import android.text.TextUtils; import org.sufficientlysecure.keychain.Constants; @@ -116,32 +117,27 @@ public class PgpHelper { } } - public static String getPgpContent(CharSequence input) { - // only decrypt if clipboard content is available and a pgp message or cleartext signature - if (!TextUtils.isEmpty(input)) { - Log.dEscaped(Constants.TAG, "input: " + input); + public static String getPgpContent(@NonNull CharSequence input) { + Log.dEscaped(Constants.TAG, "input: " + input); + + Matcher matcher = PgpHelper.PGP_MESSAGE.matcher(input); + if (matcher.matches()) { + String text = matcher.group(1); + text = fixPgpMessage(text); - Matcher matcher = PgpHelper.PGP_MESSAGE.matcher(input); + Log.dEscaped(Constants.TAG, "input fixed: " + text); + return text; + } else { + matcher = PgpHelper.PGP_CLEARTEXT_SIGNATURE.matcher(input); if (matcher.matches()) { String text = matcher.group(1); - text = fixPgpMessage(text); + text = fixPgpCleartextSignature(text); Log.dEscaped(Constants.TAG, "input fixed: " + text); return text; } else { - matcher = PgpHelper.PGP_CLEARTEXT_SIGNATURE.matcher(input); - if (matcher.matches()) { - String text = matcher.group(1); - text = fixPgpCleartextSignature(text); - - Log.dEscaped(Constants.TAG, "input fixed: " + text); - return text; - } else { - return null; - } + return null; } - } else { - return null; } } |