From aaddd26b51a9d3a8e230a704cb33de8e9a5bcbef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Fri, 21 Feb 2014 02:31:30 +0100 Subject: verification of cleartext signatures works --- .../keychain/demo/OpenPgpProviderActivity.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'OpenPGP-Keychain-API') diff --git a/OpenPGP-Keychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/OpenPgpProviderActivity.java b/OpenPGP-Keychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/OpenPgpProviderActivity.java index ef40ee5ac..2f7f085c2 100644 --- a/OpenPGP-Keychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/OpenPgpProviderActivity.java +++ b/OpenPGP-Keychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/OpenPgpProviderActivity.java @@ -31,6 +31,7 @@ import android.widget.EditText; import android.widget.Toast; import org.openintents.openpgp.OpenPgpError; +import org.openintents.openpgp.OpenPgpSignatureResult; import org.openintents.openpgp.util.OpenPgpApi; import org.openintents.openpgp.util.OpenPgpConstants; import org.openintents.openpgp.util.OpenPgpServiceConnection; @@ -121,6 +122,18 @@ public class OpenPgpProviderActivity extends Activity { }); } + private void handleSignature(final OpenPgpSignatureResult sigResult) { + runOnUiThread(new Runnable() { + + @Override + public void run() { + Toast.makeText(OpenPgpProviderActivity.this, + sigResult.toString(), + Toast.LENGTH_LONG).show(); + } + }); + } + /** * Takes input from message or ciphertext EditText and turns it into a ByteArrayInputStream * @@ -171,6 +184,12 @@ public class OpenPgpProviderActivity extends Activity { } catch (UnsupportedEncodingException e) { Log.e(Constants.TAG, "UnsupportedEncodingException", e); } + + if (result.containsKey(OpenPgpConstants.RESULT_SIGNATURE)) { + OpenPgpSignatureResult sigResult + = result.getParcelable(OpenPgpConstants.RESULT_SIGNATURE); + handleSignature(sigResult); + } break; } case OpenPgpConstants.RESULT_CODE_USER_INTERACTION_REQUIRED: { -- cgit v1.2.3