From 7939aaaa440f84a0df5524f8a1a1c04dd569eedd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Fri, 14 Feb 2014 02:33:21 +0100 Subject: Introducing new ParcelFileDescriptor pipes --- .../keychain/demo/OpenPgpProviderActivity.java | 332 +++++++++++---------- 1 file changed, 174 insertions(+), 158 deletions(-) (limited to 'OpenPGP-Keychain-API/example-app/src/main/java') 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 4a96de5a1..81f9eee68 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 @@ -16,17 +16,6 @@ package org.sufficientlysecure.keychain.demo; -import java.util.ArrayList; -import java.util.List; - -import org.openintents.openpgp.IOpenPgpKeyIdsCallback; -import org.openintents.openpgp.OpenPgpData; -import org.openintents.openpgp.OpenPgpError; -import org.openintents.openpgp.OpenPgpServiceConnection; -import org.openintents.openpgp.OpenPgpSignatureResult; -import org.openintents.openpgp.IOpenPgpCallback; -import org.openintents.openpgp.IOpenPgpService; - import android.app.Activity; import android.app.AlertDialog; import android.content.DialogInterface; @@ -34,7 +23,6 @@ import android.content.Intent; import android.content.pm.ResolveInfo; import android.graphics.drawable.Drawable; import android.os.Bundle; -import android.os.RemoteException; import android.util.Log; import android.view.View; import android.view.ViewGroup; @@ -44,6 +32,19 @@ import android.widget.ListAdapter; import android.widget.TextView; import android.widget.Toast; +import org.openintents.openpgp.IOpenPgpService; +import org.openintents.openpgp.OpenPgpError; +import org.openintents.openpgp.util.OpenPgpApi; +import org.openintents.openpgp.util.OpenPgpConstants; +import org.openintents.openpgp.util.OpenPgpServiceConnection; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.util.ArrayList; +import java.util.List; + public class OpenPgpProviderActivity extends Activity { Activity mActivity; @@ -67,123 +68,123 @@ public class OpenPgpProviderActivity extends Activity { selectCryptoProvider(); } - /** - * Callback from remote openpgp service - */ - final IOpenPgpKeyIdsCallback.Stub getKeysEncryptCallback = new IOpenPgpKeyIdsCallback.Stub() { - - @Override - public void onSuccess(final long[] keyIds) throws RemoteException { - Log.d(Constants.TAG, "getKeysEncryptCallback keyId " + keyIds[0]); - mActivity.runOnUiThread(new Runnable() { - - @Override - public void run() { - // encrypt after getting key ids - String inputStr = mMessage.getText().toString(); - OpenPgpData input = new OpenPgpData(inputStr); - - Log.d(Constants.TAG, "getKeysEncryptCallback inputStr " + inputStr); - - try { - mCryptoServiceConnection.getService().encrypt(input, - new OpenPgpData(OpenPgpData.TYPE_STRING), keyIds, encryptCallback); - } catch (RemoteException e) { - Log.e(Constants.TAG, "CryptoProviderDemo", e); - } - } - }); - } - - @Override - public void onError(OpenPgpError error) throws RemoteException { - handleError(error); - } - - }; - - final IOpenPgpKeyIdsCallback.Stub getKeysSignAndEncryptCallback = new IOpenPgpKeyIdsCallback.Stub() { - - @Override - public void onSuccess(final long[] keyIds) throws RemoteException { - Log.d(Constants.TAG, "getKeysSignAndEncryptCallback keyId " + keyIds[0]); - - mActivity.runOnUiThread(new Runnable() { - - @Override - public void run() { - // encrypt after getting key ids - String inputStr = mMessage.getText().toString(); - OpenPgpData input = new OpenPgpData(inputStr); - - try { - mCryptoServiceConnection.getService().signAndEncrypt(input, - new OpenPgpData(OpenPgpData.TYPE_STRING), keyIds, encryptCallback); - } catch (RemoteException e) { - Log.e(Constants.TAG, "CryptoProviderDemo", e); - } - } - }); - } - - @Override - public void onError(OpenPgpError error) throws RemoteException { - handleError(error); - } - - }; - - final IOpenPgpCallback.Stub encryptCallback = new IOpenPgpCallback.Stub() { - - @Override - public void onSuccess(final OpenPgpData output, OpenPgpSignatureResult signatureResult) - throws RemoteException { - Log.d(Constants.TAG, "encryptCallback"); - - runOnUiThread(new Runnable() { - - @Override - public void run() { - mCiphertext.setText(output.getString()); - } - }); - } - - @Override - public void onError(OpenPgpError error) throws RemoteException { - handleError(error); - } - - }; - - final IOpenPgpCallback.Stub decryptAndVerifyCallback = new IOpenPgpCallback.Stub() { - - @Override - public void onSuccess(final OpenPgpData output, final OpenPgpSignatureResult signatureResult) - throws RemoteException { - Log.d(Constants.TAG, "decryptAndVerifyCallback"); - - runOnUiThread(new Runnable() { - - @Override - public void run() { - mMessage.setText(output.getString()); - if (signatureResult != null) { - Toast.makeText(OpenPgpProviderActivity.this, - "signature result:\n" + signatureResult.toString(), - Toast.LENGTH_LONG).show(); - } - } - }); - - } - - @Override - public void onError(OpenPgpError error) throws RemoteException { - handleError(error); - } - - }; +// /** +// * Callback from remote openpgp service +// */ +// final IOpenPgpKeyIdsCallback.Stub getKeysEncryptCallback = new IOpenPgpKeyIdsCallback.Stub() { +// +// @Override +// public void onSuccess(final long[] keyIds) throws RemoteException { +// Log.d(Constants.TAG, "getKeysEncryptCallback keyId " + keyIds[0]); +// mActivity.runOnUiThread(new Runnable() { +// +// @Override +// public void run() { +// // encrypt after getting key ids +// String inputStr = mMessage.getText().toString(); +// OpenPgpData input = new OpenPgpData(inputStr); +// +// Log.d(Constants.TAG, "getKeysEncryptCallback inputStr " + inputStr); +// +// try { +// mCryptoServiceConnection.getService().encrypt(input, +// new OpenPgpData(OpenPgpData.TYPE_STRING), keyIds, encryptCallback); +// } catch (RemoteException e) { +// Log.e(Constants.TAG, "CryptoProviderDemo", e); +// } +// } +// }); +// } +// +// @Override +// public void onError(OpenPgpError error) throws RemoteException { +// handleError(error); +// } +// +// }; +// +// final IOpenPgpKeyIdsCallback.Stub getKeysSignAndEncryptCallback = new IOpenPgpKeyIdsCallback.Stub() { +// +// @Override +// public void onSuccess(final long[] keyIds) throws RemoteException { +// Log.d(Constants.TAG, "getKeysSignAndEncryptCallback keyId " + keyIds[0]); +// +// mActivity.runOnUiThread(new Runnable() { +// +// @Override +// public void run() { +// // encrypt after getting key ids +// String inputStr = mMessage.getText().toString(); +// OpenPgpData input = new OpenPgpData(inputStr); +// +// try { +// mCryptoServiceConnection.getService().signAndEncrypt(input, +// new OpenPgpData(OpenPgpData.TYPE_STRING), keyIds, encryptCallback); +// } catch (RemoteException e) { +// Log.e(Constants.TAG, "CryptoProviderDemo", e); +// } +// } +// }); +// } +// +// @Override +// public void onError(OpenPgpError error) throws RemoteException { +// handleError(error); +// } +// +// }; +// +// final IOpenPgpCallback.Stub encryptCallback = new IOpenPgpCallback.Stub() { +// +// @Override +// public void onSuccess(final OpenPgpData output, OpenPgpSignatureResult signatureResult) +// throws RemoteException { +// Log.d(Constants.TAG, "encryptCallback"); +// +// runOnUiThread(new Runnable() { +// +// @Override +// public void run() { +// mCiphertext.setText(output.getString()); +// } +// }); +// } +// +// @Override +// public void onError(OpenPgpError error) throws RemoteException { +// handleError(error); +// } +// +// }; +// +// final IOpenPgpCallback.Stub decryptAndVerifyCallback = new IOpenPgpCallback.Stub() { +// +// @Override +// public void onSuccess(final OpenPgpData output, final OpenPgpSignatureResult signatureResult) +// throws RemoteException { +// Log.d(Constants.TAG, "decryptAndVerifyCallback"); +// +// runOnUiThread(new Runnable() { +// +// @Override +// public void run() { +// mMessage.setText(output.getString()); +// if (signatureResult != null) { +// Toast.makeText(OpenPgpProviderActivity.this, +// "signature result:\n" + signatureResult.toString(), +// Toast.LENGTH_LONG).show(); +// } +// } +// }); +// +// } +// +// @Override +// public void onError(OpenPgpError error) throws RemoteException { +// handleError(error); +// } +// +// }; private void handleError(final OpenPgpError error) { mActivity.runOnUiThread(new Runnable() { @@ -200,46 +201,61 @@ public class OpenPgpProviderActivity extends Activity { } public void encryptOnClick(View view) { - try { - mCryptoServiceConnection.getService().getKeyIds( - mEncryptUserIds.getText().toString().split(","), true, getKeysEncryptCallback); - } catch (RemoteException e) { - Log.e(Constants.TAG, "CryptoProviderDemo", e); - } +// try { +// mCryptoServiceConnection.getService().getKeyIds( +// mEncryptUserIds.getText().toString().split(","), true, getKeysEncryptCallback); +// } catch (RemoteException e) { +// Log.e(Constants.TAG, "CryptoProviderDemo", e); +// } } public void signOnClick(View view) { - String inputStr = mMessage.getText().toString(); - OpenPgpData input = new OpenPgpData(inputStr); - try { - mCryptoServiceConnection.getService().sign(input, - new OpenPgpData(OpenPgpData.TYPE_STRING), encryptCallback); - } catch (RemoteException e) { - Log.e(Constants.TAG, "CryptoProviderDemo", e); + String inputStr = mMessage.getText().toString(); + InputStream is = new ByteArrayInputStream(inputStr.getBytes("UTF-8")); + + final ByteArrayOutputStream os = new ByteArrayOutputStream(); + + OpenPgpApi api = new OpenPgpApi(mCryptoServiceConnection.getService()); + api.sign(is, os); + + Log.d(OpenPgpConstants.TAG, "Test #1 read result: " + os.toByteArray().length + + " str=" + os.toString("UTF-8")); + + mCiphertext.setText(os.toString("UTF-8")); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); } +// OpenPgpData input = new OpenPgpData(inputStr); +// +// try { +// mCryptoServiceConnection.getService().sign(input, +// new OpenPgpData(OpenPgpData.TYPE_STRING), encryptCallback); +// } catch (RemoteException e) { +// Log.e(Constants.TAG, "CryptoProviderDemo", e); +// } } public void signAndEncryptOnClick(View view) { - try { - mCryptoServiceConnection.getService().getKeyIds( - mEncryptUserIds.getText().toString().split(","), true, - getKeysSignAndEncryptCallback); - } catch (RemoteException e) { - Log.e(Constants.TAG, "CryptoProviderDemo", e); - } +// try { +// mCryptoServiceConnection.getService().getKeyIds( +// mEncryptUserIds.getText().toString().split(","), true, +// getKeysSignAndEncryptCallback); +// } catch (RemoteException e) { +// Log.e(Constants.TAG, "CryptoProviderDemo", e); +// } } public void decryptAndVerifyOnClick(View view) { - String inputStr = mCiphertext.getText().toString(); - OpenPgpData input = new OpenPgpData(inputStr); - - try { - mCryptoServiceConnection.getService().decryptAndVerify(input, - new OpenPgpData(OpenPgpData.TYPE_STRING), decryptAndVerifyCallback); - } catch (RemoteException e) { - Log.e(Constants.TAG, "CryptoProviderDemo", e); - } +// String inputStr = mCiphertext.getText().toString(); +// OpenPgpData input = new OpenPgpData(inputStr); +// +// try { +// mCryptoServiceConnection.getService().decryptAndVerify(input, +// new OpenPgpData(OpenPgpData.TYPE_STRING), decryptAndVerifyCallback); +// } catch (RemoteException e) { +// Log.e(Constants.TAG, "CryptoProviderDemo", e); +// } } @Override -- cgit v1.2.3 From acad2ba95723a940467e89a07e91498188a88745 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Fri, 14 Feb 2014 13:40:24 +0100 Subject: PendingIntent to handle user input --- .../keychain/demo/OpenPgpProviderActivity.java | 87 +++++++++++++++++----- 1 file changed, 70 insertions(+), 17 deletions(-) (limited to 'OpenPGP-Keychain-API/example-app/src/main/java') 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 81f9eee68..39843eb82 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 @@ -18,11 +18,14 @@ package org.sufficientlysecure.keychain.demo; import android.app.Activity; import android.app.AlertDialog; +import android.app.PendingIntent; import android.content.DialogInterface; import android.content.Intent; +import android.content.IntentSender; import android.content.pm.ResolveInfo; import android.graphics.drawable.Drawable; import android.os.Bundle; +import android.support.v4.app.TaskStackBuilder; import android.util.Log; import android.view.View; import android.view.ViewGroup; @@ -54,6 +57,11 @@ public class OpenPgpProviderActivity extends Activity { private OpenPgpServiceConnection mCryptoServiceConnection; + public static final int REQUEST_CODE_SIGN = 9910; + public static final int REQUEST_CODE_ENCRYPT = 9911; + public static final int REQUEST_CODE_SIGN_AND_ENC = 9912; + public static final int REQUEST_CODE_DECRYPT = 9913; + @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); @@ -210,30 +218,60 @@ public class OpenPgpProviderActivity extends Activity { } public void signOnClick(View view) { + InputStream is = null; try { String inputStr = mMessage.getText().toString(); - InputStream is = new ByteArrayInputStream(inputStr.getBytes("UTF-8")); - - final ByteArrayOutputStream os = new ByteArrayOutputStream(); - - OpenPgpApi api = new OpenPgpApi(mCryptoServiceConnection.getService()); - api.sign(is, os); + is = new ByteArrayInputStream(inputStr.getBytes("UTF-8")); - Log.d(OpenPgpConstants.TAG, "Test #1 read result: " + os.toByteArray().length - + " str=" + os.toString("UTF-8")); - - mCiphertext.setText(os.toString("UTF-8")); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } -// OpenPgpData input = new OpenPgpData(inputStr); + final ByteArrayOutputStream os = new ByteArrayOutputStream(); + + OpenPgpApi api = new OpenPgpApi(mCryptoServiceConnection.getService()); + api.sign(new Bundle(), is, os, new OpenPgpApi.IOpenPgpCallback() { + @Override + public void onReturn(Bundle result) { + switch (result.getInt(OpenPgpConstants.RESULT_CODE)) { + case OpenPgpConstants.RESULT_CODE_SUCCESS: { + try { + Log.d(OpenPgpConstants.TAG, "result: " + os.toByteArray().length + + " str=" + os.toString("UTF-8")); + + mCiphertext.setText(os.toString("UTF-8")); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + break; + } + case OpenPgpConstants.RESULT_CODE_USER_INTERACTION_REQUIRED: { + PendingIntent pi = result.getParcelable(OpenPgpConstants.RESULT_INTENT); + try { + OpenPgpProviderActivity.this.startIntentSenderForResult(pi.getIntentSender(), + REQUEST_CODE_SIGN, null, // or new Intent() (in billing) + 0, 0, 0); + } catch (IntentSender.SendIntentException e) { + e.printStackTrace(); + } +// try { +// pi.send(OpenPgpProviderActivity.this, 42, null, new PendingIntent.OnFinished() { // -// try { -// mCryptoServiceConnection.getService().sign(input, -// new OpenPgpData(OpenPgpData.TYPE_STRING), encryptCallback); -// } catch (RemoteException e) { -// Log.e(Constants.TAG, "CryptoProviderDemo", e); -// } +// @Override +// public void onSendFinished(PendingIntent pendingIntent, Intent intent, int resultCode, String resultData, Bundle resultExtras) { +// Log.d(Constants.TAG, "onSendFinished"); +// Log.d(Constants.TAG, "resultCode: " + resultCode); +// +// } +// }, null); +// } catch (PendingIntent.CanceledException e) { +// e.printStackTrace(); +// } + break; + } + } + } + }); + } public void signAndEncryptOnClick(View view) { @@ -258,6 +296,21 @@ public class OpenPgpProviderActivity extends Activity { // } } + @Override + protected void onActivityResult(int requestCode, int resultCode, Intent data) { +// super.onActivityResult(requestCode, resultCode, data); + Log.d(Constants.TAG, "onActivityResult"); + switch (requestCode) { + case REQUEST_CODE_SIGN: { + Log.d(Constants.TAG, "resultCode: " + resultCode); + + if (resultCode == RESULT_OK) { + signOnClick(null); + } + } + } + } + @Override public void onDestroy() { super.onDestroy(); -- cgit v1.2.3 From d6953745810bd4c6dee3bfefb538236b2b7bdbb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Fri, 14 Feb 2014 17:01:17 +0100 Subject: conversion of other methods --- .../keychain/demo/OpenPgpProviderActivity.java | 353 +++++++++++---------- 1 file changed, 186 insertions(+), 167 deletions(-) (limited to 'OpenPGP-Keychain-API/example-app/src/main/java') 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 39843eb82..a7060abb2 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 @@ -25,11 +25,11 @@ import android.content.IntentSender; import android.content.pm.ResolveInfo; import android.graphics.drawable.Drawable; import android.os.Bundle; -import android.support.v4.app.TaskStackBuilder; import android.util.Log; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; +import android.widget.Button; import android.widget.EditText; import android.widget.ListAdapter; import android.widget.TextView; @@ -54,13 +54,17 @@ public class OpenPgpProviderActivity extends Activity { EditText mMessage; EditText mCiphertext; EditText mEncryptUserIds; + Button mSign; + Button mEncrypt; + Button mSignAndEncrypt; + Button mDecryptAndVerify; private OpenPgpServiceConnection mCryptoServiceConnection; public static final int REQUEST_CODE_SIGN = 9910; public static final int REQUEST_CODE_ENCRYPT = 9911; - public static final int REQUEST_CODE_SIGN_AND_ENC = 9912; - public static final int REQUEST_CODE_DECRYPT = 9913; + public static final int REQUEST_CODE_SIGN_AND_ENCRYPT = 9912; + public static final int REQUEST_CODE_DECRYPT_AND_VERIFY = 9913; @Override public void onCreate(Bundle icicle) { @@ -73,127 +77,38 @@ public class OpenPgpProviderActivity extends Activity { mCiphertext = (EditText) findViewById(R.id.crypto_provider_demo_ciphertext); mEncryptUserIds = (EditText) findViewById(R.id.crypto_provider_demo_encrypt_user_id); + mSign = (Button) findViewById(R.id.crypto_provider_demo_sign); + mEncrypt = (Button) findViewById(R.id.crypto_provider_demo_encrypt); + mSignAndEncrypt = (Button) findViewById(R.id.crypto_provider_demo_sign_and_encrypt); + mDecryptAndVerify = (Button) findViewById(R.id.crypto_provider_demo_decrypt_and_verify); + mSign.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + sign(new Bundle()); + } + }); + mEncrypt.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + encrypt(new Bundle()); + } + }); + mSignAndEncrypt.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + signAndEncrypt(new Bundle()); + } + }); + mDecryptAndVerify.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + decryptAndVerify(new Bundle()); + } + }); + selectCryptoProvider(); } -// /** -// * Callback from remote openpgp service -// */ -// final IOpenPgpKeyIdsCallback.Stub getKeysEncryptCallback = new IOpenPgpKeyIdsCallback.Stub() { -// -// @Override -// public void onSuccess(final long[] keyIds) throws RemoteException { -// Log.d(Constants.TAG, "getKeysEncryptCallback keyId " + keyIds[0]); -// mActivity.runOnUiThread(new Runnable() { -// -// @Override -// public void run() { -// // encrypt after getting key ids -// String inputStr = mMessage.getText().toString(); -// OpenPgpData input = new OpenPgpData(inputStr); -// -// Log.d(Constants.TAG, "getKeysEncryptCallback inputStr " + inputStr); -// -// try { -// mCryptoServiceConnection.getService().encrypt(input, -// new OpenPgpData(OpenPgpData.TYPE_STRING), keyIds, encryptCallback); -// } catch (RemoteException e) { -// Log.e(Constants.TAG, "CryptoProviderDemo", e); -// } -// } -// }); -// } -// -// @Override -// public void onError(OpenPgpError error) throws RemoteException { -// handleError(error); -// } -// -// }; -// -// final IOpenPgpKeyIdsCallback.Stub getKeysSignAndEncryptCallback = new IOpenPgpKeyIdsCallback.Stub() { -// -// @Override -// public void onSuccess(final long[] keyIds) throws RemoteException { -// Log.d(Constants.TAG, "getKeysSignAndEncryptCallback keyId " + keyIds[0]); -// -// mActivity.runOnUiThread(new Runnable() { -// -// @Override -// public void run() { -// // encrypt after getting key ids -// String inputStr = mMessage.getText().toString(); -// OpenPgpData input = new OpenPgpData(inputStr); -// -// try { -// mCryptoServiceConnection.getService().signAndEncrypt(input, -// new OpenPgpData(OpenPgpData.TYPE_STRING), keyIds, encryptCallback); -// } catch (RemoteException e) { -// Log.e(Constants.TAG, "CryptoProviderDemo", e); -// } -// } -// }); -// } -// -// @Override -// public void onError(OpenPgpError error) throws RemoteException { -// handleError(error); -// } -// -// }; -// -// final IOpenPgpCallback.Stub encryptCallback = new IOpenPgpCallback.Stub() { -// -// @Override -// public void onSuccess(final OpenPgpData output, OpenPgpSignatureResult signatureResult) -// throws RemoteException { -// Log.d(Constants.TAG, "encryptCallback"); -// -// runOnUiThread(new Runnable() { -// -// @Override -// public void run() { -// mCiphertext.setText(output.getString()); -// } -// }); -// } -// -// @Override -// public void onError(OpenPgpError error) throws RemoteException { -// handleError(error); -// } -// -// }; -// -// final IOpenPgpCallback.Stub decryptAndVerifyCallback = new IOpenPgpCallback.Stub() { -// -// @Override -// public void onSuccess(final OpenPgpData output, final OpenPgpSignatureResult signatureResult) -// throws RemoteException { -// Log.d(Constants.TAG, "decryptAndVerifyCallback"); -// -// runOnUiThread(new Runnable() { -// -// @Override -// public void run() { -// mMessage.setText(output.getString()); -// if (signatureResult != null) { -// Toast.makeText(OpenPgpProviderActivity.this, -// "signature result:\n" + signatureResult.toString(), -// Toast.LENGTH_LONG).show(); -// } -// } -// }); -// -// } -// -// @Override -// public void onError(OpenPgpError error) throws RemoteException { -// handleError(error); -// } -// -// }; - private void handleError(final OpenPgpError error) { mActivity.runOnUiThread(new Runnable() { @@ -208,28 +123,30 @@ public class OpenPgpProviderActivity extends Activity { }); } - public void encryptOnClick(View view) { -// try { -// mCryptoServiceConnection.getService().getKeyIds( -// mEncryptUserIds.getText().toString().split(","), true, getKeysEncryptCallback); -// } catch (RemoteException e) { -// Log.e(Constants.TAG, "CryptoProviderDemo", e); -// } - } - - public void signOnClick(View view) { + private InputStream getInputstream(boolean ciphertext) { InputStream is = null; try { - String inputStr = mMessage.getText().toString(); + String inputStr = null; + if (ciphertext) { + inputStr = mCiphertext.getText().toString(); + } else { + inputStr = mMessage.getText().toString(); + } is = new ByteArrayInputStream(inputStr.getBytes("UTF-8")); - } catch (UnsupportedEncodingException e) { e.printStackTrace(); } + + return is; + } + + + public void sign(Bundle params) { + InputStream is = getInputstream(false); final ByteArrayOutputStream os = new ByteArrayOutputStream(); OpenPgpApi api = new OpenPgpApi(mCryptoServiceConnection.getService()); - api.sign(new Bundle(), is, os, new OpenPgpApi.IOpenPgpCallback() { + api.sign(params, is, os, new OpenPgpApi.IOpenPgpCallback() { @Override public void onReturn(Bundle result) { switch (result.getInt(OpenPgpConstants.RESULT_CODE)) { @@ -248,52 +165,128 @@ public class OpenPgpProviderActivity extends Activity { PendingIntent pi = result.getParcelable(OpenPgpConstants.RESULT_INTENT); try { OpenPgpProviderActivity.this.startIntentSenderForResult(pi.getIntentSender(), - REQUEST_CODE_SIGN, null, // or new Intent() (in billing) + REQUEST_CODE_SIGN, null, 0, 0, 0); } catch (IntentSender.SendIntentException e) { e.printStackTrace(); } -// try { -// pi.send(OpenPgpProviderActivity.this, 42, null, new PendingIntent.OnFinished() { -// -// @Override -// public void onSendFinished(PendingIntent pendingIntent, Intent intent, int resultCode, String resultData, Bundle resultExtras) { -// Log.d(Constants.TAG, "onSendFinished"); -// Log.d(Constants.TAG, "resultCode: " + resultCode); -// -// } -// }, null); -// } catch (PendingIntent.CanceledException e) { -// e.printStackTrace(); -// } break; } } } }); + } + + public void encrypt(Bundle params) { + params.putStringArray(OpenPgpConstants.PARAMS_USER_IDS, mEncryptUserIds.getText().toString().split(",")); + + InputStream is = getInputstream(false); + final ByteArrayOutputStream os = new ByteArrayOutputStream(); + OpenPgpApi api = new OpenPgpApi(mCryptoServiceConnection.getService()); + api.encrypt(params, is, os, new OpenPgpApi.IOpenPgpCallback() { + @Override + public void onReturn(Bundle result) { + switch (result.getInt(OpenPgpConstants.RESULT_CODE)) { + case OpenPgpConstants.RESULT_CODE_SUCCESS: { + try { + Log.d(OpenPgpConstants.TAG, "result: " + os.toByteArray().length + + " str=" + os.toString("UTF-8")); + + mCiphertext.setText(os.toString("UTF-8")); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + break; + } + case OpenPgpConstants.RESULT_CODE_USER_INTERACTION_REQUIRED: { + PendingIntent pi = result.getParcelable(OpenPgpConstants.RESULT_INTENT); + try { + OpenPgpProviderActivity.this.startIntentSenderForResult(pi.getIntentSender(), + REQUEST_CODE_ENCRYPT, null, + 0, 0, 0); + } catch (IntentSender.SendIntentException e) { + e.printStackTrace(); + } + break; + } + } + } + }); } - public void signAndEncryptOnClick(View view) { -// try { -// mCryptoServiceConnection.getService().getKeyIds( -// mEncryptUserIds.getText().toString().split(","), true, -// getKeysSignAndEncryptCallback); -// } catch (RemoteException e) { -// Log.e(Constants.TAG, "CryptoProviderDemo", e); -// } + public void signAndEncrypt(Bundle params) { + params.putStringArray(OpenPgpConstants.PARAMS_USER_IDS, mEncryptUserIds.getText().toString().split(",")); + + InputStream is = getInputstream(false); + final ByteArrayOutputStream os = new ByteArrayOutputStream(); + + OpenPgpApi api = new OpenPgpApi(mCryptoServiceConnection.getService()); + api.signAndEncrypt(params, is, os, new OpenPgpApi.IOpenPgpCallback() { + @Override + public void onReturn(Bundle result) { + switch (result.getInt(OpenPgpConstants.RESULT_CODE)) { + case OpenPgpConstants.RESULT_CODE_SUCCESS: { + try { + Log.d(OpenPgpConstants.TAG, "result: " + os.toByteArray().length + + " str=" + os.toString("UTF-8")); + + mCiphertext.setText(os.toString("UTF-8")); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + break; + } + case OpenPgpConstants.RESULT_CODE_USER_INTERACTION_REQUIRED: { + PendingIntent pi = result.getParcelable(OpenPgpConstants.RESULT_INTENT); + try { + OpenPgpProviderActivity.this.startIntentSenderForResult(pi.getIntentSender(), + REQUEST_CODE_SIGN_AND_ENCRYPT, null, + 0, 0, 0); + } catch (IntentSender.SendIntentException e) { + e.printStackTrace(); + } + break; + } + } + } + }); } - public void decryptAndVerifyOnClick(View view) { -// String inputStr = mCiphertext.getText().toString(); -// OpenPgpData input = new OpenPgpData(inputStr); -// -// try { -// mCryptoServiceConnection.getService().decryptAndVerify(input, -// new OpenPgpData(OpenPgpData.TYPE_STRING), decryptAndVerifyCallback); -// } catch (RemoteException e) { -// Log.e(Constants.TAG, "CryptoProviderDemo", e); -// } + public void decryptAndVerify(Bundle params) { + InputStream is = getInputstream(true); + final ByteArrayOutputStream os = new ByteArrayOutputStream(); + + OpenPgpApi api = new OpenPgpApi(mCryptoServiceConnection.getService()); + api.decryptAndVerify(params, is, os, new OpenPgpApi.IOpenPgpCallback() { + @Override + public void onReturn(Bundle result) { + switch (result.getInt(OpenPgpConstants.RESULT_CODE)) { + case OpenPgpConstants.RESULT_CODE_SUCCESS: { + try { + Log.d(OpenPgpConstants.TAG, "result: " + os.toByteArray().length + + " str=" + os.toString("UTF-8")); + + mCiphertext.setText(os.toString("UTF-8")); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + break; + } + case OpenPgpConstants.RESULT_CODE_USER_INTERACTION_REQUIRED: { + PendingIntent pi = result.getParcelable(OpenPgpConstants.RESULT_INTENT); + try { + OpenPgpProviderActivity.this.startIntentSenderForResult(pi.getIntentSender(), + REQUEST_CODE_DECRYPT_AND_VERIFY, null, + 0, 0, 0); + } catch (IntentSender.SendIntentException e) { + e.printStackTrace(); + } + break; + } + } + } + }); } @Override @@ -304,8 +297,34 @@ public class OpenPgpProviderActivity extends Activity { case REQUEST_CODE_SIGN: { Log.d(Constants.TAG, "resultCode: " + resultCode); + // try to sign again after password caching + if (resultCode == RESULT_OK) { + sign(new Bundle()); + } + } + case REQUEST_CODE_ENCRYPT: { + Log.d(Constants.TAG, "resultCode: " + resultCode); + + // try to sign again after password caching + if (resultCode == RESULT_OK) { + // use data extras now as params for call (they now include key ids! + encrypt(data.getExtras()); + } + } + case REQUEST_CODE_SIGN_AND_ENCRYPT: { + Log.d(Constants.TAG, "resultCode: " + resultCode); + + // try to sign again after password caching + if (resultCode == RESULT_OK) { + signAndEncrypt(data.getExtras()); + } + } + case REQUEST_CODE_DECRYPT_AND_VERIFY: { + Log.d(Constants.TAG, "resultCode: " + resultCode); + + // try to sign again after password caching if (resultCode == RESULT_OK) { - signOnClick(null); + decryptAndVerify(new Bundle()); } } } -- cgit v1.2.3 From 581e6edb4cdfb6274f21e532ba60a610a3ce1fc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Fri, 14 Feb 2014 17:19:54 +0100 Subject: cleanup --- .../keychain/demo/AidlDemoActivity2.java | 168 --------------------- .../keychain/demo/BaseActivity.java | 13 -- .../keychain/demo/OpenPgpProviderActivity.java | 2 +- 3 files changed, 1 insertion(+), 182 deletions(-) delete mode 100644 OpenPGP-Keychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/AidlDemoActivity2.java (limited to 'OpenPGP-Keychain-API/example-app/src/main/java') diff --git a/OpenPGP-Keychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/AidlDemoActivity2.java b/OpenPGP-Keychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/AidlDemoActivity2.java deleted file mode 100644 index b6e211955..000000000 --- a/OpenPGP-Keychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/AidlDemoActivity2.java +++ /dev/null @@ -1,168 +0,0 @@ -///* -// * Copyright (C) 2012 Dominik Schürmann -// * -// * Licensed under the Apache License, Version 2.0 (the "License"); -// * you may not use this file except in compliance with the License. -// * You may obtain a copy of the License at -// * -// * http://www.apache.org/licenses/LICENSE-2.0 -// * -// * Unless required by applicable law or agreed to in writing, software -// * distributed under the License is distributed on an "AS IS" BASIS, -// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// * See the License for the specific language governing permissions and -// * limitations under the License. -// */ -// -//package org.sufficientlysecure.keychain.demo; -// -//import java.util.ArrayList; -//import java.util.List; -// -//import org.sufficientlysecure.keychain.demo.R; -//import org.sufficientlysecure.keychain.integration.KeychainData; -//import org.sufficientlysecure.keychain.integration.KeychainIntentHelper; -//import org.sufficientlysecure.keychain.service.IKeychainKeyService; -//import org.sufficientlysecure.keychain.service.handler.IKeychainGetKeyringsHandler; -// -//import android.annotation.SuppressLint; -//import android.app.Activity; -//import android.app.AlertDialog; -//import android.content.ComponentName; -//import android.content.Context; -//import android.content.Intent; -//import android.content.ServiceConnection; -//import android.os.Bundle; -//import android.os.IBinder; -//import android.os.RemoteException; -//import android.util.Base64; -//import android.view.View; -//import android.widget.TextView; -// -//public class AidlDemoActivity2 extends Activity { -// Activity mActivity; -// -// TextView mKeyringsTextView; -// -// KeychainIntentHelper mKeychainIntentHelper; -// KeychainData mKeychainData; -// -// byte[] keysBytes; -// ArrayList keysStrings; -// -// private IKeychainKeyService service = null; -// private ServiceConnection svcConn = new ServiceConnection() { -// public void onServiceConnected(ComponentName className, IBinder binder) { -// service = IKeychainKeyService.Stub.asInterface(binder); -// } -// -// public void onServiceDisconnected(ComponentName className) { -// service = null; -// } -// }; -// -// @Override -// public void onCreate(Bundle icicle) { -// super.onCreate(icicle); -// setContentView(R.layout.aidl_demo2); -// -// mActivity = this; -// -// mKeyringsTextView = (TextView) findViewById(R.id.aidl_demo_keyrings); -// -// mKeychainIntentHelper = new KeychainIntentHelper(mActivity); -// mKeychainData = new KeychainData(); -// -// bindService(new Intent(IKeychainKeyService.class.getName()), svcConn, -// Context.BIND_AUTO_CREATE); -// } -// -// public void getKeyringsStringsOnClick(View view) { -// try { -// service.getPublicKeyRings(mKeychainData.getPublicKeys(), true, getKeyringsHandler); -// } catch (RemoteException e) { -// exceptionImplementation(-1, e.toString()); -// } -// } -// -// public void getKeyringsBytesOnClick(View view) { -// try { -// service.getPublicKeyRings(mKeychainData.getPublicKeys(), false, getKeyringsHandler); -// } catch (RemoteException e) { -// exceptionImplementation(-1, e.toString()); -// } -// } -// -// @SuppressLint("NewApi") -// private void updateView() { -// if (keysBytes != null) { -// mKeyringsTextView.setText(Base64.encodeToString(keysBytes, Base64.DEFAULT)); -// } else if (keysStrings != null) { -// mKeyringsTextView.setText(""); -// for (String output : keysStrings) { -// mKeyringsTextView.append(output); -// } -// } -// } -// -// @Override -// public void onDestroy() { -// super.onDestroy(); -// -// unbindService(svcConn); -// } -// -// private void exceptionImplementation(int exceptionId, String error) { -// AlertDialog.Builder builder = new AlertDialog.Builder(this); -// builder.setTitle("Exception!").setMessage(error).setPositiveButton("OK", null).show(); -// } -// -// private final IKeychainGetKeyringsHandler.Stub getKeyringsHandler = new IKeychainGetKeyringsHandler.Stub() { -// -// @Override -// public void onException(final int exceptionId, final String message) throws RemoteException { -// runOnUiThread(new Runnable() { -// public void run() { -// exceptionImplementation(exceptionId, message); -// } -// }); -// } -// -// @Override -// public void onSuccess(final byte[] outputBytes, final List outputStrings) -// throws RemoteException { -// runOnUiThread(new Runnable() { -// public void run() { -// if (outputBytes != null) { -// keysBytes = outputBytes; -// keysStrings = null; -// } else if (outputStrings != null) { -// keysBytes = null; -// keysStrings = (ArrayList) outputStrings; -// } -// updateView(); -// } -// }); -// -// } -// -// }; -// -// public void selectEncryptionKeysOnClick(View view) { -// mKeychainIntentHelper.selectPublicKeys("user@example.com"); -// } -// -// @Override -// protected void onActivityResult(int requestCode, int resultCode, Intent data) { -// // this updates the mKeychainData object to the result of the methods -// boolean result = mKeychainIntentHelper.onActivityResult(requestCode, resultCode, data, -// mKeychainData); -// if (result) { -// updateView(); -// } -// -// // continue with other activity results -// super.onActivityResult(requestCode, resultCode, data); -// } -// -//} diff --git a/OpenPGP-Keychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/BaseActivity.java b/OpenPGP-Keychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/BaseActivity.java index 5b286f208..7e8818b5b 100644 --- a/OpenPGP-Keychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/BaseActivity.java +++ b/OpenPGP-Keychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/BaseActivity.java @@ -32,8 +32,6 @@ public class BaseActivity extends PreferenceActivity { private Preference mIntentDemo; private Preference mContentProviderDemo; private Preference mCryptoProvider; - private Preference mAidlDemo; - private Preference mAidlDemo2; /** * Called when the activity is first created. @@ -51,8 +49,6 @@ public class BaseActivity extends PreferenceActivity { mIntentDemo = (Preference) findPreference("intent_demo"); mContentProviderDemo = (Preference) findPreference("content_provider_demo"); mCryptoProvider = (Preference) findPreference("openpgp_provider_demo"); - mAidlDemo = (Preference) findPreference("aidl_demo"); - mAidlDemo2 = (Preference) findPreference("aidl_demo2"); mIntentDemo.setOnPreferenceClickListener(new OnPreferenceClickListener() { @Override @@ -73,15 +69,6 @@ public class BaseActivity extends PreferenceActivity { } }); - // mAidlDemo2.setOnPreferenceClickListener(new OnPreferenceClickListener() { - // @Override - // public boolean onPreferenceClick(Preference preference) { - // startActivity(new Intent(mActivity, AidlDemoActivity2.class)); - // - // return false; - // } - // }); - } } 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 a7060abb2..6dc3bd562 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 @@ -69,7 +69,7 @@ public class OpenPgpProviderActivity extends Activity { @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); - setContentView(R.layout.crypto_provider_demo); + setContentView(R.layout.openpgp_provider); mActivity = this; -- cgit v1.2.3 From 02a0a552ad0918b25717cfb39f7399d69655fdbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Fri, 14 Feb 2014 17:23:38 +0100 Subject: forgot breakes --- .../org/sufficientlysecure/keychain/demo/OpenPgpProviderActivity.java | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'OpenPGP-Keychain-API/example-app/src/main/java') 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 6dc3bd562..b5b4a812e 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 @@ -301,6 +301,7 @@ public class OpenPgpProviderActivity extends Activity { if (resultCode == RESULT_OK) { sign(new Bundle()); } + break; } case REQUEST_CODE_ENCRYPT: { Log.d(Constants.TAG, "resultCode: " + resultCode); @@ -310,6 +311,7 @@ public class OpenPgpProviderActivity extends Activity { // use data extras now as params for call (they now include key ids! encrypt(data.getExtras()); } + break; } case REQUEST_CODE_SIGN_AND_ENCRYPT: { Log.d(Constants.TAG, "resultCode: " + resultCode); @@ -318,6 +320,7 @@ public class OpenPgpProviderActivity extends Activity { if (resultCode == RESULT_OK) { signAndEncrypt(data.getExtras()); } + break; } case REQUEST_CODE_DECRYPT_AND_VERIFY: { Log.d(Constants.TAG, "resultCode: " + resultCode); @@ -326,6 +329,7 @@ public class OpenPgpProviderActivity extends Activity { if (resultCode == RESULT_OK) { decryptAndVerify(new Bundle()); } + break; } } } -- cgit v1.2.3 From 21ba41edaec7eb942e0ebe004874a763b9afa638 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Fri, 14 Feb 2014 17:26:54 +0100 Subject: request ascii armor --- .../sufficientlysecure/keychain/demo/OpenPgpProviderActivity.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'OpenPGP-Keychain-API/example-app/src/main/java') 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 b5b4a812e..c4fde3f7e 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 @@ -142,6 +142,8 @@ public class OpenPgpProviderActivity extends Activity { public void sign(Bundle params) { + params.putBoolean(OpenPgpConstants.PARAMS_REQUEST_ASCII_ARMOR, true); + InputStream is = getInputstream(false); final ByteArrayOutputStream os = new ByteArrayOutputStream(); @@ -179,6 +181,7 @@ public class OpenPgpProviderActivity extends Activity { public void encrypt(Bundle params) { params.putStringArray(OpenPgpConstants.PARAMS_USER_IDS, mEncryptUserIds.getText().toString().split(",")); + params.putBoolean(OpenPgpConstants.PARAMS_REQUEST_ASCII_ARMOR, true); InputStream is = getInputstream(false); final ByteArrayOutputStream os = new ByteArrayOutputStream(); @@ -217,6 +220,7 @@ public class OpenPgpProviderActivity extends Activity { public void signAndEncrypt(Bundle params) { params.putStringArray(OpenPgpConstants.PARAMS_USER_IDS, mEncryptUserIds.getText().toString().split(",")); + params.putBoolean(OpenPgpConstants.PARAMS_REQUEST_ASCII_ARMOR, true); InputStream is = getInputstream(false); final ByteArrayOutputStream os = new ByteArrayOutputStream(); @@ -254,6 +258,8 @@ public class OpenPgpProviderActivity extends Activity { } public void decryptAndVerify(Bundle params) { + params.putBoolean(OpenPgpConstants.PARAMS_REQUEST_ASCII_ARMOR, true); + InputStream is = getInputstream(true); final ByteArrayOutputStream os = new ByteArrayOutputStream(); @@ -267,7 +273,7 @@ public class OpenPgpProviderActivity extends Activity { Log.d(OpenPgpConstants.TAG, "result: " + os.toByteArray().length + " str=" + os.toString("UTF-8")); - mCiphertext.setText(os.toString("UTF-8")); + mMessage.setText(os.toString("UTF-8")); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } -- cgit v1.2.3 From 494a5fa414fe5962bdee0d50e761da9dc0cc1cc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Sat, 15 Feb 2014 01:06:03 +0100 Subject: private request codes, pass params through methods and pending intents, getKeyIds method --- .../keychain/demo/OpenPgpProviderActivity.java | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'OpenPGP-Keychain-API/example-app/src/main/java') 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 c4fde3f7e..e21b1c2a1 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 @@ -159,7 +159,7 @@ public class OpenPgpProviderActivity extends Activity { mCiphertext.setText(os.toString("UTF-8")); } catch (UnsupportedEncodingException e) { - e.printStackTrace(); + Log.e(Constants.TAG, "UnsupportedEncodingException", e); } break; } @@ -170,7 +170,7 @@ public class OpenPgpProviderActivity extends Activity { REQUEST_CODE_SIGN, null, 0, 0, 0); } catch (IntentSender.SendIntentException e) { - e.printStackTrace(); + Log.e(Constants.TAG, "SendIntentException", e); } break; } @@ -198,7 +198,7 @@ public class OpenPgpProviderActivity extends Activity { mCiphertext.setText(os.toString("UTF-8")); } catch (UnsupportedEncodingException e) { - e.printStackTrace(); + Log.e(Constants.TAG, "UnsupportedEncodingException", e); } break; } @@ -209,7 +209,7 @@ public class OpenPgpProviderActivity extends Activity { REQUEST_CODE_ENCRYPT, null, 0, 0, 0); } catch (IntentSender.SendIntentException e) { - e.printStackTrace(); + Log.e(Constants.TAG, "SendIntentException", e); } break; } @@ -237,7 +237,7 @@ public class OpenPgpProviderActivity extends Activity { mCiphertext.setText(os.toString("UTF-8")); } catch (UnsupportedEncodingException e) { - e.printStackTrace(); + Log.e(Constants.TAG, "UnsupportedEncodingException", e); } break; } @@ -248,7 +248,7 @@ public class OpenPgpProviderActivity extends Activity { REQUEST_CODE_SIGN_AND_ENCRYPT, null, 0, 0, 0); } catch (IntentSender.SendIntentException e) { - e.printStackTrace(); + Log.e(Constants.TAG, "SendIntentException", e); } break; } @@ -275,7 +275,7 @@ public class OpenPgpProviderActivity extends Activity { mMessage.setText(os.toString("UTF-8")); } catch (UnsupportedEncodingException e) { - e.printStackTrace(); + Log.e(Constants.TAG, "UnsupportedEncodingException", e); } break; } @@ -286,7 +286,7 @@ public class OpenPgpProviderActivity extends Activity { REQUEST_CODE_DECRYPT_AND_VERIFY, null, 0, 0, 0); } catch (IntentSender.SendIntentException e) { - e.printStackTrace(); + Log.e(Constants.TAG, "SendIntentException", e); } break; } @@ -297,7 +297,8 @@ public class OpenPgpProviderActivity extends Activity { @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { -// super.onActivityResult(requestCode, resultCode, data); + super.onActivityResult(requestCode, resultCode, data); + Log.d(Constants.TAG, "onActivityResult"); switch (requestCode) { case REQUEST_CODE_SIGN: { @@ -305,7 +306,7 @@ public class OpenPgpProviderActivity extends Activity { // try to sign again after password caching if (resultCode == RESULT_OK) { - sign(new Bundle()); + sign(data.getExtras()); } break; } -- cgit v1.2.3 From 5f39cb3ec0d1d3f77d48fdbb428a2147dfe11d03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Sat, 15 Feb 2014 02:08:27 +0100 Subject: fix passtrough of params --- .../keychain/demo/OpenPgpProviderActivity.java | 63 ++++++++-------------- 1 file changed, 22 insertions(+), 41 deletions(-) (limited to 'OpenPGP-Keychain-API/example-app/src/main/java') 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 e21b1c2a1..e578d0660 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 @@ -167,8 +167,7 @@ public class OpenPgpProviderActivity extends Activity { PendingIntent pi = result.getParcelable(OpenPgpConstants.RESULT_INTENT); try { OpenPgpProviderActivity.this.startIntentSenderForResult(pi.getIntentSender(), - REQUEST_CODE_SIGN, null, - 0, 0, 0); + REQUEST_CODE_SIGN, null, 0, 0, 0); } catch (IntentSender.SendIntentException e) { Log.e(Constants.TAG, "SendIntentException", e); } @@ -206,8 +205,7 @@ public class OpenPgpProviderActivity extends Activity { PendingIntent pi = result.getParcelable(OpenPgpConstants.RESULT_INTENT); try { OpenPgpProviderActivity.this.startIntentSenderForResult(pi.getIntentSender(), - REQUEST_CODE_ENCRYPT, null, - 0, 0, 0); + REQUEST_CODE_ENCRYPT, null, 0, 0, 0); } catch (IntentSender.SendIntentException e) { Log.e(Constants.TAG, "SendIntentException", e); } @@ -245,8 +243,7 @@ public class OpenPgpProviderActivity extends Activity { PendingIntent pi = result.getParcelable(OpenPgpConstants.RESULT_INTENT); try { OpenPgpProviderActivity.this.startIntentSenderForResult(pi.getIntentSender(), - REQUEST_CODE_SIGN_AND_ENCRYPT, null, - 0, 0, 0); + REQUEST_CODE_SIGN_AND_ENCRYPT, null, 0, 0, 0); } catch (IntentSender.SendIntentException e) { Log.e(Constants.TAG, "SendIntentException", e); } @@ -283,8 +280,7 @@ public class OpenPgpProviderActivity extends Activity { PendingIntent pi = result.getParcelable(OpenPgpConstants.RESULT_INTENT); try { OpenPgpProviderActivity.this.startIntentSenderForResult(pi.getIntentSender(), - REQUEST_CODE_DECRYPT_AND_VERIFY, null, - 0, 0, 0); + REQUEST_CODE_DECRYPT_AND_VERIFY, null, 0, 0, 0); } catch (IntentSender.SendIntentException e) { Log.e(Constants.TAG, "SendIntentException", e); } @@ -299,44 +295,29 @@ public class OpenPgpProviderActivity extends Activity { protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); - Log.d(Constants.TAG, "onActivityResult"); - switch (requestCode) { - case REQUEST_CODE_SIGN: { - Log.d(Constants.TAG, "resultCode: " + resultCode); + Log.d(Constants.TAG, "onActivityResult resultCode: " + resultCode); - // try to sign again after password caching - if (resultCode == RESULT_OK) { - sign(data.getExtras()); - } - break; - } - case REQUEST_CODE_ENCRYPT: { - Log.d(Constants.TAG, "resultCode: " + resultCode); + // try again after user interaction + if (resultCode == RESULT_OK) { + Bundle params = data.getBundleExtra(OpenPgpConstants.PI_RESULT_PARAMS); - // try to sign again after password caching - if (resultCode == RESULT_OK) { - // use data extras now as params for call (they now include key ids! - encrypt(data.getExtras()); + switch (requestCode) { + case REQUEST_CODE_SIGN: { + sign(params); + break; } - break; - } - case REQUEST_CODE_SIGN_AND_ENCRYPT: { - Log.d(Constants.TAG, "resultCode: " + resultCode); - - // try to sign again after password caching - if (resultCode == RESULT_OK) { - signAndEncrypt(data.getExtras()); + case REQUEST_CODE_ENCRYPT: { + encrypt(params); + break; } - break; - } - case REQUEST_CODE_DECRYPT_AND_VERIFY: { - Log.d(Constants.TAG, "resultCode: " + resultCode); - - // try to sign again after password caching - if (resultCode == RESULT_OK) { - decryptAndVerify(new Bundle()); + case REQUEST_CODE_SIGN_AND_ENCRYPT: { + signAndEncrypt(params); + break; + } + case REQUEST_CODE_DECRYPT_AND_VERIFY: { + decryptAndVerify(params); + break; } - break; } } } -- cgit v1.2.3 From e0111c2ec40b35db94f06d89c8ca50529fbbb401 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Sat, 15 Feb 2014 02:30:31 +0100 Subject: code simplifications --- .../keychain/demo/OpenPgpProviderActivity.java | 165 +++++++-------------- 1 file changed, 53 insertions(+), 112 deletions(-) (limited to 'OpenPGP-Keychain-API/example-app/src/main/java') 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 e578d0660..dee977657 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 @@ -44,6 +44,7 @@ import org.openintents.openpgp.util.OpenPgpServiceConnection; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.InputStream; +import java.io.OutputStream; import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.List; @@ -140,42 +141,63 @@ public class OpenPgpProviderActivity extends Activity { return is; } + private class MyCallback implements OpenPgpApi.IOpenPgpCallback { + boolean returnToCiphertextField; + ByteArrayOutputStream os; + int requestCode; - public void sign(Bundle params) { - params.putBoolean(OpenPgpConstants.PARAMS_REQUEST_ASCII_ARMOR, true); - - InputStream is = getInputstream(false); - final ByteArrayOutputStream os = new ByteArrayOutputStream(); - - OpenPgpApi api = new OpenPgpApi(mCryptoServiceConnection.getService()); - api.sign(params, is, os, new OpenPgpApi.IOpenPgpCallback() { - @Override - public void onReturn(Bundle result) { - switch (result.getInt(OpenPgpConstants.RESULT_CODE)) { - case OpenPgpConstants.RESULT_CODE_SUCCESS: { - try { - Log.d(OpenPgpConstants.TAG, "result: " + os.toByteArray().length - + " str=" + os.toString("UTF-8")); + private MyCallback(boolean returnToCiphertextField, ByteArrayOutputStream os, int requestCode) { + this.returnToCiphertextField = returnToCiphertextField; + this.os = os; + this.requestCode = requestCode; + } + @Override + public void onReturn(Bundle result) { + switch (result.getInt(OpenPgpConstants.RESULT_CODE)) { + case OpenPgpConstants.RESULT_CODE_SUCCESS: { + try { + Log.d(OpenPgpConstants.TAG, "result: " + os.toByteArray().length + + " str=" + os.toString("UTF-8")); + + if (returnToCiphertextField) { mCiphertext.setText(os.toString("UTF-8")); - } catch (UnsupportedEncodingException e) { - Log.e(Constants.TAG, "UnsupportedEncodingException", e); + } else { + mMessage.setText(os.toString("UTF-8")); } - break; + } catch (UnsupportedEncodingException e) { + Log.e(Constants.TAG, "UnsupportedEncodingException", e); } - case OpenPgpConstants.RESULT_CODE_USER_INTERACTION_REQUIRED: { - PendingIntent pi = result.getParcelable(OpenPgpConstants.RESULT_INTENT); - try { - OpenPgpProviderActivity.this.startIntentSenderForResult(pi.getIntentSender(), - REQUEST_CODE_SIGN, null, 0, 0, 0); - } catch (IntentSender.SendIntentException e) { - Log.e(Constants.TAG, "SendIntentException", e); - } - break; + break; + } + case OpenPgpConstants.RESULT_CODE_USER_INTERACTION_REQUIRED: { + PendingIntent pi = result.getParcelable(OpenPgpConstants.RESULT_INTENT); + try { + OpenPgpProviderActivity.this.startIntentSenderForResult(pi.getIntentSender(), + requestCode, null, 0, 0, 0); + } catch (IntentSender.SendIntentException e) { + Log.e(Constants.TAG, "SendIntentException", e); } + break; + } + case OpenPgpConstants.RESULT_CODE_ERROR: { + OpenPgpError error = result.getParcelable(OpenPgpConstants.RESULT_ERRORS); + handleError(error); + break; } } - }); + } + } + + + public void sign(Bundle params) { + params.putBoolean(OpenPgpConstants.PARAMS_REQUEST_ASCII_ARMOR, true); + + InputStream is = getInputstream(false); + final ByteArrayOutputStream os = new ByteArrayOutputStream(); + + OpenPgpApi api = new OpenPgpApi(mCryptoServiceConnection.getService()); + api.sign(params, is, os, new MyCallback(true, os, REQUEST_CODE_SIGN)); } public void encrypt(Bundle params) { @@ -186,34 +208,7 @@ public class OpenPgpProviderActivity extends Activity { final ByteArrayOutputStream os = new ByteArrayOutputStream(); OpenPgpApi api = new OpenPgpApi(mCryptoServiceConnection.getService()); - api.encrypt(params, is, os, new OpenPgpApi.IOpenPgpCallback() { - @Override - public void onReturn(Bundle result) { - switch (result.getInt(OpenPgpConstants.RESULT_CODE)) { - case OpenPgpConstants.RESULT_CODE_SUCCESS: { - try { - Log.d(OpenPgpConstants.TAG, "result: " + os.toByteArray().length - + " str=" + os.toString("UTF-8")); - - mCiphertext.setText(os.toString("UTF-8")); - } catch (UnsupportedEncodingException e) { - Log.e(Constants.TAG, "UnsupportedEncodingException", e); - } - break; - } - case OpenPgpConstants.RESULT_CODE_USER_INTERACTION_REQUIRED: { - PendingIntent pi = result.getParcelable(OpenPgpConstants.RESULT_INTENT); - try { - OpenPgpProviderActivity.this.startIntentSenderForResult(pi.getIntentSender(), - REQUEST_CODE_ENCRYPT, null, 0, 0, 0); - } catch (IntentSender.SendIntentException e) { - Log.e(Constants.TAG, "SendIntentException", e); - } - break; - } - } - } - }); + api.encrypt(params, is, os, new MyCallback(true, os, REQUEST_CODE_ENCRYPT)); } public void signAndEncrypt(Bundle params) { @@ -224,34 +219,7 @@ public class OpenPgpProviderActivity extends Activity { final ByteArrayOutputStream os = new ByteArrayOutputStream(); OpenPgpApi api = new OpenPgpApi(mCryptoServiceConnection.getService()); - api.signAndEncrypt(params, is, os, new OpenPgpApi.IOpenPgpCallback() { - @Override - public void onReturn(Bundle result) { - switch (result.getInt(OpenPgpConstants.RESULT_CODE)) { - case OpenPgpConstants.RESULT_CODE_SUCCESS: { - try { - Log.d(OpenPgpConstants.TAG, "result: " + os.toByteArray().length - + " str=" + os.toString("UTF-8")); - - mCiphertext.setText(os.toString("UTF-8")); - } catch (UnsupportedEncodingException e) { - Log.e(Constants.TAG, "UnsupportedEncodingException", e); - } - break; - } - case OpenPgpConstants.RESULT_CODE_USER_INTERACTION_REQUIRED: { - PendingIntent pi = result.getParcelable(OpenPgpConstants.RESULT_INTENT); - try { - OpenPgpProviderActivity.this.startIntentSenderForResult(pi.getIntentSender(), - REQUEST_CODE_SIGN_AND_ENCRYPT, null, 0, 0, 0); - } catch (IntentSender.SendIntentException e) { - Log.e(Constants.TAG, "SendIntentException", e); - } - break; - } - } - } - }); + api.signAndEncrypt(params, is, os, new MyCallback(true, os, REQUEST_CODE_SIGN_AND_ENCRYPT)); } public void decryptAndVerify(Bundle params) { @@ -261,34 +229,7 @@ public class OpenPgpProviderActivity extends Activity { final ByteArrayOutputStream os = new ByteArrayOutputStream(); OpenPgpApi api = new OpenPgpApi(mCryptoServiceConnection.getService()); - api.decryptAndVerify(params, is, os, new OpenPgpApi.IOpenPgpCallback() { - @Override - public void onReturn(Bundle result) { - switch (result.getInt(OpenPgpConstants.RESULT_CODE)) { - case OpenPgpConstants.RESULT_CODE_SUCCESS: { - try { - Log.d(OpenPgpConstants.TAG, "result: " + os.toByteArray().length - + " str=" + os.toString("UTF-8")); - - mMessage.setText(os.toString("UTF-8")); - } catch (UnsupportedEncodingException e) { - Log.e(Constants.TAG, "UnsupportedEncodingException", e); - } - break; - } - case OpenPgpConstants.RESULT_CODE_USER_INTERACTION_REQUIRED: { - PendingIntent pi = result.getParcelable(OpenPgpConstants.RESULT_INTENT); - try { - OpenPgpProviderActivity.this.startIntentSenderForResult(pi.getIntentSender(), - REQUEST_CODE_DECRYPT_AND_VERIFY, null, 0, 0, 0); - } catch (IntentSender.SendIntentException e) { - Log.e(Constants.TAG, "SendIntentException", e); - } - break; - } - } - } - }); + api.decryptAndVerify(params, is, os, new MyCallback(true, os, REQUEST_CODE_DECRYPT_AND_VERIFY)); } @Override -- cgit v1.2.3 From 3d59796337e99c0153cf173eba617d156f158d3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Sat, 15 Feb 2014 15:46:30 +0100 Subject: Fix problem with unparceling by setting class loader in api lib, remove unneeded aidl classes --- .../keychain/demo/OpenPgpProviderActivity.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'OpenPGP-Keychain-API/example-app/src/main/java') 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 dee977657..7e71ca45f 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 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013 Dominik Schürmann + * Copyright (C) 2013-2014 Dominik Schürmann * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,7 +44,6 @@ import org.openintents.openpgp.util.OpenPgpServiceConnection; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.InputStream; -import java.io.OutputStream; import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.List; @@ -196,7 +195,7 @@ public class OpenPgpProviderActivity extends Activity { InputStream is = getInputstream(false); final ByteArrayOutputStream os = new ByteArrayOutputStream(); - OpenPgpApi api = new OpenPgpApi(mCryptoServiceConnection.getService()); + OpenPgpApi api = new OpenPgpApi(this, mCryptoServiceConnection.getService()); api.sign(params, is, os, new MyCallback(true, os, REQUEST_CODE_SIGN)); } @@ -207,7 +206,7 @@ public class OpenPgpProviderActivity extends Activity { InputStream is = getInputstream(false); final ByteArrayOutputStream os = new ByteArrayOutputStream(); - OpenPgpApi api = new OpenPgpApi(mCryptoServiceConnection.getService()); + OpenPgpApi api = new OpenPgpApi(this, mCryptoServiceConnection.getService()); api.encrypt(params, is, os, new MyCallback(true, os, REQUEST_CODE_ENCRYPT)); } @@ -218,7 +217,7 @@ public class OpenPgpProviderActivity extends Activity { InputStream is = getInputstream(false); final ByteArrayOutputStream os = new ByteArrayOutputStream(); - OpenPgpApi api = new OpenPgpApi(mCryptoServiceConnection.getService()); + OpenPgpApi api = new OpenPgpApi(this, mCryptoServiceConnection.getService()); api.signAndEncrypt(params, is, os, new MyCallback(true, os, REQUEST_CODE_SIGN_AND_ENCRYPT)); } @@ -228,7 +227,7 @@ public class OpenPgpProviderActivity extends Activity { InputStream is = getInputstream(true); final ByteArrayOutputStream os = new ByteArrayOutputStream(); - OpenPgpApi api = new OpenPgpApi(mCryptoServiceConnection.getService()); + OpenPgpApi api = new OpenPgpApi(this, mCryptoServiceConnection.getService()); api.decryptAndVerify(params, is, os, new MyCallback(true, os, REQUEST_CODE_DECRYPT_AND_VERIFY)); } -- cgit v1.2.3 From 2b98f2a0d7e37542a062886437c3f7b14599a4da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Sat, 15 Feb 2014 17:09:21 +0100 Subject: Restructure API lib folder to support Eclipse --- .../org/sufficientlysecure/keychain/demo/OpenPgpProviderActivity.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenPGP-Keychain-API/example-app/src/main/java') 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 7e71ca45f..bf3943e1c 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 @@ -289,7 +289,7 @@ public class OpenPgpProviderActivity extends Activity { } private void selectCryptoProvider() { - Intent intent = new Intent(IOpenPgpService.class.getName()); + Intent intent = new Intent(OpenPgpConstants.SERVICE_INTENT); final ArrayList providerList = new ArrayList(); -- cgit v1.2.3 From 884aaf7e7ac24a54f54c4e714121869346b7a623 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Sat, 15 Feb 2014 18:44:13 +0100 Subject: save selected provider in list preference --- .../org/sufficientlysecure/keychain/demo/BaseActivity.java | 12 +----------- .../keychain/demo/OpenPgpProviderActivity.java | 13 ++++--------- 2 files changed, 5 insertions(+), 20 deletions(-) (limited to 'OpenPGP-Keychain-API/example-app/src/main/java') diff --git a/OpenPGP-Keychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/BaseActivity.java b/OpenPGP-Keychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/BaseActivity.java index 7e8818b5b..d37689afc 100644 --- a/OpenPGP-Keychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/BaseActivity.java +++ b/OpenPGP-Keychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/BaseActivity.java @@ -16,9 +16,6 @@ package org.sufficientlysecure.keychain.demo; -import org.sufficientlysecure.keychain.demo.R; - -import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.preference.Preference; @@ -27,10 +24,7 @@ import android.preference.PreferenceActivity; import android.widget.Toast; public class BaseActivity extends PreferenceActivity { - private Activity mActivity; - private Preference mIntentDemo; - private Preference mContentProviderDemo; private Preference mCryptoProvider; /** @@ -40,14 +34,11 @@ public class BaseActivity extends PreferenceActivity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - mActivity = this; - // load preferences from xml addPreferencesFromResource(R.xml.base_preference); // find preferences mIntentDemo = (Preference) findPreference("intent_demo"); - mContentProviderDemo = (Preference) findPreference("content_provider_demo"); mCryptoProvider = (Preference) findPreference("openpgp_provider_demo"); mIntentDemo.setOnPreferenceClickListener(new OnPreferenceClickListener() { @@ -63,12 +54,11 @@ public class BaseActivity extends PreferenceActivity { mCryptoProvider.setOnPreferenceClickListener(new OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { - startActivity(new Intent(mActivity, OpenPgpProviderActivity.class)); + startActivity(new Intent(BaseActivity.this, OpenPgpProviderActivity.class)); return false; } }); - } } 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 bf3943e1c..7b1aecae9 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 @@ -35,7 +35,6 @@ import android.widget.ListAdapter; import android.widget.TextView; import android.widget.Toast; -import org.openintents.openpgp.IOpenPgpService; import org.openintents.openpgp.OpenPgpError; import org.openintents.openpgp.util.OpenPgpApi; import org.openintents.openpgp.util.OpenPgpConstants; @@ -49,8 +48,6 @@ import java.util.ArrayList; import java.util.List; public class OpenPgpProviderActivity extends Activity { - Activity mActivity; - EditText mMessage; EditText mCiphertext; EditText mEncryptUserIds; @@ -59,7 +56,7 @@ public class OpenPgpProviderActivity extends Activity { Button mSignAndEncrypt; Button mDecryptAndVerify; - private OpenPgpServiceConnection mCryptoServiceConnection; + OpenPgpServiceConnection mCryptoServiceConnection; public static final int REQUEST_CODE_SIGN = 9910; public static final int REQUEST_CODE_ENCRYPT = 9911; @@ -71,16 +68,14 @@ public class OpenPgpProviderActivity extends Activity { super.onCreate(icicle); setContentView(R.layout.openpgp_provider); - mActivity = this; - mMessage = (EditText) findViewById(R.id.crypto_provider_demo_message); mCiphertext = (EditText) findViewById(R.id.crypto_provider_demo_ciphertext); mEncryptUserIds = (EditText) findViewById(R.id.crypto_provider_demo_encrypt_user_id); - mSign = (Button) findViewById(R.id.crypto_provider_demo_sign); mEncrypt = (Button) findViewById(R.id.crypto_provider_demo_encrypt); mSignAndEncrypt = (Button) findViewById(R.id.crypto_provider_demo_sign_and_encrypt); mDecryptAndVerify = (Button) findViewById(R.id.crypto_provider_demo_decrypt_and_verify); + mSign.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { @@ -110,11 +105,11 @@ public class OpenPgpProviderActivity extends Activity { } private void handleError(final OpenPgpError error) { - mActivity.runOnUiThread(new Runnable() { + runOnUiThread(new Runnable() { @Override public void run() { - Toast.makeText(mActivity, + Toast.makeText(OpenPgpProviderActivity.this, "onError id:" + error.getErrorId() + "\n\n" + error.getMessage(), Toast.LENGTH_LONG).show(); Log.e(Constants.TAG, "onError getErrorId:" + error.getErrorId()); -- cgit v1.2.3 From ea361f4bf50fca2dea96e83a186fff7bb01bccd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Sat, 15 Feb 2014 18:51:58 +0100 Subject: select provider with preference --- .../keychain/demo/OpenPgpProviderActivity.java | 96 ++++------------------ 1 file changed, 14 insertions(+), 82 deletions(-) (limited to 'OpenPGP-Keychain-API/example-app/src/main/java') 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 7b1aecae9..33a94de61 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 @@ -22,9 +22,12 @@ import android.app.PendingIntent; import android.content.DialogInterface; import android.content.Intent; import android.content.IntentSender; +import android.content.SharedPreferences; import android.content.pm.ResolveInfo; import android.graphics.drawable.Drawable; import android.os.Bundle; +import android.preference.PreferenceManager; +import android.text.TextUtils; import android.util.Log; import android.view.View; import android.view.ViewGroup; @@ -101,7 +104,17 @@ public class OpenPgpProviderActivity extends Activity { } }); - selectCryptoProvider(); + SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this); + String providerPackageName = settings.getString("openpgp_provider_list", ""); + if (TextUtils.isEmpty(providerPackageName)) { + Toast.makeText(this, "No OpenPGP Provider selected!", Toast.LENGTH_LONG).show(); + finish(); + } else { + // bind to service + mCryptoServiceConnection = new OpenPgpServiceConnection( + OpenPgpProviderActivity.this, providerPackageName); + mCryptoServiceConnection.bindToService(); + } } private void handleError(final OpenPgpError error) { @@ -283,85 +296,4 @@ public class OpenPgpProviderActivity extends Activity { } } - private void selectCryptoProvider() { - Intent intent = new Intent(OpenPgpConstants.SERVICE_INTENT); - - final ArrayList providerList = new ArrayList(); - - List resInfo = getPackageManager().queryIntentServices(intent, 0); - if (!resInfo.isEmpty()) { - for (ResolveInfo resolveInfo : resInfo) { - if (resolveInfo.serviceInfo == null) - continue; - - String packageName = resolveInfo.serviceInfo.packageName; - String simpleName = String.valueOf(resolveInfo.serviceInfo - .loadLabel(getPackageManager())); - Drawable icon = resolveInfo.serviceInfo.loadIcon(getPackageManager()); - providerList.add(new OpenPgpProviderElement(packageName, simpleName, icon)); - } - } - - AlertDialog.Builder alert = new AlertDialog.Builder(this); - alert.setTitle("Select OpenPGP Provider!"); - alert.setCancelable(false); - - if (!providerList.isEmpty()) { - // add "disable OpenPGP provider" - providerList.add(0, new OpenPgpProviderElement(null, "Disable OpenPGP Provider", - getResources().getDrawable(android.R.drawable.ic_menu_close_clear_cancel))); - - // Init ArrayAdapter with OpenPGP Providers - ListAdapter adapter = new ArrayAdapter(this, - android.R.layout.select_dialog_item, android.R.id.text1, providerList) { - public View getView(int position, View convertView, ViewGroup parent) { - // User super class to create the View - View v = super.getView(position, convertView, parent); - TextView tv = (TextView) v.findViewById(android.R.id.text1); - - // Put the image on the TextView - tv.setCompoundDrawablesWithIntrinsicBounds(providerList.get(position).icon, - null, null, null); - - // Add margin between image and text (support various screen densities) - int dp5 = (int) (5 * getResources().getDisplayMetrics().density + 0.5f); - tv.setCompoundDrawablePadding(dp5); - - return v; - } - }; - - alert.setSingleChoiceItems(adapter, -1, new DialogInterface.OnClickListener() { - - public void onClick(DialogInterface dialog, int position) { - String packageName = providerList.get(position).packageName; - - if (packageName == null) { - dialog.cancel(); - finish(); - } - - // bind to service - mCryptoServiceConnection = new OpenPgpServiceConnection( - OpenPgpProviderActivity.this, packageName); - mCryptoServiceConnection.bindToService(); - - dialog.dismiss(); - } - }); - } else { - alert.setMessage("No OpenPGP Provider installed!"); - } - - alert.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { - - public void onClick(DialogInterface dialog, int id) { - dialog.cancel(); - finish(); - } - }); - - AlertDialog ad = alert.create(); - ad.show(); - } } -- cgit v1.2.3 From dc16601458db76ee9a3daa4438cd681d8f431953 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Sat, 15 Feb 2014 19:12:50 +0100 Subject: fix layout --- .../keychain/demo/OpenPgpProviderActivity.java | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'OpenPGP-Keychain-API/example-app/src/main/java') 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 33a94de61..5e8ecfb22 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 @@ -17,25 +17,20 @@ package org.sufficientlysecure.keychain.demo; import android.app.Activity; -import android.app.AlertDialog; import android.app.PendingIntent; -import android.content.DialogInterface; import android.content.Intent; import android.content.IntentSender; import android.content.SharedPreferences; -import android.content.pm.ResolveInfo; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.preference.PreferenceManager; import android.text.TextUtils; import android.util.Log; +import android.view.MotionEvent; import android.view.View; -import android.view.ViewGroup; -import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; -import android.widget.ListAdapter; -import android.widget.TextView; +import android.widget.ScrollView; import android.widget.Toast; import org.openintents.openpgp.OpenPgpError; @@ -47,8 +42,6 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.InputStream; import java.io.UnsupportedEncodingException; -import java.util.ArrayList; -import java.util.List; public class OpenPgpProviderActivity extends Activity { EditText mMessage; -- cgit v1.2.3 From e70886e24253500cd4c93be6638c485fb93efd79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Sat, 15 Feb 2014 19:18:42 +0100 Subject: cleanup --- .../keychain/demo/OpenPgpProviderActivity.java | 44 ++++++++-------------- 1 file changed, 15 insertions(+), 29 deletions(-) (limited to 'OpenPGP-Keychain-API/example-app/src/main/java') 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 5e8ecfb22..24d1c0456 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 @@ -21,16 +21,13 @@ import android.app.PendingIntent; import android.content.Intent; import android.content.IntentSender; import android.content.SharedPreferences; -import android.graphics.drawable.Drawable; import android.os.Bundle; import android.preference.PreferenceManager; import android.text.TextUtils; import android.util.Log; -import android.view.MotionEvent; import android.view.View; import android.widget.Button; import android.widget.EditText; -import android.widget.ScrollView; import android.widget.Toast; import org.openintents.openpgp.OpenPgpError; @@ -52,7 +49,7 @@ public class OpenPgpProviderActivity extends Activity { Button mSignAndEncrypt; Button mDecryptAndVerify; - OpenPgpServiceConnection mCryptoServiceConnection; + OpenPgpServiceConnection mServiceConnection; public static final int REQUEST_CODE_SIGN = 9910; public static final int REQUEST_CODE_ENCRYPT = 9911; @@ -104,9 +101,9 @@ public class OpenPgpProviderActivity extends Activity { finish(); } else { // bind to service - mCryptoServiceConnection = new OpenPgpServiceConnection( + mServiceConnection = new OpenPgpServiceConnection( OpenPgpProviderActivity.this, providerPackageName); - mCryptoServiceConnection.bindToService(); + mServiceConnection.bindToService(); } } @@ -124,6 +121,12 @@ public class OpenPgpProviderActivity extends Activity { }); } + /** + * Takes input from message or ciphertext EditText and turns it into a ByteArrayInputStream + * + * @param ciphertext + * @return + */ private InputStream getInputstream(boolean ciphertext) { InputStream is = null; try { @@ -196,7 +199,7 @@ public class OpenPgpProviderActivity extends Activity { InputStream is = getInputstream(false); final ByteArrayOutputStream os = new ByteArrayOutputStream(); - OpenPgpApi api = new OpenPgpApi(this, mCryptoServiceConnection.getService()); + OpenPgpApi api = new OpenPgpApi(this, mServiceConnection.getService()); api.sign(params, is, os, new MyCallback(true, os, REQUEST_CODE_SIGN)); } @@ -207,7 +210,7 @@ public class OpenPgpProviderActivity extends Activity { InputStream is = getInputstream(false); final ByteArrayOutputStream os = new ByteArrayOutputStream(); - OpenPgpApi api = new OpenPgpApi(this, mCryptoServiceConnection.getService()); + OpenPgpApi api = new OpenPgpApi(this, mServiceConnection.getService()); api.encrypt(params, is, os, new MyCallback(true, os, REQUEST_CODE_ENCRYPT)); } @@ -218,7 +221,7 @@ public class OpenPgpProviderActivity extends Activity { InputStream is = getInputstream(false); final ByteArrayOutputStream os = new ByteArrayOutputStream(); - OpenPgpApi api = new OpenPgpApi(this, mCryptoServiceConnection.getService()); + OpenPgpApi api = new OpenPgpApi(this, mServiceConnection.getService()); api.signAndEncrypt(params, is, os, new MyCallback(true, os, REQUEST_CODE_SIGN_AND_ENCRYPT)); } @@ -228,7 +231,7 @@ public class OpenPgpProviderActivity extends Activity { InputStream is = getInputstream(true); final ByteArrayOutputStream os = new ByteArrayOutputStream(); - OpenPgpApi api = new OpenPgpApi(this, mCryptoServiceConnection.getService()); + OpenPgpApi api = new OpenPgpApi(this, mServiceConnection.getService()); api.decryptAndVerify(params, is, os, new MyCallback(true, os, REQUEST_CODE_DECRYPT_AND_VERIFY)); } @@ -267,25 +270,8 @@ public class OpenPgpProviderActivity extends Activity { public void onDestroy() { super.onDestroy(); - if (mCryptoServiceConnection != null) { - mCryptoServiceConnection.unbindFromService(); - } - } - - private static class OpenPgpProviderElement { - private String packageName; - private String simpleName; - private Drawable icon; - - public OpenPgpProviderElement(String packageName, String simpleName, Drawable icon) { - this.packageName = packageName; - this.simpleName = simpleName; - this.icon = icon; - } - - @Override - public String toString() { - return simpleName; + if (mServiceConnection != null) { + mServiceConnection.unbindFromService(); } } -- cgit v1.2.3 From 81b810e9f6cee2ac549758563fcd8987806828a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Sat, 15 Feb 2014 20:14:23 +0100 Subject: intent demo, fix some intents --- .../keychain/demo/BaseActivity.java | 5 +- .../keychain/demo/IntentActivity.java | 209 +++++++++++++++++++++ 2 files changed, 211 insertions(+), 3 deletions(-) create mode 100644 OpenPGP-Keychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/IntentActivity.java (limited to 'OpenPGP-Keychain-API/example-app/src/main/java') diff --git a/OpenPGP-Keychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/BaseActivity.java b/OpenPGP-Keychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/BaseActivity.java index d37689afc..dd642d879 100644 --- a/OpenPGP-Keychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/BaseActivity.java +++ b/OpenPGP-Keychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/BaseActivity.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Dominik Schürmann + * Copyright (C) 2012-2014 Dominik Schürmann * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,8 +44,7 @@ public class BaseActivity extends PreferenceActivity { mIntentDemo.setOnPreferenceClickListener(new OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { - // startActivity(new Intent(mActivity, IntentDemoActivity.class)); - Toast.makeText(BaseActivity.this, "Not implemented!", Toast.LENGTH_LONG).show(); + startActivity(new Intent(BaseActivity.this, IntentActivity.class)); return false; } diff --git a/OpenPGP-Keychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/IntentActivity.java b/OpenPGP-Keychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/IntentActivity.java new file mode 100644 index 000000000..8fe0d2d9c --- /dev/null +++ b/OpenPGP-Keychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/IntentActivity.java @@ -0,0 +1,209 @@ +/* + * Copyright (C) 2014 Dominik Schürmann + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.sufficientlysecure.keychain.demo; + +import android.content.ActivityNotFoundException; +import android.content.Intent; +import android.database.Cursor; +import android.net.Uri; +import android.os.Bundle; +import android.preference.Preference; +import android.preference.Preference.OnPreferenceClickListener; +import android.preference.PreferenceActivity; +import android.provider.MediaStore; +import android.util.Log; +import android.widget.Toast; + +import org.sufficientlysecure.keychain.api.KeychainIntents; + +public class IntentActivity extends PreferenceActivity { + + private static final int SELECT_PHOTO = 100; + + /** + * Called when the activity is first created. + */ + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + // load preferences from xml + addPreferencesFromResource(R.xml.intent_preference); + + // find preferences + Preference encrypt = (Preference) findPreference("ENCRYPT"); + Preference encryptUri = (Preference) findPreference("ENCRYPT_URI"); + Preference decrypt = (Preference) findPreference("DECRYPT"); + Preference import_key = (Preference) findPreference("IMPORT_KEY"); + Preference import_key_from_keyserver = (Preference) findPreference("IMPORT_KEY_FROM_KEYSERVER"); + Preference import_key_from_qr_code = (Preference) findPreference("IMPORT_KEY_FROM_QR_CODE"); + Preference openpgp4fpr = (Preference) findPreference("openpgp4fpr"); + + encrypt.setOnPreferenceClickListener(new OnPreferenceClickListener() { + @Override + public boolean onPreferenceClick(Preference preference) { + try { + Intent intent = new Intent(KeychainIntents.ENCRYPT); + intent.putExtra(KeychainIntents.ENCRYPT_EXTRA_TEXT, "Hello world!"); + startActivity(intent); + } catch (ActivityNotFoundException e) { + Toast.makeText(IntentActivity.this, "Activity not found!", Toast.LENGTH_LONG).show(); + } + + return false; + } + }); + + encryptUri.setOnPreferenceClickListener(new OnPreferenceClickListener() { + @Override + public boolean onPreferenceClick(Preference preference) { + Intent photoPickerIntent = new Intent(Intent.ACTION_PICK); + photoPickerIntent.setType("image/*"); + startActivityForResult(photoPickerIntent, SELECT_PHOTO); + + return false; + } + }); + + decrypt.setOnPreferenceClickListener(new OnPreferenceClickListener() { + @Override + public boolean onPreferenceClick(Preference preference) { + String text = "-----BEGIN PGP SIGNED MESSAGE-----\n" + + "Hash: SHA1\n" + + "\n" + + "Hello world!\n" + + "-----BEGIN PGP SIGNATURE-----\n" + + "Version: GnuPG v1.4.12 (GNU/Linux)\n" + + "Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/\n" + + "\n" + + "iQEcBAEBAgAGBQJS/7vTAAoJEHGMBwEAASKCkGYH/2jBLzamVyqd61jrjMQM0jUv\n" + + "MkDcPUxPrYH3wZOO0HcgdBQEo66GZEC2ATmo8izJUMk35Q5jas99k0ac9pXhPUPE\n" + + "5qDXdQS10S07R6J0SeDYFWDSyrSiDTCZpFkVu3JGP/3S0SkMYXPzfYlh8Ciuxu7i\n" + + "FR5dmIiz3VQaBgTBSCBFEomNFM5ypynBJqKIzIty8v0NbV72Rtg6Xg76YqWQ/6MC\n" + + "/MlT3y3++HhfpEmLf5WLEXljbuZ4SfCybgYXG9gBzhJu3+gmBoSicdYTZDHSxBBR\n" + + "BwI+ueLbhgRz+gU+WJFE7xNw35xKtBp1C4PR0iKI8rZCSHLjsRVzor7iwDaR51M=\n" + + "=3Ydc\n" + + "-----END PGP SIGNATURE-----"; + try { + Intent intent = new Intent(KeychainIntents.DECRYPT); + intent.putExtra(KeychainIntents.DECRYPT_EXTRA_TEXT, text); + startActivity(intent); + } catch (ActivityNotFoundException e) { + Toast.makeText(IntentActivity.this, "Activity not found!", Toast.LENGTH_LONG).show(); + } + + return false; + } + }); + + import_key.setOnPreferenceClickListener(new OnPreferenceClickListener() { + @Override + public boolean onPreferenceClick(Preference preference) { + try { + Intent intent = new Intent(KeychainIntents.IMPORT_KEY); +// intent.putExtra(KeychainIntents.IMPORT_KEY_EXTRA_KEY_BYTES, TODO); + startActivity(intent); + } catch (ActivityNotFoundException e) { + Toast.makeText(IntentActivity.this, "Activity not found!", Toast.LENGTH_LONG).show(); + } + + return false; + } + }); + + import_key_from_keyserver.setOnPreferenceClickListener(new OnPreferenceClickListener() { + @Override + public boolean onPreferenceClick(Preference preference) { + try { + Intent intent = new Intent(KeychainIntents.IMPORT_KEY_FROM_KEYSERVER); + intent.putExtra(KeychainIntents.IMPORT_KEY_FROM_KEYSERVER_QUERY, "Richard Stallman"); + startActivity(intent); + } catch (ActivityNotFoundException e) { + Toast.makeText(IntentActivity.this, "Activity not found!", Toast.LENGTH_LONG).show(); + } + + return false; + } + }); + + import_key_from_qr_code.setOnPreferenceClickListener(new OnPreferenceClickListener() { + @Override + public boolean onPreferenceClick(Preference preference) { + try { + Intent intent = new Intent(KeychainIntents.IMPORT_KEY_FROM_QR_CODE); + startActivity(intent); + } catch (ActivityNotFoundException e) { + Toast.makeText(IntentActivity.this, "Activity not found!", Toast.LENGTH_LONG).show(); + } + + return false; + } + }); + + openpgp4fpr.setOnPreferenceClickListener(new OnPreferenceClickListener() { + @Override + public boolean onPreferenceClick(Preference preference) { + try { + Intent intent = new Intent(Intent.ACTION_VIEW); + intent.setData(Uri.parse("openpgp4fpr:73EE2314F65FA92EC2390D3A718C070100012282")); + startActivity(intent); + } catch (ActivityNotFoundException e) { + Toast.makeText(IntentActivity.this, "Activity not found!", Toast.LENGTH_LONG).show(); + } + + return false; + } + }); + + + } + + protected void onActivityResult(int requestCode, int resultCode, Intent imageReturnedIntent) { + super.onActivityResult(requestCode, resultCode, imageReturnedIntent); + + switch (requestCode) { + case SELECT_PHOTO: + if (resultCode == RESULT_OK) { + Uri selectedImage = imageReturnedIntent.getData(); + + String[] filePathColumn = {MediaStore.Images.Media.DATA}; + + Cursor cursor = getContentResolver().query( + selectedImage, filePathColumn, null, null, null); + cursor.moveToFirst(); + + int columnIndex = cursor.getColumnIndex(filePathColumn[0]); + String filePath = cursor.getString(columnIndex); + cursor.close(); + + // TODO: after fixing DECRYPT, we could use Uri selectedImage directly + Log.d(Constants.TAG, "filePath: " + filePath); + + try { + Intent intent = new Intent(KeychainIntents.ENCRYPT); + Uri dataUri = Uri.parse("file://" + filePath); + Log.d(Constants.TAG, "Uri: " + dataUri); + intent.setData(dataUri); + startActivity(intent); + } catch (ActivityNotFoundException e) { + Toast.makeText(IntentActivity.this, "Activity not found!", Toast.LENGTH_LONG).show(); + } + } + } + } + +} -- cgit v1.2.3 From ec2ca61b65b881a9f5d3c572d85d770ba8a31abb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Sun, 16 Feb 2014 00:40:10 +0100 Subject: fix some intents and demos --- .../keychain/demo/IntentActivity.java | 411 ++++++++++++++++++++- 1 file changed, 393 insertions(+), 18 deletions(-) (limited to 'OpenPGP-Keychain-API/example-app/src/main/java') diff --git a/OpenPGP-Keychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/IntentActivity.java b/OpenPGP-Keychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/IntentActivity.java index 8fe0d2d9c..0fcc0c248 100644 --- a/OpenPGP-Keychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/IntentActivity.java +++ b/OpenPGP-Keychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/IntentActivity.java @@ -30,6 +30,8 @@ import android.widget.Toast; import org.sufficientlysecure.keychain.api.KeychainIntents; +import java.io.UnsupportedEncodingException; + public class IntentActivity extends PreferenceActivity { private static final int SELECT_PHOTO = 100; @@ -53,6 +55,15 @@ public class IntentActivity extends PreferenceActivity { Preference import_key_from_qr_code = (Preference) findPreference("IMPORT_KEY_FROM_QR_CODE"); Preference openpgp4fpr = (Preference) findPreference("openpgp4fpr"); + // To prevent Android Studio from complaining... + assert encrypt != null; + assert encryptUri != null; + assert decrypt != null; + assert import_key != null; + assert import_key_from_keyserver != null; + assert import_key_from_qr_code != null; + assert openpgp4fpr != null; + encrypt.setOnPreferenceClickListener(new OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { @@ -82,25 +93,9 @@ public class IntentActivity extends PreferenceActivity { decrypt.setOnPreferenceClickListener(new OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { - String text = "-----BEGIN PGP SIGNED MESSAGE-----\n" + - "Hash: SHA1\n" + - "\n" + - "Hello world!\n" + - "-----BEGIN PGP SIGNATURE-----\n" + - "Version: GnuPG v1.4.12 (GNU/Linux)\n" + - "Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/\n" + - "\n" + - "iQEcBAEBAgAGBQJS/7vTAAoJEHGMBwEAASKCkGYH/2jBLzamVyqd61jrjMQM0jUv\n" + - "MkDcPUxPrYH3wZOO0HcgdBQEo66GZEC2ATmo8izJUMk35Q5jas99k0ac9pXhPUPE\n" + - "5qDXdQS10S07R6J0SeDYFWDSyrSiDTCZpFkVu3JGP/3S0SkMYXPzfYlh8Ciuxu7i\n" + - "FR5dmIiz3VQaBgTBSCBFEomNFM5ypynBJqKIzIty8v0NbV72Rtg6Xg76YqWQ/6MC\n" + - "/MlT3y3++HhfpEmLf5WLEXljbuZ4SfCybgYXG9gBzhJu3+gmBoSicdYTZDHSxBBR\n" + - "BwI+ueLbhgRz+gU+WJFE7xNw35xKtBp1C4PR0iKI8rZCSHLjsRVzor7iwDaR51M=\n" + - "=3Ydc\n" + - "-----END PGP SIGNATURE-----"; try { Intent intent = new Intent(KeychainIntents.DECRYPT); - intent.putExtra(KeychainIntents.DECRYPT_EXTRA_TEXT, text); + intent.putExtra(KeychainIntents.DECRYPT_EXTRA_TEXT, TEST_SIGNED_MESSAGE); startActivity(intent); } catch (ActivityNotFoundException e) { Toast.makeText(IntentActivity.this, "Activity not found!", Toast.LENGTH_LONG).show(); @@ -115,7 +110,13 @@ public class IntentActivity extends PreferenceActivity { public boolean onPreferenceClick(Preference preference) { try { Intent intent = new Intent(KeychainIntents.IMPORT_KEY); -// intent.putExtra(KeychainIntents.IMPORT_KEY_EXTRA_KEY_BYTES, TODO); + byte[] pubkey = null; + try { + pubkey = TEST_PUBKEY.getBytes("UTF-8"); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + intent.putExtra(KeychainIntents.IMPORT_KEY_EXTRA_KEY_BYTES, pubkey); startActivity(intent); } catch (ActivityNotFoundException e) { Toast.makeText(IntentActivity.this, "Activity not found!", Toast.LENGTH_LONG).show(); @@ -206,4 +207,378 @@ public class IntentActivity extends PreferenceActivity { } } + private static final String TEST_SIGNED_MESSAGE = "-----BEGIN PGP SIGNED MESSAGE-----\n" + + "Hash: SHA1\n" + + "\n" + + "Hello world!\n" + + "-----BEGIN PGP SIGNATURE-----\n" + + "Version: GnuPG v1.4.12 (GNU/Linux)\n" + + "Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/\n" + + "\n" + + "iQEcBAEBAgAGBQJS/7vTAAoJEHGMBwEAASKCkGYH/2jBLzamVyqd61jrjMQM0jUv\n" + + "MkDcPUxPrYH3wZOO0HcgdBQEo66GZEC2ATmo8izJUMk35Q5jas99k0ac9pXhPUPE\n" + + "5qDXdQS10S07R6J0SeDYFWDSyrSiDTCZpFkVu3JGP/3S0SkMYXPzfYlh8Ciuxu7i\n" + + "FR5dmIiz3VQaBgTBSCBFEomNFM5ypynBJqKIzIty8v0NbV72Rtg6Xg76YqWQ/6MC\n" + + "/MlT3y3++HhfpEmLf5WLEXljbuZ4SfCybgYXG9gBzhJu3+gmBoSicdYTZDHSxBBR\n" + + "BwI+ueLbhgRz+gU+WJFE7xNw35xKtBp1C4PR0iKI8rZCSHLjsRVzor7iwDaR51M=\n" + + "=3Ydc\n" + + "-----END PGP SIGNATURE-----"; + + private static final String TEST_PUBKEY = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" + + "Version: GnuPG v1.4.12 (GNU/Linux)\n" + + "\n" + + "mQENBEuG/qABCACZeLHynGVXn7Ou6MKE2GzSTGPWGrA86uHwHPUbbTUR7tYTUWeA\n" + + "Ur+l+lR3GRTbcQY4ColGUcDcTVlW/cp9jhHnbbSIS0uJvW+4yu3I5eSIIoI09PLY\n" + + "KjT0U5l2z6t6daL7qWfZ1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GaB08WotRUcFRub6fc7gT7QmsXrx8YWYaBIWlhW/U\n" + + "/yliJdZeMawKc7tgLkpf6qM1GerTgzkf44r3rXHl+ImlizdQhFhUGJFbkisiqYzU\n" + + "caMmNkPWNg28e6dcUU7nfprt99IbSSdhPAxPd6B6bzUawwV/VnpNXIrH+048lgsh\n" + + "FO45JceUfSadpK2p2UXVUP/TfYYY2xBwvoCjAsD4Q9YYheJsWh7i3xi9/0EzfSPB\n" + + "1NpLdaujAO8CuTTZ4NlpTLOZFmksQSF4BSpcPC+8TUGwAKXIm2wwIUNm1sBwXNsZ\n" + + "aOtAz3vQH3pKTzvXQEoCMCqoqkYS+uTGilwhmlSivfenB7DT3TX8DHnUzT1eNlh/\n" + + "PfCmdufvGS4BodAYPgTfmq2B7bpohFOXzjwiIJ4AJfaYhdyQ/PqN9JLShokCHAQQ\n" + + "AQIABgUCUQZr1QAKCRDIIhUzoaoywpfcD/wJveyGF8c24F6O5O2LX7yWmJ9LWs9t\n" + + "9z7c0gMom/eQMyoFh2VWHnBhNfR635RtSWFasMJSEpPd0iyIz95eaXpsjdn408jC\n" + + "8yGZD8N9EMkSbtGrcMExoyH+Tobx2Xs0mBDrG0TZdK07dW3q75asNFtU52isxC60\n" + + "WTJKUJud5vfms0cnp+sRCewvwssOyaIYzqg9J4/GZIpY6d9Roi9u+7FIUnzQJN4d\n" + + "zsDxBOsKZAVnyDaaaDMWXEV15BVwwFCap58e5HzL/NKK2uJMyMwBpPjZM4CYiWL+\n" + + "DVNvedids4iuNezyYKJns+LSo7zl/Rv1IQKPhg6BRbxgKu+DZt7iYI0vEl7PJNIM\n" + + "Ex77BZI/DUVZWXlE9g1bB4sP3iMBq1998VvWsTbA6CLRMYQvN5GWzlPyCICx2N9V\n" + + "dRD8Y+ySBtXMSLTe/kMXvnpMvYl5Yree/mSRirqA5Z/sZtw+SpTdtXEgoPpuCouc\n" + + "KKvxWkyDZX3Ehre/wDsOFN9XZfEp79SYym27rqMr6QPx6UQOPYd05soqM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" + + "Hqv2AH1F4yWtjQCgvGQK6MsOuO9QBcqFJmVBHPUPWk2JAhwEEwEIAAYFAlEMbTQA\n" + + "CgkQrpk18w7U8BBHfg//be7uVhY/hE04S4NrR6IG/k+9gMQHmH6OAylKWvfd8CuV\n" + + "npd3ZmZGosWAxRaizaET8OPATP+Wojbuved0/dFL2cras/+GKWleuWI3qxFAAqSx\n" + + "SGDilpladdQZbyHfrAHWFwpwEl51wsc9LkcAd9lywv0wbPzV4oFqEqbPM+wNW5jS\n" + + "N1W5doj2A3MUw17ocRtk2XmzhF819w++t16Alweg0QrfEx5mwli/Z17FcYUC21Wc\n" + + "04eDL8s/j3U3SYjBvzNIrtx2JiS/MdtewjvAWAeEoFusNcwbYn8J+2qiTrh3twR3\n" + + "AU7xU1s2a3GxjjQ+J/HXr52Eujd4nk/V8Au+NYAWlCoR99ByVfzG7tsjaGPysHb7\n" + + "KkGVIAlXM0brKwQvRhvGsN0+8mjfM+xl58AVV+w/K2MUTyWHyAMigvXtK0lBGcHb\n" + + "YATLBD98dUTkeF49oHAFriw2fLqes4ayqqouiLj7RfNHDQ4X41PkxlaSq8GrXHig\n" + + "jUKKod//taTViZU2JYL9ZIAGzDaV483pVZpQlBqeWBaaHTlk/fBrFfIxQ8gxrAX+\n" + + "Izano++z5tFPgKPBFisDcLt6g5x53ADh3Ax94a0sR8aoBzeJYlvRLG2OLuzok059\n" + + "CcvAG/lCYJTpz3LSsWdV2VqDk9LLqh+uzHmA1SVvYyxHz6IEYLGxNhEOPqC4JDSJ\n" + + "ARwEEAECAAYFAlEZK/kACgkQ6kRcQQePqI3KNQf/cAik9KuU5q2LRzagJLpVqIGg\n" + + "f7Yu57EQ5yENFbL8BJoVn/CMXsx8btDeouGkUXYVDtn5ThrGOHAs2OYEQSF3HSFp\n" + + "xqUci5rVLBoYwq8WcbGihg/YA3T1m9T+hGx7uhvDQOUDxjggcwxuTaHGmbIoDHaw\n" + + "BtlS2iznyku43ip0yazqrz79CPTJ7DrGe25q6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6K+0fkPteh8ESx+H1WSgeJAhwEEAEC\n" + + "AAYFAlEGYFsACgkQYrnc/2YkwaIpgA/9HKKyfO5oJpV3bUXf0IZGTgrVISiVY90t\n" + + "IbX0qkyGVFwEovp8eRJ0B6cluQiNypjKY+5xh0wYbexk2El53dNDkTfisfVM5ib7\n" + + "a7aMAMQ6R99zFVtag/eXmAWzKcL8x3RdVyRFSttwrGwDlrv8VpQByYYSnUPWvzZs\n" + + "YJQL+XgHqVLzK16/oZ5rzBvzbIH0oFm7HoGqKsRGDEL2hkNRhjuDlxrzijSqQfqY\n" + + "qhMqQAjf6fenpVFFPXr8TY4RXRRcBFq1aP3Xp2Vq1ekwgzHTokryWEyZTdsVXoMU\n" + + "Tmjk/sZ4R61N5YW3EEyGuG2E9wgZD8FmUElJTAduZPH16JcfO4KUXsNSXap8yKJ6\n" + + "yZ47TvbNcwQq7IhxbwimhaR4pbBpcOfQEpdHA24csOBPJ5Ly02LpAs0ZuhmOvDLW\n" + + "Yxxr9++Sm+5UBcAMav+N69f3lUnIc/MhDI0uYLe762z7cs5opIx8Fr64GZn30SY9\n" + + "OMpce9UwsmhurO9T/0CKpKeZEynKUHcCWgsdsbDULhuCLr9WypzCy9wJm79bYwqE\n" + + "sAJGqK5i1Qxdp0O7VJkPaR1FTdTWazW6phWCnlskpWKtRmu09v9vosqnzd6vSKqo\n" + + "q/uL1i1lGvAyKdLSEBc8yrTUTrH82uFRZejcUgR2+f2BslZvPMtQlyQW35D9373A\n" + + "MQxZYPg7vNmJAhwEEAECAAYFAlEGa9UACgkQyCIVM6GqMsI8jRAAxjj0Z/62i+Jd\n" + + "Yy9iYuUXZyfLh5vexn89pesMgETaopNlv0OAT4rthpujmRCVLV/hN3XG94H/G5yW\n" + + "trwzokBz3a7JDdPVSWsLWibANx1zzukG2FkKEl1gWJyoTQ69xet7jZK3p9xl/xEH\n" + + "zS7t3rhniTqxViIpRIiHb5tSR/ESDIlR9tvoQwuoriI8TZd0tOkLS1myN+US39jf\n"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9NGQC4GTE+8c/qFoiEYEEBECAAYFAlEK\n" + + "tfgACgkQBLW/NVdwg0qDGACeKq99OOyDJS1cCvAGJZeFRN6mmSkAoIDydwBZu23Z\n" + + "ghKLi9JFSnQj80A6iQIcBBMBCAAGBQJRDG00AAoJEK6ZNfMO1PAQbeYP/1eyE285\n" + + "TN3RO0OdaV7PyWkG9tpo+qiVMdEc77YP6DPkb46hDKcD5oTW5X9ySJIRP+SWFNUw\n" + + "3kTeuVYnZz1VtnxZWW4ODeSk9czbvxN7+aRCDtS67mjVG+KFhC+o+iiwi7Ex51gY\n" + + "BaFBTbowoIUBIAHcFz2nyBtY+8k2DRzcdiIAx+0CuRUWpWd3hqd5tK32SRAea366\n" + + "kCcGBbBBMmpMRMvlkzXVvI4CC3BRoqhFQDgj7liJhSqQ831SAhR5FqxbioXTVVA+\n" + + "h19Tzp+45YSjqyfE+VZe8PSg8P6hbLqUpqABZ+92e0HhR314U9XjPTpEEapaNMpm\n" + + "34b8u+Ix5w2IL91fCJd7P5GAboYu+BoQagDP5NV4fXQOj5gTulhn6nIHX64+/nRK\n" + + "F5IB+fcb0HZYFCQ2t7nMt2wM9QHmoPaGB9KhLrsre15raQURk0R2R9AEgh5kjdrY\n" + + "sWkkhng4kAkO7zIOMZiti5TkMWiCXh0Uq0jGIHS5Bqg1MhLoEC9pcCNBcOVjIPFt\n" + + "4jDBsxHAwp+x7Mmeo5ljFMoODAkcMq5JNhL1BI4kiSux5g32lU42aF6r1x79UPzE\n" + + "9MvycTBaCQLGiRTHaUZyOeUrcwIK8+4TgvYHTrL9f0de/og16Qair+K7T+HDBQpM\n" + + "p0evZHphbrnryKCUEKynIySP3IOTLAFevmLdiEYEExECAAYFAlF6pW0ACgkQK648\n" + + "9tr/sACqOACcCAjaMFIUCWY4VPnZ6CjiMohki6oAnRz9LeE27s05FM3qF3r7yqTB\n" + + "bLVetDREb21pbmlrIFNjaMO8cm1hbm4gPGQuc2NodWVybWFubkB0dS1icmF1bnNj\n" + + "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+ + "EpJPzGtsV1Hrp+L3J96kbX5cswCdH+IKmnveVUZBhWnDy2xCoW5X0BeISgQQEQIA\n" + + "CgUCTZxI4gMFAXgACgkQxZfezBd6/Xz5YgCfRouhQNbaBelpk+pgwk8XbVi+C3sA\n" + + "niQ3EIOLdXEDEsozpDcrKsd08rRAiQEcBBABAgAGBQJRBYnKAAoJENjTIPvvLEnw\n" + + "CAcH/Rmciw+bRgCPbroPGkzQHTD8y9RWTEclBDv6mnJLNlzacKzfFhafvMnP/CuH\n" + + "9gEVKf/nM1vCS9G98t5CksGrLsEXJoVRGeOG41bREafUc+n2dxEoHAW3yUuvfnVZ\n" + + "zLEgNBk066v4wuNh6mt/vEUz+8k2kJ/1BRe+V3x6kFKKfN5ezszXs8UWMwROrLHA\n" + + "ElYOZKeDEL6oLpykHXFokjLHMgOxnvwOuT3tOMuHo2kW2LyV5DyGlJbYx+pHbdaC\n" + + "9dzXe+uPQ2YzKCuc1TgyMAjCDcG9OOiZEqTdFAY8Lr5eUdNG8Rozv9+rteSk2QaQ\n" + + "FqCbKmpvV6u7cnO5dydego2t2O+JAhwEEAECAAYFAlEFzk4ACgkQ0DssUbNe6zwO\n" + + "Tg//Qi20qePBfw+fsq77Pddt6s5kAulMzIK2vbUQYY+63MCnIbiiTC5464K1xwMz\n" + + "56erQJSqltW5r7MxgLJdP2IISkG8PfRCBQqJWlsriHL/EuJ16AsLUCncWggHik1L\n" + + "oaHegyplc35Ai3Nm70nxCVtmC/62k8EHlFuw7rJbhqg5s1hAKjl7HRryAHhzag/o\n" + + "LwzIQxKiGg4jIRhhPS3Ye1NnJR1yv0JywovwgIbGYfvKqmNInym7au4o/DSKfigd\n" + + "hA8t1LwmcGaXrTEyxTm2wj6hXu1BITzZhmhayrCZv3ZnEE3r99bdq/Qr9f1qrVPD\n" + + "7W3OMve7MW2H2gpd48uVre29SV1RCl4qKnVGO7v6weppVudbnpYh/I+jfrpDC0QT\n" + + "h8qPf8/4aec/j9tD8tXYMtBK/+J1x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\n" + + "lXJEpbh6+4WBxBulFbrv9VD2ot17uO9kQVWM7RLq4GI++x3pg1CQVdxo5yYMRcca\n" + + "7gEGeBR/OzYKJNKyFxOcSbtMT54WGeptWU5IPSaR3corZyBcu0LJCzldXLgfF5jY\n" + + "sP9hNqhK3hxgKelsI0ECd4kCHAQQAQIABgUCUQWlrwAKCRCyQTxm3Sw/6oi/D/9M\n" + + "70bk62Gvqhe9X3bUvrrff1yieTa2UhTDqT3EG1cMRdLa1aGJsjbEBy2hr9u7vCWP\n" + + "2NVYkPSIo2Q2+t9LfeT19Q+nzG11ynAZ+MM+pY63aHN8a/YrSEGLYbRM41Q8337/\n" + + "SzppV737R9HYibj9pLo2m8q03DnjoacEfBO6RExoXoVuNn3J7rkaA52XNgWrj/MP\n" + + "fcMVCJqUsBA69ZliFWNmizUeeM3yWvj6HSeDBxwz7l5pmj3Gq/50qw0vzYe6t05M\n" + + "BGow8xqI2rstvr7wF/D2WZyABIIDEwlpE1kfBCB6Yifdq8go10dBJGH7KCETo7er\n" + + "/a5NVV8ur4sgSJsOBrHYW0aHMJWvCp2mSooX4VOWhd91PJ1vUD6+3H8IB1NGWB5v\n" + + "CVrqVTpYViZDhYcAbIEqF98vOwkjJga4w0BFUqNC5IwbWQ4VH5pDHuSviUyFIWii\n" + + "ejAJLmZu5ycg3fHXJ51HDJlgyttP16W5NPJnPpOe7bKipcUcKER7YDOlPF/z2y7E\n" + + "Af9lp3uPLx7iIN46iAAlbwSkMny52DNSxCaOsdvmuB5nIkfn762+1cURFvgACYh0\n" + + "NeQawtn2tQGTYQjw6P21uJGXi8kmy12iFHGhi7vptVVZxNDT1GvcozyZ3bdOWN2T\n" + + "/S/x3o+RO8kbdMgHjkOOHKNHYvfQpKAhAbVD5lCNCokBHAQTAQIABgUCUQbiuAAK\n" + + "CRCylLwGx1UqeiraB/9yKTH4xcj0e13D8zRCyTcpQzoJwihllFVbtOYV07dcKi3d\n" + + "SKoMPpW3W2yr3ADHFDTpHhNj55ZOq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\n" + + "ImtN03lhhyWR0a++Eowh6zEJKeDfg7C+2djqsB9C8nMDZbmQdNLFJNQRVSiK4i8E\n" + + "4YkBPgQTAQIAKAUCTp8R3QIbIwUJCWYBgAYLCQgHAwIGFQgCCQoLBBYCAwECHgEC\n" + + "F4AACgkQcYwHAQABIoI6KAf/THY5iMm+CH5dJOTAwuHUyuKduvSVFxq+1WX3rX21\n" + + "x670fhHx9WarvE+CsgreUzfBVZxq1cq2oB72KyFsa45utKt761x4QEOM01CRQO21\n" + + "hIgl+wed9CRgzO17OzZ/E/G47/P8pHxm8kXwictTWqZ4rlgfzOg7YcY5An05rFH2\n" + + "J+fxUVfdjZ2u75XDE6CAHV1hMvrRwatnJQ33S1/yRCdhT3qad7U7wrbtiu7Y4KNi\n" + + "gM4ur+kGqRSNWN6/4v7OHRgj0Pp6jbs2pXqccR9rAhlKhnatd6RKb1+LlYEyblSC\n" + + "76PIZm26h8qhY8UKrj9a2ydmWDY2uquxbRLvjrT8suZZebQvRG9taW5payBTY2jD\n" + + "vHJtYW5uIDxzY2h1ZXJtYW5uQGlici5jcy50dS1icy5kZT6JAT4EEwECACgFAlLq\n" + + "hOACGyMFCQlmAYAGCwkIBwMCBhUIAgkKCwQWAgMBAh4BAheAAAoJEHGMBwEAASKC\n" + + "nKcH/ik9LmnpEclsCDfzYqTEbVOSNZA30YcvwdlsHlzjRm+KjJC3D350147o5D60\n" + + "xq0UBUxKeXJPPMofeRgzTiAjTdv2ilJEZe8bMM5b7gcmp92q4tAY3OxcGNprIswc\n" + + "eb5hG4kY905WAy076iaQOD9z0Y+bXWQo0OHc07lc4+8ZLG9u+rGDjfF0x4UWgkAQ\n" + + "d8Thth4lTzdZR/kLLBCdlOyb9sAKqfbxbfATDQEceex7dZF/uJRCvFojHMtDbhxe\n" + + "xdfEjWbsJRQR0KKTHYS02zqhVu34elwuRSWf1OOR7ynh5nD5CCAAmVbi+x7y281i\n" + + "YYTchi/s71CSs81OtFtaBfVNSeq5AQ0ES4b+oAEIANr825Ns9mewUTHNfZ3/xK7R\n" + + "mp+nVLgOoyJDZF+Qum08RnFiECCiDTPlHIUuZt6jUu8vb/TKH5bdviFkC2MQPhm0\n" + + "/5sbbbqbV6wMnXfMd/RTPkIeeheEumY/5n4oYYGuVTZ+0MBouPY/wXfxp6HkqtuI\n" + + "qUZm8Bmy9AEScxiBURBu4MOr9/c9niLFlnpFLhEsSm17nS6/tdEJGdMRb3WNFn5+\n" + + "bE8w9e8RqPlye9SFZHsjmv9jCZaW5fZkcdDTcDClPVvIBtUl6y/kkh0RfIwdU+T5\n" + + "GRI8XekgI8WkvEqxTaQqn03C79zU3nhRuSgy8E492uaTmwpmAXC/m4Z6luTNPrEA\n" + + "EQEAAYkBJQQYAQIADwUCS4b+oAIbDAUJCWYBgAAKCRBxjAcBAAEignQvB/915fHh\n" + + "7di/yoyJfmufnj4fJ9Lt6OYyXvKetXpC+dLx7zH61KCeKosgWIN5HyY2Si1ZfGdO\n" + + "JQ1L0d9Y+TsRVslU34uY7DuYLs4yGNwFdI4r6Y+PHIAE0Cd3xxf8xFr8oiinPMvm\n" + + "SVDO2MbF0W/TnYwvyoN7Of0uAUdFY0sRupamPgNEz7dTZ+UoKgRFzfPh4zUb5Hav\n" + + "loqJCE/BEJ4wkxYTaJfFdJq+3WAZdd0f1OZLLDcCCvbZHNYBvpPauoVq3LD8MHXz\n" + + "hCRY9Rp2ZxX92PrFiSNpKheP30iZM8VInDfPGaApQU1y8R2uLL0I/7XWiFtpmR6e\n" + + "k3wUxv46o0y15asU\n" + + "=Bbew\n" + + "-----END PGP PUBLIC KEY BLOCK-----\n"; + } -- cgit v1.2.3 From 154849b5911cc2b99aa0f5c42eea53aaf55ba930 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Sun, 16 Feb 2014 01:35:14 +0100 Subject: rename intent helper --- .../keychain/demo/IntentActivity.java | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'OpenPGP-Keychain-API/example-app/src/main/java') diff --git a/OpenPGP-Keychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/IntentActivity.java b/OpenPGP-Keychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/IntentActivity.java index 0fcc0c248..ad1b55df0 100644 --- a/OpenPGP-Keychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/IntentActivity.java +++ b/OpenPGP-Keychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/IntentActivity.java @@ -28,7 +28,7 @@ import android.provider.MediaStore; import android.util.Log; import android.widget.Toast; -import org.sufficientlysecure.keychain.api.KeychainIntents; +import org.sufficientlysecure.keychain.api.OpenKeychainIntents; import java.io.UnsupportedEncodingException; @@ -68,8 +68,8 @@ public class IntentActivity extends PreferenceActivity { @Override public boolean onPreferenceClick(Preference preference) { try { - Intent intent = new Intent(KeychainIntents.ENCRYPT); - intent.putExtra(KeychainIntents.ENCRYPT_EXTRA_TEXT, "Hello world!"); + Intent intent = new Intent(OpenKeychainIntents.ENCRYPT); + intent.putExtra(OpenKeychainIntents.ENCRYPT_EXTRA_TEXT, "Hello world!"); startActivity(intent); } catch (ActivityNotFoundException e) { Toast.makeText(IntentActivity.this, "Activity not found!", Toast.LENGTH_LONG).show(); @@ -94,8 +94,8 @@ public class IntentActivity extends PreferenceActivity { @Override public boolean onPreferenceClick(Preference preference) { try { - Intent intent = new Intent(KeychainIntents.DECRYPT); - intent.putExtra(KeychainIntents.DECRYPT_EXTRA_TEXT, TEST_SIGNED_MESSAGE); + Intent intent = new Intent(OpenKeychainIntents.DECRYPT); + intent.putExtra(OpenKeychainIntents.DECRYPT_EXTRA_TEXT, TEST_SIGNED_MESSAGE); startActivity(intent); } catch (ActivityNotFoundException e) { Toast.makeText(IntentActivity.this, "Activity not found!", Toast.LENGTH_LONG).show(); @@ -109,14 +109,14 @@ public class IntentActivity extends PreferenceActivity { @Override public boolean onPreferenceClick(Preference preference) { try { - Intent intent = new Intent(KeychainIntents.IMPORT_KEY); + Intent intent = new Intent(OpenKeychainIntents.IMPORT_KEY); byte[] pubkey = null; try { pubkey = TEST_PUBKEY.getBytes("UTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } - intent.putExtra(KeychainIntents.IMPORT_KEY_EXTRA_KEY_BYTES, pubkey); + intent.putExtra(OpenKeychainIntents.IMPORT_KEY_EXTRA_KEY_BYTES, pubkey); startActivity(intent); } catch (ActivityNotFoundException e) { Toast.makeText(IntentActivity.this, "Activity not found!", Toast.LENGTH_LONG).show(); @@ -130,8 +130,8 @@ public class IntentActivity extends PreferenceActivity { @Override public boolean onPreferenceClick(Preference preference) { try { - Intent intent = new Intent(KeychainIntents.IMPORT_KEY_FROM_KEYSERVER); - intent.putExtra(KeychainIntents.IMPORT_KEY_FROM_KEYSERVER_QUERY, "Richard Stallman"); + Intent intent = new Intent(OpenKeychainIntents.IMPORT_KEY_FROM_KEYSERVER); + intent.putExtra(OpenKeychainIntents.IMPORT_KEY_FROM_KEYSERVER_QUERY, "Richard Stallman"); startActivity(intent); } catch (ActivityNotFoundException e) { Toast.makeText(IntentActivity.this, "Activity not found!", Toast.LENGTH_LONG).show(); @@ -145,7 +145,7 @@ public class IntentActivity extends PreferenceActivity { @Override public boolean onPreferenceClick(Preference preference) { try { - Intent intent = new Intent(KeychainIntents.IMPORT_KEY_FROM_QR_CODE); + Intent intent = new Intent(OpenKeychainIntents.IMPORT_KEY_FROM_QR_CODE); startActivity(intent); } catch (ActivityNotFoundException e) { Toast.makeText(IntentActivity.this, "Activity not found!", Toast.LENGTH_LONG).show(); @@ -195,7 +195,7 @@ public class IntentActivity extends PreferenceActivity { Log.d(Constants.TAG, "filePath: " + filePath); try { - Intent intent = new Intent(KeychainIntents.ENCRYPT); + Intent intent = new Intent(OpenKeychainIntents.ENCRYPT); Uri dataUri = Uri.parse("file://" + filePath); Log.d(Constants.TAG, "Uri: " + dataUri); intent.setData(dataUri); -- cgit v1.2.3 From f3bbd344823265f2b77cfc0af530a23211663e76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Mon, 17 Feb 2014 19:06:29 +0100 Subject: Fix register activity --- .../org/sufficientlysecure/keychain/demo/OpenPgpProviderActivity.java | 1 - 1 file changed, 1 deletion(-) (limited to 'OpenPGP-Keychain-API/example-app/src/main/java') 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 24d1c0456..d089b7285 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 @@ -192,7 +192,6 @@ public class OpenPgpProviderActivity extends Activity { } } - public void sign(Bundle params) { params.putBoolean(OpenPgpConstants.PARAMS_REQUEST_ASCII_ARMOR, true); -- cgit v1.2.3 From 89d6dcc9963f6fe6d598c4cd347abaab5717c572 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Mon, 17 Feb 2014 19:08:24 +0100 Subject: decrypt into message not ciphertext EditText --- .../org/sufficientlysecure/keychain/demo/OpenPgpProviderActivity.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenPGP-Keychain-API/example-app/src/main/java') 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 d089b7285..d14703f2d 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 @@ -231,7 +231,7 @@ public class OpenPgpProviderActivity extends Activity { final ByteArrayOutputStream os = new ByteArrayOutputStream(); OpenPgpApi api = new OpenPgpApi(this, mServiceConnection.getService()); - api.decryptAndVerify(params, is, os, new MyCallback(true, os, REQUEST_CODE_DECRYPT_AND_VERIFY)); + api.decryptAndVerify(params, is, os, new MyCallback(false, os, REQUEST_CODE_DECRYPT_AND_VERIFY)); } @Override -- cgit v1.2.3