From 5c47570e90583458bb4d91a1f641b9ba0780e249 Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Fri, 6 Nov 2015 12:09:27 +0100 Subject: import: apply fixPgpMessage to text for import from clipboard --- .../org/sufficientlysecure/keychain/pgp/PgpHelper.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp') 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 e8d1d3111..fbda90775 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpHelper.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpHelper.java @@ -117,7 +117,7 @@ public class PgpHelper { } } - public static String getPgpContent(@NonNull CharSequence input) { + public static String getPgpMessageContent(@NonNull CharSequence input) { Log.dEscaped(Constants.TAG, "input: " + input); Matcher matcher = PgpHelper.PGP_MESSAGE.matcher(input); @@ -141,4 +141,18 @@ public class PgpHelper { } } + public static String getPgpKeyContent(@NonNull CharSequence input) { + Log.dEscaped(Constants.TAG, "input: " + input); + + Matcher matcher = PgpHelper.PGP_PUBLIC_KEY.matcher(input); + if (matcher.matches()) { + String text = matcher.group(1); + text = fixPgpMessage(text); + + Log.dEscaped(Constants.TAG, "input fixed: " + text); + return text; + } + return null; + } + } -- cgit v1.2.3