Renaming APG to OpenPGP Keychain

This commit is contained in:
Dominik Schürmann 2013-01-16 14:31:16 +01:00
parent dbbd8f6856
commit 1feb948acf
752 changed files with 1196 additions and 1251 deletions

View File

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.thialfihar.android.apg.demo"
package="org.sufficientlysecure.keychain.demo"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="org.thialfihar.android.apg.permission.ACCESS_API" />
<uses-permission android:name="org.thialfihar.android.apg.permission.ACCESS_KEYS" />
<uses-permission android:name="org.sufficientlysecure.keychain.permission.ACCESS_API" />
<uses-permission android:name="org.sufficientlysecure.keychain.permission.ACCESS_KEYS" />
<uses-sdk
android:minSdkVersion="7"

View File

@ -9,4 +9,4 @@
# Project target.
target=android-15
android.library.reference.1=../APG-API-Lib
android.library.reference.1=../OpenPGP-Keychain-API-Lib

View File

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

Before

Width:  |  Height:  |  Size: 8.0 KiB

After

Width:  |  Height:  |  Size: 8.0 KiB

View File

@ -14,15 +14,16 @@
* limitations under the License.
*/
package org.thialfihar.android.apg.demo;
package org.sufficientlysecure.keychain.demo;
import org.thialfihar.android.apg.integration.ApgData;
import org.thialfihar.android.apg.integration.ApgIntentHelper;
import org.thialfihar.android.apg.service.IApgApiService;
import org.thialfihar.android.apg.service.IApgKeyService;
import org.thialfihar.android.apg.service.handler.IApgDecryptHandler;
import org.thialfihar.android.apg.service.handler.IApgEncryptHandler;
import org.thialfihar.android.apg.service.handler.IApgGetDecryptionKeyIdHandler;
import org.sufficientlysecure.keychain.demo.R;
import org.sufficientlysecure.keychain.integration.KeychainData;
import org.sufficientlysecure.keychain.integration.KeychainIntentHelper;
import org.sufficientlysecure.keychain.service.IKeychainApiService;
import org.sufficientlysecure.keychain.service.IKeychainKeyService;
import org.sufficientlysecure.keychain.service.handler.IKeychainDecryptHandler;
import org.sufficientlysecure.keychain.service.handler.IKeychainEncryptHandler;
import org.sufficientlysecure.keychain.service.handler.IKeychainGetDecryptionKeyIdHandler;
import android.app.Activity;
import android.app.AlertDialog;
@ -43,13 +44,13 @@ public class AidlDemoActivity extends Activity {
TextView mCiphertextTextView;
TextView mDataTextView;
ApgIntentHelper mApgIntentHelper;
ApgData mApgData;
KeychainIntentHelper mKeychainIntentHelper;
KeychainData mKeychainData;
private IApgApiService service = null;
private IKeychainApiService service = null;
private ServiceConnection svcConn = new ServiceConnection() {
public void onServiceConnected(ComponentName className, IBinder binder) {
service = IApgApiService.Stub.asInterface(binder);
service = IKeychainApiService.Stub.asInterface(binder);
}
public void onServiceDisconnected(ComponentName className) {
@ -68,17 +69,18 @@ public class AidlDemoActivity extends Activity {
mCiphertextTextView = (TextView) findViewById(R.id.aidl_demo_ciphertext);
mDataTextView = (TextView) findViewById(R.id.aidl_demo_data);
mApgIntentHelper = new ApgIntentHelper(mActivity);
mApgData = new ApgData();
mKeychainIntentHelper = new KeychainIntentHelper(mActivity);
mKeychainData = new KeychainData();
bindService(new Intent(IApgApiService.class.getName()), svcConn, Context.BIND_AUTO_CREATE);
bindService(new Intent(IKeychainApiService.class.getName()), svcConn,
Context.BIND_AUTO_CREATE);
}
public void encryptOnClick(View view) {
byte[] inputBytes = mMessageTextView.getText().toString().getBytes();
try {
service.encryptAsymmetric(inputBytes, null, true, 0, mApgData.getPublicKeys(), 7,
service.encryptAsymmetric(inputBytes, null, true, 0, mKeychainData.getPublicKeys(), 7,
encryptHandler);
} catch (RemoteException e) {
exceptionImplementation(-1, e.toString());
@ -96,13 +98,13 @@ public class AidlDemoActivity extends Activity {
}
private void updateView() {
if (mApgData.getDecryptedData() != null) {
mMessageTextView.setText(mApgData.getDecryptedData());
if (mKeychainData.getDecryptedData() != null) {
mMessageTextView.setText(mKeychainData.getDecryptedData());
}
if (mApgData.getEncryptedData() != null) {
mCiphertextTextView.setText(mApgData.getEncryptedData());
if (mKeychainData.getEncryptedData() != null) {
mCiphertextTextView.setText(mKeychainData.getEncryptedData());
}
mDataTextView.setText(mApgData.toString());
mDataTextView.setText(mKeychainData.toString());
}
@Override
@ -117,7 +119,7 @@ public class AidlDemoActivity extends Activity {
builder.setTitle("Exception!").setMessage(error).setPositiveButton("OK", null).show();
}
private final IApgEncryptHandler.Stub encryptHandler = new IApgEncryptHandler.Stub() {
private final IKeychainEncryptHandler.Stub encryptHandler = new IKeychainEncryptHandler.Stub() {
@Override
public void onException(final int exceptionId, final String message) throws RemoteException {
@ -132,7 +134,7 @@ public class AidlDemoActivity extends Activity {
public void onSuccess(final byte[] outputBytes, String outputUri) throws RemoteException {
runOnUiThread(new Runnable() {
public void run() {
mApgData.setEncryptedData(new String(outputBytes));
mKeychainData.setEncryptedData(new String(outputBytes));
updateView();
}
});
@ -140,7 +142,7 @@ public class AidlDemoActivity extends Activity {
};
private final IApgDecryptHandler.Stub decryptHandler = new IApgDecryptHandler.Stub() {
private final IKeychainDecryptHandler.Stub decryptHandler = new IKeychainDecryptHandler.Stub() {
@Override
public void onException(final int exceptionId, final String message) throws RemoteException {
@ -157,7 +159,7 @@ public class AidlDemoActivity extends Activity {
boolean signatureUnknown) throws RemoteException {
runOnUiThread(new Runnable() {
public void run() {
mApgData.setDecryptedData(new String(outputBytes));
mKeychainData.setDecryptedData(new String(outputBytes));
updateView();
}
});
@ -166,7 +168,7 @@ public class AidlDemoActivity extends Activity {
};
private final IApgGetDecryptionKeyIdHandler.Stub helperHandler = new IApgGetDecryptionKeyIdHandler.Stub() {
private final IKeychainGetDecryptionKeyIdHandler.Stub helperHandler = new IKeychainGetDecryptionKeyIdHandler.Stub() {
@Override
public void onException(final int exceptionId, final String message) throws RemoteException {
@ -191,18 +193,19 @@ public class AidlDemoActivity extends Activity {
* @param view
*/
public void selectSecretKeyOnClick(View view) {
mApgIntentHelper.selectSecretKey();
mKeychainIntentHelper.selectSecretKey();
}
public void selectEncryptionKeysOnClick(View view) {
mApgIntentHelper.selectPublicKeys("user@example.com");
mKeychainIntentHelper.selectPublicKeys("user@example.com");
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// this updates the mApgData object to the result of the methods
boolean result = mApgIntentHelper.onActivityResult(requestCode, resultCode, data, mApgData);
// this updates the mKeychainData object to the result of the methods
boolean result = mKeychainIntentHelper.onActivityResult(requestCode, resultCode, data,
mKeychainData);
if (result) {
updateView();
}

View File

@ -14,15 +14,16 @@
* limitations under the License.
*/
package org.thialfihar.android.apg.demo;
package org.sufficientlysecure.keychain.demo;
import java.util.ArrayList;
import java.util.List;
import org.thialfihar.android.apg.integration.ApgData;
import org.thialfihar.android.apg.integration.ApgIntentHelper;
import org.thialfihar.android.apg.service.IApgKeyService;
import org.thialfihar.android.apg.service.handler.IApgGetKeyringsHandler;
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;
@ -43,16 +44,16 @@ public class AidlDemoActivity2 extends Activity {
TextView mKeyringsTextView;
ApgIntentHelper mApgIntentHelper;
ApgData mApgData;
KeychainIntentHelper mKeychainIntentHelper;
KeychainData mKeychainData;
byte[] keysBytes;
ArrayList<String> keysStrings;
private IApgKeyService service = null;
private IKeychainKeyService service = null;
private ServiceConnection svcConn = new ServiceConnection() {
public void onServiceConnected(ComponentName className, IBinder binder) {
service = IApgKeyService.Stub.asInterface(binder);
service = IKeychainKeyService.Stub.asInterface(binder);
}
public void onServiceDisconnected(ComponentName className) {
@ -69,15 +70,16 @@ public class AidlDemoActivity2 extends Activity {
mKeyringsTextView = (TextView) findViewById(R.id.aidl_demo_keyrings);
mApgIntentHelper = new ApgIntentHelper(mActivity);
mApgData = new ApgData();
mKeychainIntentHelper = new KeychainIntentHelper(mActivity);
mKeychainData = new KeychainData();
bindService(new Intent(IApgKeyService.class.getName()), svcConn, Context.BIND_AUTO_CREATE);
bindService(new Intent(IKeychainKeyService.class.getName()), svcConn,
Context.BIND_AUTO_CREATE);
}
public void getKeyringsStringsOnClick(View view) {
try {
service.getPublicKeyRings(mApgData.getPublicKeys(), true, getKeyringsHandler);
service.getPublicKeyRings(mKeychainData.getPublicKeys(), true, getKeyringsHandler);
} catch (RemoteException e) {
exceptionImplementation(-1, e.toString());
}
@ -85,7 +87,7 @@ public class AidlDemoActivity2 extends Activity {
public void getKeyringsBytesOnClick(View view) {
try {
service.getPublicKeyRings(mApgData.getPublicKeys(), false, getKeyringsHandler);
service.getPublicKeyRings(mKeychainData.getPublicKeys(), false, getKeyringsHandler);
} catch (RemoteException e) {
exceptionImplementation(-1, e.toString());
}
@ -115,7 +117,7 @@ public class AidlDemoActivity2 extends Activity {
builder.setTitle("Exception!").setMessage(error).setPositiveButton("OK", null).show();
}
private final IApgGetKeyringsHandler.Stub getKeyringsHandler = new IApgGetKeyringsHandler.Stub() {
private final IKeychainGetKeyringsHandler.Stub getKeyringsHandler = new IKeychainGetKeyringsHandler.Stub() {
@Override
public void onException(final int exceptionId, final String message) throws RemoteException {
@ -147,13 +149,14 @@ public class AidlDemoActivity2 extends Activity {
};
public void selectEncryptionKeysOnClick(View view) {
mApgIntentHelper.selectPublicKeys("user@example.com");
mKeychainIntentHelper.selectPublicKeys("user@example.com");
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// this updates the mApgData object to the result of the methods
boolean result = mApgIntentHelper.onActivityResult(requestCode, resultCode, data, mApgData);
// this updates the mKeychainData object to the result of the methods
boolean result = mKeychainIntentHelper.onActivityResult(requestCode, resultCode, data,
mKeychainData);
if (result) {
updateView();
}

View File

@ -14,9 +14,9 @@
* limitations under the License.
*/
package org.thialfihar.android.apg.demo;
package org.sufficientlysecure.keychain.demo;
import org.thialfihar.android.apg.demo.R;
import org.sufficientlysecure.keychain.demo.R;
import android.app.Activity;
import android.content.Intent;

View File

@ -14,12 +14,12 @@
* limitations under the License.
*/
package org.thialfihar.android.apg.demo;
package org.sufficientlysecure.keychain.demo;
import java.util.Arrays;
import org.thialfihar.android.apg.demo.R;
import org.thialfihar.android.apg.integration.ApgContentProviderHelper;
import org.sufficientlysecure.keychain.demo.R;
import org.sufficientlysecure.keychain.integration.KeychainContentProviderHelper;
import android.app.Activity;
import android.os.Bundle;
@ -33,7 +33,7 @@ public class ContentProviderDemoActivity extends Activity {
TextView mCiphertextTextView;
TextView mDataTextView;
ApgContentProviderHelper mApgContentProviderHelper;
KeychainContentProviderHelper mKeychainContentProviderHelper;
/**
* Instantiate View for this Activity
@ -48,16 +48,16 @@ public class ContentProviderDemoActivity extends Activity {
mOutputTextView = (TextView) findViewById(R.id.content_provider_output);
mApgContentProviderHelper = new ApgContentProviderHelper(mActivity);
mKeychainContentProviderHelper = new KeychainContentProviderHelper(mActivity);
}
public void test1OnClick(View view) {
long[] test = mApgContentProviderHelper.getPublicKeyringIdsByEmail("user@example.com");
long[] test = mKeychainContentProviderHelper.getPublicKeyringIdsByEmail("user@example.com");
mOutputTextView.setText(Arrays.toString(test));
}
public void test2OnClick(View view) {
boolean test = mApgContentProviderHelper.hasPublicKeyringByEmail("user@example.com");
boolean test = mKeychainContentProviderHelper.hasPublicKeyringByEmail("user@example.com");
if (test) {
mOutputTextView.setText("true");
} else {

View File

@ -14,11 +14,11 @@
* limitations under the License.
*/
package org.thialfihar.android.apg.demo;
package org.sufficientlysecure.keychain.demo;
import org.thialfihar.android.apg.demo.R;
import org.thialfihar.android.apg.integration.ApgData;
import org.thialfihar.android.apg.integration.ApgIntentHelper;
import org.sufficientlysecure.keychain.demo.R;
import org.sufficientlysecure.keychain.integration.KeychainData;
import org.sufficientlysecure.keychain.integration.KeychainIntentHelper;
import android.app.Activity;
import android.content.Intent;
@ -33,8 +33,8 @@ public class IntentDemoActivity extends Activity {
TextView mCiphertextTextView;
TextView mDataTextView;
ApgIntentHelper mApgIntentHelper;
ApgData mApgData;
KeychainIntentHelper mKeychainIntentHelper;
KeychainData mKeychainData;
/**
* Instantiate View for this Activity
@ -51,45 +51,46 @@ public class IntentDemoActivity extends Activity {
mCiphertextTextView = (TextView) findViewById(R.id.intent_demo_ciphertext);
mDataTextView = (TextView) findViewById(R.id.intent_demo_data);
mApgIntentHelper = new ApgIntentHelper(mActivity);
mApgData = new ApgData();
mKeychainIntentHelper = new KeychainIntentHelper(mActivity);
mKeychainData = new KeychainData();
}
public void createNewKeyOnClick(View view) {
// mApgIntentHelper.createNewKey();
mApgIntentHelper.createNewKey("test <user@example.com>", true, true);
// mKeychainIntentHelper.createNewKey();
mKeychainIntentHelper.createNewKey("test <user@example.com>", true, true);
}
public void selectSecretKeyOnClick(View view) {
mApgIntentHelper.selectSecretKey();
mKeychainIntentHelper.selectSecretKey();
}
public void selectEncryptionKeysOnClick(View view) {
mApgIntentHelper.selectPublicKeys("user@example.com");
mKeychainIntentHelper.selectPublicKeys("user@example.com");
}
public void encryptOnClick(View view) {
mApgIntentHelper.encrypt(mMessageTextView.getText().toString(), mApgData.getPublicKeys(),
mApgData.getSecretKeyId(), false);
mKeychainIntentHelper.encrypt(mMessageTextView.getText().toString(),
mKeychainData.getPublicKeys(), mKeychainData.getSecretKeyId(), false);
}
public void encryptAndReturnOnClick(View view) {
mApgIntentHelper.encrypt(mMessageTextView.getText().toString(), mApgData.getPublicKeys(),
mApgData.getSecretKeyId(), true);
mKeychainIntentHelper.encrypt(mMessageTextView.getText().toString(),
mKeychainData.getPublicKeys(), mKeychainData.getSecretKeyId(), true);
}
public void decryptOnClick(View view) {
mApgIntentHelper.decrypt(mCiphertextTextView.getText().toString(), false);
mKeychainIntentHelper.decrypt(mCiphertextTextView.getText().toString(), false);
}
public void decryptAndReturnOnClick(View view) {
mApgIntentHelper.decrypt(mCiphertextTextView.getText().toString(), true);
mKeychainIntentHelper.decrypt(mCiphertextTextView.getText().toString(), true);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// this updates the mApgData object to the result of the methods
boolean result = mApgIntentHelper.onActivityResult(requestCode, resultCode, data, mApgData);
// this updates the mKeychainData object to the result of the methods
boolean result = mKeychainIntentHelper.onActivityResult(requestCode, resultCode, data,
mKeychainData);
if (result) {
updateView();
}
@ -99,12 +100,12 @@ public class IntentDemoActivity extends Activity {
}
private void updateView() {
if (mApgData.getDecryptedData() != null) {
mMessageTextView.setText(mApgData.getDecryptedData());
if (mKeychainData.getDecryptedData() != null) {
mMessageTextView.setText(mKeychainData.getDecryptedData());
}
if (mApgData.getEncryptedData() != null) {
mCiphertextTextView.setText(mApgData.getEncryptedData());
if (mKeychainData.getEncryptedData() != null) {
mCiphertextTextView.setText(mKeychainData.getEncryptedData());
}
mDataTextView.setText(mApgData.toString());
mDataTextView.setText(mKeychainData.toString());
}
}

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.thialfihar.android.apg.integration"
package="org.sufficientlysecure.keychain.integration"
android:versionCode="1"
android:versionName="1.0" >

View File

@ -14,14 +14,12 @@
* limitations under the License.
*/
package org.thialfihar.android.apg.integration;
package org.sufficientlysecure.keychain.integration;
public class Constants {
public static final String NAME = "apg";
public static final String TAG = "Keychain Integration Lib";
public static final String TAG = "APG Integration Lib";
public static final String APG_PACKAGE_NAME = "org.thialfihar.android.apg";
public static final String KEYCHAIN_PACKAGE_NAME = "org.sufficientlysecure.keychain";
public static final int MIN_REQUIRED_VERSION = 50;
}

View File

@ -15,7 +15,7 @@
* limitations under the License.
*/
package org.thialfihar.android.apg.integration;
package org.sufficientlysecure.keychain.integration;
import android.content.ContentUris;
import android.content.Context;
@ -23,8 +23,8 @@ import android.database.Cursor;
import android.net.Uri;
import android.widget.Toast;
public class ApgContentProviderHelper {
public static final String AUTHORITY = Constants.APG_PACKAGE_NAME;
public class KeychainContentProviderHelper {
public static final String AUTHORITY = Constants.KEYCHAIN_PACKAGE_NAME;
public static final Uri CONTENT_URI_PUBLIC_KEY_RING_BY_KEY_ID = Uri.parse("content://"
+ AUTHORITY + "/key_rings/public/key_id/");
@ -42,7 +42,7 @@ public class ApgContentProviderHelper {
private Context mContext;
public ApgContentProviderHelper(Context context) {
public KeychainContentProviderHelper(Context context) {
this.mContext = context;
}

View File

@ -15,12 +15,12 @@
* limitations under the License.
*/
package org.thialfihar.android.apg.integration;
package org.sufficientlysecure.keychain.integration;
import java.io.Serializable;
import java.util.Arrays;
public class ApgData implements Serializable {
public class KeychainData implements Serializable {
private static final long serialVersionUID = 6314045536270848410L;
protected long[] mPublicKeyIds = null;
protected String[] mPublicUserIds = null;

View File

@ -15,14 +15,14 @@
* limitations under the License.
*/
package org.thialfihar.android.apg.integration;
package org.sufficientlysecure.keychain.integration;
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.widget.Toast;
public class ApgIntentHelper {
public class KeychainIntentHelper {
public static final String APG_INTENT_PREFIX = "org.thialfihar.android.apg.intent.";
@ -128,7 +128,7 @@ public class ApgIntentHelper {
private Activity activity;
public ApgIntentHelper(Activity activity) {
public KeychainIntentHelper(Activity activity) {
this.activity = activity;
}
@ -343,7 +343,7 @@ public class ApgIntentHelper {
* @param data
* @return handled or not
*/
public boolean onActivityResult(int requestCode, int resultCode, Intent data, ApgData apgData) {
public boolean onActivityResult(int requestCode, int resultCode, Intent data, KeychainData apgData) {
switch (requestCode) {
case CREATE_KEY:
@ -421,13 +421,13 @@ public class ApgIntentHelper {
* ApgData with encryption keys and signature keys preselected
* @return true when activity was found and executed successfully
*/
public boolean selectPublicKeys(String emails, ApgData apgData) {
public boolean selectPublicKeys(String emails, KeychainData apgData) {
Intent intent = new Intent(ACTION_SELECT_PUBLIC_KEYS);
intent.putExtra(EXTRA_INTENT_VERSION, INTENT_VERSION);
long[] initialKeyIds = null;
if (apgData == null || !apgData.hasPublicKeys()) {
ApgContentProviderHelper cPHelper = new ApgContentProviderHelper(activity);
KeychainContentProviderHelper cPHelper = new KeychainContentProviderHelper(activity);
initialKeyIds = cPHelper.getPublicKeyringIdsByEmail(emails);
} else {

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.thialfihar.android.apg.integration;
package org.sufficientlysecure.keychain.integration;
import android.content.Intent;
import android.support.v4.app.Fragment;
@ -22,7 +22,7 @@ import android.support.v4.app.Fragment;
/**
* ApgIntentHelper for the V4 Android compatibility package.
*/
public final class ApgIntentHelperSupportV4 extends ApgIntentHelper {
public final class KeychainIntentHelperSupportV4 extends KeychainIntentHelper {
private final Fragment fragment;
@ -30,7 +30,7 @@ public final class ApgIntentHelperSupportV4 extends ApgIntentHelper {
* @param fragment
* Fragment to handle activity response.
*/
public ApgIntentHelperSupportV4(Fragment fragment) {
public KeychainIntentHelperSupportV4(Fragment fragment) {
super(fragment.getActivity());
this.fragment = fragment;
}

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.thialfihar.android.apg.integration;
package org.sufficientlysecure.keychain.integration;
import android.annotation.TargetApi;
import android.app.Fragment;
@ -25,7 +25,7 @@ import android.os.Build;
* ApgIntentHelper for Android version 3.0 and beyond.
*/
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public final class ApgIntentHelperV30 extends ApgIntentHelper {
public final class KeychainIntentHelperV30 extends KeychainIntentHelper {
private final Fragment fragment;
@ -33,7 +33,7 @@ public final class ApgIntentHelperV30 extends ApgIntentHelper {
* @param fragment
* Fragment to handle activity response.
*/
public ApgIntentHelperV30(Fragment fragment) {
public KeychainIntentHelperV30(Fragment fragment) {
super(fragment.getActivity());
this.fragment = fragment;
}

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.thialfihar.android.apg.integration;
package org.sufficientlysecure.keychain.integration;
import java.io.InputStream;
import java.io.OutputStream;
@ -25,16 +25,16 @@ import android.content.Context;
import android.net.Uri;
import android.util.Log;
public class ApgServiceHelper {
public class KeychainServiceHelper {
private final static String BLOB_URI = "content://org.thialfihar.android.apg.provider.apgserviceblobprovider";
private final static String BLOB_URI = "content://org.sufficientlysecure.keychain.provider.apgserviceblobprovider";
private Context context;
public ApgServiceHelper(Context context) {
public KeychainServiceHelper(Context context) {
this.context = context;
}
/**
* Set up binary data to en/decrypt
*
@ -67,7 +67,7 @@ public class ApgServiceHelper {
Log.e(Constants.TAG, "... error on writing buffer", e);
}
// mArgs.putString("BLOB", contentUri.toString());
// mArgs.putString("BLOB", contentUri.toString());
}
/**
@ -90,7 +90,7 @@ public class ApgServiceHelper {
ContentResolver cr = context.getContentResolver();
InputStream in = null;
try {
// in = cr.openInputStream(Uri.parse(mArgs.getString("BLOB")));
// in = cr.openInputStream(Uri.parse(mArgs.getString("BLOB")));
} catch (Exception e) {
Log.e(Constants.TAG, "Could not return blob in result", e);
}

View File

@ -15,7 +15,7 @@
* limitations under the License.
*/
package org.thialfihar.android.apg.integration;
package org.sufficientlysecure.keychain.integration;
import android.content.Context;
import android.content.pm.PackageInfo;
@ -23,23 +23,24 @@ import android.content.pm.PackageManager.NameNotFoundException;
import android.widget.Toast;
public class ApgUtil {
public class KeychainUtil {
/**
* Check whether APG is installed and at a high enough version.
* Check whether OpenPGP Keychain is installed and at a high enough version.
*
* @param context
* @return whether a suitable version of APG was found
*/
public boolean isApgAvailable(Context context) {
try {
PackageInfo pi = context.getPackageManager().getPackageInfo(Constants.APG_PACKAGE_NAME,
0);
PackageInfo pi = context.getPackageManager().getPackageInfo(
Constants.KEYCHAIN_PACKAGE_NAME, 0);
if (pi.versionCode >= Constants.MIN_REQUIRED_VERSION) {
return true;
} else {
Toast.makeText(context,
"This APG version is not supported! Please update to a newer one!",
Toast.makeText(
context,
"This OpenPGP Keychain version is not supported! Please update to a newer one!",
Toast.LENGTH_LONG).show();
}
} catch (NameNotFoundException e) {

View File

@ -14,17 +14,17 @@
* limitations under the License.
*/
package org.thialfihar.android.apg.service;
package org.sufficientlysecure.keychain.service;
import org.thialfihar.android.apg.service.handler.IApgEncryptHandler;
import org.thialfihar.android.apg.service.handler.IApgDecryptHandler;
import org.thialfihar.android.apg.service.handler.IApgGetDecryptionKeyIdHandler;
import org.sufficientlysecure.keychain.service.handler.IKeychainEncryptHandler;
import org.sufficientlysecure.keychain.service.handler.IKeychainDecryptHandler;
import org.sufficientlysecure.keychain.service.handler.IKeychainGetDecryptionKeyIdHandler;
/**
* All methods are oneway, which means they are asynchronous and non-blocking.
* Results are returned into given Handler, which has to be implemented on client side.
*/
interface IApgApiService {
interface IKeychainApiService {
/**
* Encrypt
@ -45,12 +45,12 @@ interface IApgApiService {
* 7: AES-128, 8: AES-192, 9: AES-256, 4: Blowfish, 10: Twofish, 3: CAST5,
* 6: DES, 2: Triple DES, 1: IDEA
* @param handler
* Results are returned to this IApgEncryptDecryptHandler Handler
* Results are returned to this IKeychainEncryptDecryptHandler Handler
* to onSuccessEncrypt(in byte[] output), after successful encryption
*/
oneway void encryptAsymmetric(in byte[] inputBytes, in String inputUri, in boolean useAsciiArmor,
in int compression, in long[] encryptionKeyIds, in int symmetricEncryptionAlgorithm,
in IApgEncryptHandler handler);
in IKeychainEncryptHandler handler);
/**
* Same as encryptAsymmetric but using a passphrase for symmetric encryption
@ -60,7 +60,7 @@ interface IApgApiService {
*/
oneway void encryptSymmetric(in byte[] inputBytes, in String inputUri, in boolean useAsciiArmor,
in int compression, in String encryptionPassphrase, in int symmetricEncryptionAlgorithm,
in IApgEncryptHandler handler);
in IKeychainEncryptHandler handler);
/**
* Encrypt and sign
@ -90,14 +90,14 @@ interface IApgApiService {
* @param signaturePassphrase
* Passphrase to unlock signature key
* @param handler
* Results are returned to this IApgEncryptDecryptHandler Handler
* Results are returned to this IKeychainEncryptDecryptHandler Handler
* to onSuccessEncrypt(in byte[] output), after successful encryption and signing
*/
oneway void encryptAndSignAsymmetric(in byte[] inputBytes, in String inputUri,
in boolean useAsciiArmor, in int compression, in long[] encryptionKeyIds,
in int symmetricEncryptionAlgorithm, in long signatureKeyId, in int signatureHashAlgorithm,
in boolean signatureForceV3, in String signaturePassphrase,
in IApgEncryptHandler handler);
in IKeychainEncryptHandler handler);
/**
* Same as encryptAndSignAsymmetric but using a passphrase for symmetric encryption
@ -109,7 +109,7 @@ interface IApgApiService {
in boolean useAsciiArmor, in int compression, in String encryptionPassphrase,
in int symmetricEncryptionAlgorithm, in long signatureKeyId, in int signatureHashAlgorithm,
in boolean signatureForceV3, in String signaturePassphrase,
in IApgEncryptHandler handler);
in IKeychainEncryptHandler handler);
/**
* Decrypts and verifies given input bytes. If no signature is present this method
@ -125,7 +125,7 @@ interface IApgApiService {
* Handler where to return results to after successful encryption
*/
oneway void decryptAndVerifyAsymmetric(in byte[] inputBytes, in String inputUri,
in String keyPassphrase, in IApgDecryptHandler handler);
in String keyPassphrase, in IKeychainDecryptHandler handler);
/**
* Same as decryptAndVerifyAsymmetric but for symmetric decryption.
@ -134,13 +134,13 @@ interface IApgApiService {
* Passphrase to decrypt
*/
oneway void decryptAndVerifySymmetric(in byte[] inputBytes, in String inputUri,
in String encryptionPassphrase, in IApgDecryptHandler handler);
in String encryptionPassphrase, in IKeychainDecryptHandler handler);
/**
*
*/
oneway void getDecryptionKeyId(in byte[] inputBytes, in String inputUri,
in IApgGetDecryptionKeyIdHandler handler);
in IKeychainGetDecryptionKeyIdHandler handler);
}

View File

@ -14,19 +14,19 @@
* limitations under the License.
*/
package org.thialfihar.android.apg.service;
package org.sufficientlysecure.keychain.service;
import org.thialfihar.android.apg.service.handler.IApgGetKeyringsHandler;
import org.sufficientlysecure.keychain.service.handler.IKeychainGetKeyringsHandler;
/**
* All methods are oneway, which means they are asynchronous and non-blocking.
* Results are returned into given Handler, which has to be implemented on client side.
*/
interface IApgKeyService {
interface IKeychainKeyService {
oneway void getPublicKeyRings(in long[] masterKeyIds, in boolean asAsciiArmoredStringArray,
in IApgGetKeyringsHandler handler);
in IKeychainGetKeyringsHandler handler);
oneway void getSecretKeyRings(in long[] masterKeyIds, in boolean asAsciiArmoredStringArray,
in IApgGetKeyringsHandler handler);
in IKeychainGetKeyringsHandler handler);
}

View File

@ -14,9 +14,9 @@
* limitations under the License.
*/
package org.thialfihar.android.apg.service.handler;
package org.sufficientlysecure.keychain.service.handler;
interface IApgDecryptHandler {
interface IKeychainDecryptHandler {
oneway void onSuccess(in byte[] outputBytes, in String outputUri, in boolean signature,
in long signatureKeyId, in String signatureUserId, in boolean signatureSuccess,

View File

@ -14,9 +14,9 @@
* limitations under the License.
*/
package org.thialfihar.android.apg.service.handler;
package org.sufficientlysecure.keychain.service.handler;
interface IApgEncryptHandler {
interface IKeychainEncryptHandler {
/**
* Either output or streamUri is given. One of them is null
*

View File

@ -14,9 +14,9 @@
* limitations under the License.
*/
package org.thialfihar.android.apg.service.handler;
package org.sufficientlysecure.keychain.service.handler;
interface IApgGetDecryptionKeyIdHandler {
interface IKeychainGetDecryptionKeyIdHandler {
oneway void onSuccess(in long secretKeyId, in boolean symmetric);

View File

@ -14,9 +14,9 @@
* limitations under the License.
*/
package org.thialfihar.android.apg.service.handler;
package org.sufficientlysecure.keychain.service.handler;
interface IApgGetKeyringsHandler {
interface IKeychainGetKeyringsHandler {
/**
* Either outputBytes or outputString is given. One of them is null
*

View File

@ -14,9 +14,9 @@
* limitations under the License.
*/
package org.thialfihar.android.apg.service.handler;
package org.sufficientlysecure.keychain.service.handler;
interface IApgSignHandler {
interface IKeychainSignHandler {
/**
* Either output or streamUri is given. One of them is null
*

View File

@ -14,9 +14,9 @@
* limitations under the License.
*/
package org.thialfihar.android.apg.service.handler;
package org.sufficientlysecure.keychain.service.handler;
interface IApgVerifyHandler {
interface IKeychainVerifyHandler {
oneway void onSuccess(in boolean signature, in long signatureKeyId,
in String signatureUserId, in boolean signatureSuccess, in boolean signatureUnknown);

View File

@ -16,7 +16,7 @@
limitations under the License.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.thialfihar.android.apg"
package="org.sufficientlysecure.keychain"
android:installLocation="auto"
android:versionCode="20000"
android:versionName="2.0" >
@ -68,26 +68,26 @@
<uses-permission android:name="com.fsck.k9.permission.READ_ATTACHMENT" />
<permission-group
android:name="org.thialfihar.android.apg.permission-group.APG"
android:name="org.sufficientlysecure.keychain.permission-group.keychain"
android:description="@string/permission_group_description"
android:icon="@drawable/icon"
android:label="@string/permission_group_label" />
<permission
android:name="org.thialfihar.android.apg.permission.ACCESS_KEYS"
android:name="org.sufficientlysecure.keychain.permission.ACCESS_KEYS"
android:description="@string/permission_access_keys_description"
android:label="@string/permission_access_keys_label"
android:permissionGroup="org.thialfihar.android.apg.permission-group.APG"
android:permissionGroup="org.sufficientlysecure.keychain.permission-group.keychain"
android:protectionLevel="dangerous" />
<permission
android:name="org.thialfihar.android.apg.permission.ACCESS_API"
android:name="org.sufficientlysecure.keychain.permission.ACCESS_API"
android:description="@string/permission_access_api_description"
android:label="@string/permission_access_api_label"
android:permissionGroup="org.thialfihar.android.apg.permission-group.APG"
android:permissionGroup="org.sufficientlysecure.keychain.permission-group.keychain"
android:protectionLevel="dangerous" />
<application
android:name=".ApgApplication"
android:name=".KeychainApplication"
android:hardwareAccelerated="true"
android:icon="@drawable/icon"
android:label="@string/app_name"
@ -137,8 +137,8 @@
android:uiOptions="splitActionBarWhenNarrow"
android:windowSoftInputMode="stateHidden" >
<intent-filter>
<action android:name="org.thialfihar.android.apg.intent.CREATE_KEY" />
<action android:name="org.thialfihar.android.apg.intent.EDIT_KEY" />
<action android:name="org.sufficientlysecure.keychain.action.CREATE_KEY" />
<action android:name="org.sufficientlysecure.keychain.action.EDIT_KEY" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
@ -150,7 +150,7 @@
android:launchMode="singleTop"
android:uiOptions="splitActionBarWhenNarrow" >
<intent-filter>
<action android:name="org.thialfihar.android.apg.intent.SELECT_PUBLIC_KEYS" />
<action android:name="org.sufficientlysecure.keychain.action.SELECT_PUBLIC_KEYS" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
@ -168,7 +168,7 @@
android:label="@string/title_selectSignature"
android:launchMode="singleTop" >
<intent-filter>
<action android:name="org.thialfihar.android.apg.intent.SELECT_SECRET_KEY" />
<action android:name="org.sufficientlysecure.keychain.action.SELECT_SECRET_KEY" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
@ -189,10 +189,10 @@
<!-- APG's own Actions -->
<intent-filter>
<action android:name="org.thialfihar.android.apg.intent.ENCRYPT" />
<action android:name="org.thialfihar.android.apg.intent.ENCRYPT_FILE" />
<action android:name="org.thialfihar.android.apg.intent.ENCRYPT_AND_RETURN" />
<action android:name="org.thialfihar.android.apg.intent.GENERATE_SIGNATURE" />
<action android:name="org.sufficientlysecure.keychain.action.ENCRYPT" />
<action android:name="org.sufficientlysecure.keychain.action.ENCRYPT_FILE" />
<action android:name="org.sufficientlysecure.keychain.action.ENCRYPT_AND_RETURN" />
<action android:name="org.sufficientlysecure.keychain.action.GENERATE_SIGNATURE" />
<category android:name="android.intent.category.DEFAULT" />
@ -216,9 +216,9 @@
<!-- APG's own Actions -->
<intent-filter>
<action android:name="org.thialfihar.android.apg.intent.DECRYPT" />
<action android:name="org.thialfihar.android.apg.intent.DECRYPT_FILE" />
<action android:name="org.thialfihar.android.apg.intent.DECRYPT_AND_RETURN" />
<action android:name="org.sufficientlysecure.keychain.action.DECRYPT" />
<action android:name="org.sufficientlysecure.keychain.action.DECRYPT_FILE" />
<action android:name="org.sufficientlysecure.keychain.action.DECRYPT_AND_RETURN" />
<category android:name="android.intent.category.DEFAULT" />
@ -299,14 +299,14 @@
android:configChanges="orientation|screenSize|keyboardHidden|keyboard"
android:label="@string/title_signKey" />
<activity
android:name="org.thialfihar.android.apg.ui.ImportKeysActivity"
android:name=".ui.ImportKeysActivity"
android:configChanges="orientation|screenSize|keyboardHidden|keyboard"
android:label="@string/title_importKeys"
android:uiOptions="splitActionBarWhenNarrow" >
<!-- APG's own Actions -->
<intent-filter android:label="@string/intent_import_key" >
<action android:name="org.thialfihar.android.apg.intent.IMPORT" />
<action android:name="org.sufficientlysecure.keychain.action.IMPORT" />
<category android:name="android.intent.category.DEFAULT" />
@ -314,9 +314,9 @@
</intent-filter>
<!-- IMPORT again without mimeType to also allow data only without filename -->
<intent-filter android:label="@string/intent_import_key" >
<action android:name="org.thialfihar.android.apg.intent.IMPORT" />
<action android:name="org.thialfihar.android.apg.intent.IMPORT_FROM_QR_CODE" />
<action android:name="org.thialfihar.android.apg.intent.IMPORT_FROM_NFC" />
<action android:name="org.sufficientlysecure.keychain.action.IMPORT" />
<action android:name="org.sufficientlysecure.keychain.action.IMPORT_FROM_QR_CODE" />
<action android:name="org.sufficientlysecure.keychain.action.IMPORT_FROM_NFC" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
@ -365,12 +365,12 @@
</intent-filter>
</activity>
<activity
android:name="org.thialfihar.android.apg.ui.ShareNfcBeamActivity"
android:name=".ui.ShareNfcBeamActivity"
android:label="@string/title_shareByNfc"
android:launchMode="singleTop"
android:uiOptions="splitActionBarWhenNarrow" >
<intent-filter>
<action android:name="org.thialfihar.android.apg.intent.SHARE_KEYRING_WITH_NFC" />
<action android:name="org.sufficientlysecure.keychain.action.SHARE_KEYRING_WITH_NFC" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
@ -381,13 +381,13 @@
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="application/org.thialfihar.android.apg" />
<data android:mimeType="application/org.sufficientlysecure.keychain" />
</intent-filter>
</activity>
<activity android:name="org.thialfihar.android.apg.ui.ShareActivity" >
<activity android:name=".ui.ShareActivity" >
<intent-filter>
<action android:name="org.thialfihar.android.apg.intent.SHARE_KEYRING" />
<action android:name="org.thialfihar.android.apg.intent.SHARE_KEYRING_WITH_QR_CODE" />
<action android:name="org.sufficientlysecure.keychain.action.SHARE_KEYRING" />
<action android:name="org.sufficientlysecure.keychain.action.SHARE_KEYRING_WITH_QR_CODE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
@ -397,15 +397,15 @@
android:label="@string/title_help" />
<service android:name=".service.PassphraseCacheService" />
<service android:name=".service.ApgIntentService" />
<service android:name="org.sufficientlysecure.keychain.service.KeychainIntentService" />
<service
android:name="org.thialfihar.android.apg.service.ApgApiService"
android:name="org.sufficientlysecure.keychain.service.KeychainApiService"
android:enabled="true"
android:exported="true"
android:permission="org.thialfihar.android.apg.permission.ACCESS_API"
android:permission="org.sufficientlysecure.keychain.permission.ACCESS_API"
android:process=":remoteapi" >
<intent-filter>
<action android:name="org.thialfihar.android.apg.service.IApgApiService" />
<action android:name="org.sufficientlysecure.keychain.service.IApgApiService" />
</intent-filter>
<meta-data
@ -413,13 +413,13 @@
android:value="3" />
</service>
<service
android:name="org.thialfihar.android.apg.service.ApgKeyService"
android:name="org.sufficientlysecure.keychain.service.KeychainKeyService"
android:enabled="true"
android:exported="true"
android:permission="org.thialfihar.android.apg.permission.ACCESS_KEYS"
android:permission="org.sufficientlysecure.keychain.permission.ACCESS_KEYS"
android:process=":remotekeys" >
<intent-filter>
<action android:name="org.thialfihar.android.apg.service.IApgKeyService" />
<action android:name="org.sufficientlysecure.keychain.service.IApgKeyService" />
</intent-filter>
<meta-data
@ -428,20 +428,20 @@
</service>
<provider
android:name=".provider.ApgProviderInternal"
android:authorities="org.thialfihar.android.apg.internal"
android:name="org.sufficientlysecure.keychain.provider.KeychainProviderInternal"
android:authorities="org.sufficientlysecure.keychain.internal"
android:exported="false" />
<provider
android:name=".provider.ApgProviderExternal"
android:authorities="org.thialfihar.android.apg"
android:name="org.sufficientlysecure.keychain.provider.KeychainProviderExternal"
android:authorities="org.sufficientlysecure.keychain"
android:exported="true"
android:readPermission="org.thialfihar.android.apg.permission.ACCESS_API" />
android:readPermission="org.sufficientlysecure.keychain.permission.ACCESS_API" />
<!-- TODO: authority! -->
<provider
android:name=".provider.ApgServiceBlobProvider"
android:authorities="org.thialfihar.android.apg.provider.apgserviceblobprovider"
android:permission="org.thialfihar.android.apg.permission.ACCESS_API" />
android:name="org.sufficientlysecure.keychain.provider.KeychainServiceBlobProvider"
android:authorities="org.sufficientlysecure.keychain.provider.apgserviceblobprovider"
android:permission="org.sufficientlysecure.keychain.permission.ACCESS_API" />
</application>
</manifest>

Some files were not shown because too many files have changed in this diff Show More