aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain-API
diff options
context:
space:
mode:
Diffstat (limited to 'OpenKeychain-API')
-rw-r--r--OpenKeychain-API/.gitignore29
-rw-r--r--OpenKeychain-API/build.gradle3
-rw-r--r--OpenKeychain-API/example-app/build.gradle61
-rw-r--r--OpenKeychain-API/example-app/ic_launcher-web.pngbin0 -> 23512 bytes
-rw-r--r--OpenKeychain-API/example-app/src/main/AndroidManifest.xml33
-rw-r--r--OpenKeychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/BaseActivity.java63
-rw-r--r--OpenKeychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/Constants.java21
-rw-r--r--OpenKeychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/IntentActivity.java583
-rw-r--r--OpenKeychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/OpenPgpProviderActivity.java308
-rw-r--r--OpenKeychain-API/example-app/src/main/res/drawable-hdpi/ic_launcher.pngbin0 -> 2626 bytes
-rw-r--r--OpenKeychain-API/example-app/src/main/res/drawable-mdpi/ic_launcher.pngbin0 -> 1732 bytes
-rw-r--r--OpenKeychain-API/example-app/src/main/res/drawable-xhdpi/ic_launcher.pngbin0 -> 3517 bytes
-rw-r--r--OpenKeychain-API/example-app/src/main/res/drawable-xxhdpi/ic_launcher.pngbin0 -> 5717 bytes
-rw-r--r--OpenKeychain-API/example-app/src/main/res/layout/openpgp_provider.xml123
-rw-r--r--OpenKeychain-API/example-app/src/main/res/xml/base_preference.xml18
-rw-r--r--OpenKeychain-API/example-app/src/main/res/xml/intent_preference.xml30
-rw-r--r--OpenKeychain-API/gradle/gradle/wrapper/gradle-wrapper.jarbin0 -> 50557 bytes
-rw-r--r--OpenKeychain-API/gradle/gradle/wrapper/gradle-wrapper.properties6
-rwxr-xr-xOpenKeychain-API/gradle/gradlew164
-rw-r--r--OpenKeychain-API/gradle/gradlew.bat90
-rw-r--r--OpenKeychain-API/gradle/wrapper/gradle-wrapper.jarbin0 -> 50557 bytes
-rw-r--r--OpenKeychain-API/gradle/wrapper/gradle-wrapper.properties6
-rwxr-xr-xOpenKeychain-API/gradlew164
-rw-r--r--OpenKeychain-API/gradlew.bat90
-rw-r--r--OpenKeychain-API/libraries/openkeychain-api-library/.gitignore29
-rw-r--r--OpenKeychain-API/libraries/openkeychain-api-library/AndroidManifest.xml13
-rw-r--r--OpenKeychain-API/libraries/openkeychain-api-library/LICENSE202
-rw-r--r--OpenKeychain-API/libraries/openkeychain-api-library/build.gradle35
-rw-r--r--OpenKeychain-API/libraries/openkeychain-api-library/build.xml92
-rw-r--r--OpenKeychain-API/libraries/openkeychain-api-library/proguard-project.txt20
-rw-r--r--OpenKeychain-API/libraries/openkeychain-api-library/project.properties15
-rw-r--r--OpenKeychain-API/libraries/openkeychain-api-library/src/org/sufficientlysecure/keychain/api/OpenKeychainIntents.java37
-rw-r--r--OpenKeychain-API/libraries/openpgp-api-library/.gitignore29
-rw-r--r--OpenKeychain-API/libraries/openpgp-api-library/AndroidManifest.xml13
-rw-r--r--OpenKeychain-API/libraries/openpgp-api-library/LICENSE202
-rw-r--r--OpenKeychain-API/libraries/openpgp-api-library/build.gradle35
-rw-r--r--OpenKeychain-API/libraries/openpgp-api-library/build.xml92
-rw-r--r--OpenKeychain-API/libraries/openpgp-api-library/proguard-project.txt20
-rw-r--r--OpenKeychain-API/libraries/openpgp-api-library/project.properties15
-rw-r--r--OpenKeychain-API/libraries/openpgp-api-library/res/drawable-hdpi/ic_action_cancel_launchersize.pngbin0 -> 1520 bytes
-rw-r--r--OpenKeychain-API/libraries/openpgp-api-library/res/drawable-hdpi/ic_action_cancel_launchersize_light.pngbin0 -> 1940 bytes
-rw-r--r--OpenKeychain-API/libraries/openpgp-api-library/res/drawable-mdpi/ic_action_cancel_launchersize.pngbin0 -> 1032 bytes
-rw-r--r--OpenKeychain-API/libraries/openpgp-api-library/res/drawable-mdpi/ic_action_cancel_launchersize_light.pngbin0 -> 1098 bytes
-rw-r--r--OpenKeychain-API/libraries/openpgp-api-library/res/drawable-xhdpi/ic_action_cancel_launchersize.pngbin0 -> 1570 bytes
-rw-r--r--OpenKeychain-API/libraries/openpgp-api-library/res/drawable-xhdpi/ic_action_cancel_launchersize_light.pngbin0 -> 2039 bytes
-rw-r--r--OpenKeychain-API/libraries/openpgp-api-library/res/drawable-xxhdpi/ic_action_cancel_launchersize.pngbin0 -> 2345 bytes
-rw-r--r--OpenKeychain-API/libraries/openpgp-api-library/res/drawable-xxhdpi/ic_action_cancel_launchersize_light.pngbin0 -> 2404 bytes
-rw-r--r--OpenKeychain-API/libraries/openpgp-api-library/res/values/strings.xml7
-rw-r--r--OpenKeychain-API/libraries/openpgp-api-library/src/org/openintents/openpgp/IOpenPgpService.aidl24
-rw-r--r--OpenKeychain-API/libraries/openpgp-api-library/src/org/openintents/openpgp/OpenPgpError.java118
-rw-r--r--OpenKeychain-API/libraries/openpgp-api-library/src/org/openintents/openpgp/OpenPgpSignatureResult.java159
-rw-r--r--OpenKeychain-API/libraries/openpgp-api-library/src/org/openintents/openpgp/util/OpenPgpApi.java261
-rw-r--r--OpenKeychain-API/libraries/openpgp-api-library/src/org/openintents/openpgp/util/OpenPgpListPreference.java257
-rw-r--r--OpenKeychain-API/libraries/openpgp-api-library/src/org/openintents/openpgp/util/OpenPgpServiceConnection.java118
-rw-r--r--OpenKeychain-API/libraries/openpgp-api-library/src/org/openintents/openpgp/util/OpenPgpUtils.java64
-rw-r--r--OpenKeychain-API/libraries/openpgp-api-library/src/org/openintents/openpgp/util/ParcelFileDescriptorUtil.java103
-rw-r--r--OpenKeychain-API/settings.gradle3
57 files changed, 3755 insertions, 0 deletions
diff --git a/OpenKeychain-API/.gitignore b/OpenKeychain-API/.gitignore
new file mode 100644
index 000000000..aa8bb5760
--- /dev/null
+++ b/OpenKeychain-API/.gitignore
@@ -0,0 +1,29 @@
+#Android specific
+bin
+gen
+obj
+lint.xml
+local.properties
+release.properties
+ant.properties
+*.class
+*.apk
+
+#Gradle
+.gradle
+build
+gradle.properties
+
+#Maven
+target
+pom.xml.*
+
+#Eclipse
+.project
+.classpath
+.settings
+.metadata
+
+#IntelliJ IDEA
+.idea
+*.iml
diff --git a/OpenKeychain-API/build.gradle b/OpenKeychain-API/build.gradle
new file mode 100644
index 000000000..0ce5dc8c0
--- /dev/null
+++ b/OpenKeychain-API/build.gradle
@@ -0,0 +1,3 @@
+task wrapper(type: Wrapper) {
+ gradleVersion = '1.10'
+}
diff --git a/OpenKeychain-API/example-app/build.gradle b/OpenKeychain-API/example-app/build.gradle
new file mode 100644
index 000000000..e7a25e689
--- /dev/null
+++ b/OpenKeychain-API/example-app/build.gradle
@@ -0,0 +1,61 @@
+// please leave this here, so this library builds on its own
+buildscript {
+ repositories {
+ mavenCentral()
+ }
+
+ dependencies {
+ classpath 'com.android.tools.build:gradle:0.9.0'
+ }
+}
+
+apply plugin: 'android'
+
+dependencies {
+ compile 'com.android.support:support-v4:19.0.1'
+ compile project(':libraries:openpgp-api-library')
+ compile project(':libraries:openkeychain-api-library')
+}
+
+android {
+ compileSdkVersion 19
+ buildToolsVersion "19.0.3"
+
+ defaultConfig {
+ minSdkVersion 9
+ targetSdkVersion 19
+ }
+
+ /*
+ * To sign release build, create file gradle.properties in ~/.gradle/ with this content:
+ *
+ * signingStoreLocation=/home/key.store
+ * signingStorePassword=xxx
+ * signingKeyAlias=alias
+ * signingKeyPassword=xxx
+ */
+ if (project.hasProperty('signingStoreLocation') &&
+ project.hasProperty('signingStorePassword') &&
+ project.hasProperty('signingKeyAlias') &&
+ project.hasProperty('signingKeyPassword')) {
+ println "Found sign properties in gradle.properties! Signing build…"
+
+ signingConfigs {
+ release {
+ storeFile file(signingStoreLocation)
+ storePassword signingStorePassword
+ keyAlias signingKeyAlias
+ keyPassword signingKeyPassword
+ }
+ }
+
+ buildTypes.release.signingConfig = signingConfigs.release
+ } else {
+ buildTypes.release.signingConfig = null
+ }
+
+ // Do not abort build if lint finds errors
+ lintOptions {
+ abortOnError false
+ }
+}
diff --git a/OpenKeychain-API/example-app/ic_launcher-web.png b/OpenKeychain-API/example-app/ic_launcher-web.png
new file mode 100644
index 000000000..ae4cd0976
--- /dev/null
+++ b/OpenKeychain-API/example-app/ic_launcher-web.png
Binary files differ
diff --git a/OpenKeychain-API/example-app/src/main/AndroidManifest.xml b/OpenKeychain-API/example-app/src/main/AndroidManifest.xml
new file mode 100644
index 000000000..d62c26495
--- /dev/null
+++ b/OpenKeychain-API/example-app/src/main/AndroidManifest.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="org.sufficientlysecure.keychain.demo"
+ android:versionCode="4"
+ android:versionName="3">
+
+ <uses-sdk
+ android:minSdkVersion="9"
+ android:targetSdkVersion="19" />
+
+ <application
+ android:allowBackup="true"
+ android:icon="@drawable/ic_launcher"
+ android:label="OpenKeychain API Demo">
+ <activity
+ android:name=".BaseActivity"
+ android:label="OpenKeychain API Demo">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ <activity
+ android:name=".OpenPgpProviderActivity"
+ android:label="OpenPGP Provider"
+ android:windowSoftInputMode="stateHidden" />
+ <activity
+ android:name=".IntentActivity"
+ android:label="Intents" />
+ </application>
+
+</manifest> \ No newline at end of file
diff --git a/OpenKeychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/BaseActivity.java b/OpenKeychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/BaseActivity.java
new file mode 100644
index 000000000..dd642d879
--- /dev/null
+++ b/OpenKeychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/BaseActivity.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2012-2014 Dominik Schürmann <dominik@dominikschuermann.de>
+ *
+ * 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.Intent;
+import android.os.Bundle;
+import android.preference.Preference;
+import android.preference.Preference.OnPreferenceClickListener;
+import android.preference.PreferenceActivity;
+import android.widget.Toast;
+
+public class BaseActivity extends PreferenceActivity {
+ private Preference mIntentDemo;
+ private Preference mCryptoProvider;
+
+ /**
+ * Called when the activity is first created.
+ */
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ // load preferences from xml
+ addPreferencesFromResource(R.xml.base_preference);
+
+ // find preferences
+ mIntentDemo = (Preference) findPreference("intent_demo");
+ mCryptoProvider = (Preference) findPreference("openpgp_provider_demo");
+
+ mIntentDemo.setOnPreferenceClickListener(new OnPreferenceClickListener() {
+ @Override
+ public boolean onPreferenceClick(Preference preference) {
+ startActivity(new Intent(BaseActivity.this, IntentActivity.class));
+
+ return false;
+ }
+ });
+
+ mCryptoProvider.setOnPreferenceClickListener(new OnPreferenceClickListener() {
+ @Override
+ public boolean onPreferenceClick(Preference preference) {
+ startActivity(new Intent(BaseActivity.this, OpenPgpProviderActivity.class));
+
+ return false;
+ }
+ });
+ }
+
+}
diff --git a/OpenKeychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/Constants.java b/OpenKeychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/Constants.java
new file mode 100644
index 000000000..acff12f47
--- /dev/null
+++ b/OpenKeychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/Constants.java
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2013-2014 Dominik Schürmann <dominik@dominikschuermann.de>
+ *
+ * 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;
+
+public final class Constants {
+ public static final String TAG = "Keychain";
+}
diff --git a/OpenKeychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/IntentActivity.java b/OpenKeychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/IntentActivity.java
new file mode 100644
index 000000000..e8aa2a2e7
--- /dev/null
+++ b/OpenKeychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/IntentActivity.java
@@ -0,0 +1,583 @@
+/*
+ * Copyright (C) 2014 Dominik Schürmann <dominik@dominikschuermann.de>
+ *
+ * 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.OpenKeychainIntents;
+
+import java.io.UnsupportedEncodingException;
+
+public class IntentActivity extends PreferenceActivity {
+ private Preference mEncrypt;
+ private Preference mEncryptUri;
+ private Preference mDecrypt;
+ private Preference mImportKey;
+ private Preference mImportKeyFromKeyserver;
+ private Preference mImportKeyFromQrCode;
+ private Preference mOpenpgp4fpr;
+
+ private static final int REQUEST_CODE_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
+ mEncrypt = (Preference) findPreference("ENCRYPT");
+ mEncryptUri = (Preference) findPreference("ENCRYPT_URI");
+ mDecrypt = (Preference) findPreference("DECRYPT");
+ mImportKey = (Preference) findPreference("IMPORT_KEY");
+ mImportKeyFromKeyserver = (Preference) findPreference("IMPORT_KEY_FROM_KEYSERVER");
+ mImportKeyFromQrCode = (Preference) findPreference("IMPORT_KEY_FROM_QR_CODE");
+ mOpenpgp4fpr = (Preference) findPreference("openpgp4fpr");
+
+
+ mEncrypt.setOnPreferenceClickListener(new OnPreferenceClickListener() {
+ @Override
+ public boolean onPreferenceClick(Preference preference) {
+ try {
+ 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();
+ }
+
+ return false;
+ }
+ });
+
+ mEncryptUri.setOnPreferenceClickListener(new OnPreferenceClickListener() {
+ @Override
+ public boolean onPreferenceClick(Preference preference) {
+ Intent photoPickerIntent = new Intent(Intent.ACTION_PICK);
+ photoPickerIntent.setType("image/*");
+ startActivityForResult(photoPickerIntent, REQUEST_CODE_SELECT_PHOTO);
+
+ return false;
+ }
+ });
+
+ mDecrypt.setOnPreferenceClickListener(new OnPreferenceClickListener() {
+ @Override
+ public boolean onPreferenceClick(Preference preference) {
+ try {
+ 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();
+ }
+
+ return false;
+ }
+ });
+
+ mImportKey.setOnPreferenceClickListener(new OnPreferenceClickListener() {
+ @Override
+ public boolean onPreferenceClick(Preference preference) {
+ try {
+ Intent intent = new Intent(OpenKeychainIntents.IMPORT_KEY);
+ byte[] pubkey = null;
+ try {
+ pubkey = TEST_PUBKEY.getBytes("UTF-8");
+ intent.putExtra(OpenKeychainIntents.IMPORT_KEY_EXTRA_KEY_BYTES, pubkey);
+ startActivity(intent);
+ } catch (UnsupportedEncodingException e) {
+ Log.e(Constants.TAG, "UnsupportedEncodingException", e);
+ }
+ } catch (ActivityNotFoundException e) {
+ Toast.makeText(IntentActivity.this, "Activity not found!", Toast.LENGTH_LONG).show();
+ }
+
+ return false;
+ }
+ });
+
+ mImportKeyFromKeyserver.setOnPreferenceClickListener(new OnPreferenceClickListener() {
+ @Override
+ public boolean onPreferenceClick(Preference preference) {
+ try {
+ 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();
+ }
+
+ return false;
+ }
+ });
+
+ mImportKeyFromQrCode.setOnPreferenceClickListener(new OnPreferenceClickListener() {
+ @Override
+ public boolean onPreferenceClick(Preference preference) {
+ try {
+ 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();
+ }
+
+ return false;
+ }
+ });
+
+ mOpenpgp4fpr.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 REQUEST_CODE_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(OpenKeychainIntents.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();
+ }
+ }
+ }
+ }
+
+ 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" +
+ "KjT0U5l2z6t6daL7qWfZ1pQkCuCMe43eMLBPvyao1+zEd1zESbMz/bySZRlYMKAC\n" +
+ "aD9pGnFHS+EOU+lQXxfzCpKEQcHmPrrBFh2Gr2JFWWjZArKh7B1lQLekD2KS8aFb\n" +
+ "Lg1WGo5tK1sSk6MnMmqs1zNw1n15p5UDnJ7Qh8ecfMyDLy/ZyUjfFjy4BE0p+4mS\n" +
+ "J5iDU0pTYK3BpdfujY6NE+S2Ca2J6QoNRN8XABEBAAG0MURvbWluaWsgU2Now7xy\n" +
+ "bWFubiA8ZG9taW5pa0Bkb21pbmlrc2NodWVybWFubi5kZT6JAT8EEwECACkCGyMF\n" +
+ "CQlmAYAGCwkIBwMCBBUCCAMEFgIDAQIeAQIX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LD8MHXz\n" +
+ "hCRY9Rp2ZxX92PrFiSNpKheP30iZM8VInDfPGaApQU1y8R2uLL0I/7XWiFtpmR6e\n" +
+ "k3wUxv46o0y15asU\n" +
+ "=Bbew\n" +
+ "-----END PGP PUBLIC KEY BLOCK-----\n";
+
+}
diff --git a/OpenKeychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/OpenPgpProviderActivity.java b/OpenKeychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/OpenPgpProviderActivity.java
new file mode 100644
index 000000000..345d63eef
--- /dev/null
+++ b/OpenKeychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/OpenPgpProviderActivity.java
@@ -0,0 +1,308 @@
+/*
+ * Copyright (C) 2013-2014 Dominik Schürmann <dominik@dominikschuermann.de>
+ *
+ * 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.app.Activity;
+import android.app.PendingIntent;
+import android.content.Intent;
+import android.content.IntentSender;
+import android.content.SharedPreferences;
+import android.os.Bundle;
+import android.preference.PreferenceManager;
+import android.text.TextUtils;
+import android.util.Log;
+import android.view.View;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.Toast;
+
+import org.openintents.openpgp.OpenPgpError;
+import org.openintents.openpgp.OpenPgpSignatureResult;
+import org.openintents.openpgp.util.OpenPgpApi;
+import org.openintents.openpgp.util.OpenPgpServiceConnection;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+
+public class OpenPgpProviderActivity extends Activity {
+ private EditText mMessage;
+ private EditText mCiphertext;
+ private EditText mEncryptUserIds;
+ private Button mSign;
+ private Button mEncrypt;
+ private Button mSignAndEncrypt;
+ private Button mDecryptAndVerify;
+ private EditText mAccount;
+
+ private OpenPgpServiceConnection mServiceConnection;
+
+ public static final int REQUEST_CODE_SIGN = 9910;
+ public static final int REQUEST_CODE_ENCRYPT = 9911;
+ 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 savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.openpgp_provider);
+
+ 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);
+ mAccount = (EditText) findViewById(R.id.crypto_provider_demo_account);
+
+ mSign.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ sign(new Intent());
+ }
+ });
+ mEncrypt.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ encrypt(new Intent());
+ }
+ });
+ mSignAndEncrypt.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ signAndEncrypt(new Intent());
+ }
+ });
+ mDecryptAndVerify.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ decryptAndVerify(new Intent());
+ }
+ });
+
+ 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
+ mServiceConnection = new OpenPgpServiceConnection(
+ OpenPgpProviderActivity.this, providerPackageName);
+ mServiceConnection.bindToService();
+ }
+ }
+
+ private void handleError(final OpenPgpError error) {
+ runOnUiThread(new Runnable() {
+
+ @Override
+ public void run() {
+ Toast.makeText(OpenPgpProviderActivity.this,
+ "onError id:" + error.getErrorId() + "\n\n" + error.getMessage(),
+ Toast.LENGTH_LONG).show();
+ Log.e(Constants.TAG, "onError getErrorId:" + error.getErrorId());
+ Log.e(Constants.TAG, "onError getMessage:" + error.getMessage());
+ }
+ });
+ }
+
+ private void handleSignature(final OpenPgpSignatureResult sigResult) {
+ runOnUiThread(new Runnable() {
+
+ @Override
+ public void run() {
+ Toast.makeText(OpenPgpProviderActivity.this,
+ sigResult.toString(),
+ Toast.LENGTH_LONG).show();
+ }
+ });
+ }
+
+ /**
+ * Takes input from message or ciphertext EditText and turns it into a ByteArrayInputStream
+ *
+ * @param ciphertext
+ * @return
+ */
+ private InputStream getInputstream(boolean ciphertext) {
+ InputStream is = null;
+ try {
+ String inputStr;
+ if (ciphertext) {
+ inputStr = mCiphertext.getText().toString();
+ } else {
+ inputStr = mMessage.getText().toString();
+ }
+ is = new ByteArrayInputStream(inputStr.getBytes("UTF-8"));
+ } catch (UnsupportedEncodingException e) {
+ Log.e(Constants.TAG, "UnsupportedEncodingException", e);
+ }
+
+ return is;
+ }
+
+ private class MyCallback implements OpenPgpApi.IOpenPgpCallback {
+ boolean returnToCiphertextField;
+ ByteArrayOutputStream os;
+ int requestCode;
+
+ private MyCallback(boolean returnToCiphertextField, ByteArrayOutputStream os, int requestCode) {
+ this.returnToCiphertextField = returnToCiphertextField;
+ this.os = os;
+ this.requestCode = requestCode;
+ }
+
+ @Override
+ public void onReturn(Intent result) {
+ switch (result.getIntExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_ERROR)) {
+ case OpenPgpApi.RESULT_CODE_SUCCESS: {
+ try {
+ Log.d(OpenPgpApi.TAG, "result: " + os.toByteArray().length
+ + " str=" + os.toString("UTF-8"));
+
+ if (returnToCiphertextField) {
+ mCiphertext.setText(os.toString("UTF-8"));
+ } else {
+ mMessage.setText(os.toString("UTF-8"));
+ }
+ } catch (UnsupportedEncodingException e) {
+ Log.e(Constants.TAG, "UnsupportedEncodingException", e);
+ }
+
+ if (result.hasExtra(OpenPgpApi.RESULT_SIGNATURE)) {
+ OpenPgpSignatureResult sigResult
+ = result.getParcelableExtra(OpenPgpApi.RESULT_SIGNATURE);
+ handleSignature(sigResult);
+ }
+ break;
+ }
+ case OpenPgpApi.RESULT_CODE_USER_INTERACTION_REQUIRED: {
+ PendingIntent pi = result.getParcelableExtra(OpenPgpApi.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 OpenPgpApi.RESULT_CODE_ERROR: {
+ OpenPgpError error = result.getParcelableExtra(OpenPgpApi.RESULT_ERROR);
+ handleError(error);
+ break;
+ }
+ }
+ }
+ }
+
+ public void sign(Intent data) {
+ data.setAction(OpenPgpApi.ACTION_SIGN);
+ data.putExtra(OpenPgpApi.EXTRA_REQUEST_ASCII_ARMOR, true);
+ data.putExtra(OpenPgpApi.EXTRA_ACCOUNT_NAME, mAccount.getText().toString());
+
+ InputStream is = getInputstream(false);
+ ByteArrayOutputStream os = new ByteArrayOutputStream();
+
+ OpenPgpApi api = new OpenPgpApi(this, mServiceConnection.getService());
+ api.executeApiAsync(data, is, os, new MyCallback(true, os, REQUEST_CODE_SIGN));
+ }
+
+ public void encrypt(Intent data) {
+ data.setAction(OpenPgpApi.ACTION_ENCRYPT);
+ data.putExtra(OpenPgpApi.EXTRA_USER_IDS, mEncryptUserIds.getText().toString().split(","));
+ data.putExtra(OpenPgpApi.EXTRA_REQUEST_ASCII_ARMOR, true);
+ data.putExtra(OpenPgpApi.EXTRA_ACCOUNT_NAME, mAccount.getText().toString());
+
+ InputStream is = getInputstream(false);
+ ByteArrayOutputStream os = new ByteArrayOutputStream();
+
+ OpenPgpApi api = new OpenPgpApi(this, mServiceConnection.getService());
+ api.executeApiAsync(data, is, os, new MyCallback(true, os, REQUEST_CODE_ENCRYPT));
+ }
+
+ public void signAndEncrypt(Intent data) {
+ data.setAction(OpenPgpApi.ACTION_SIGN_AND_ENCRYPT);
+ data.putExtra(OpenPgpApi.EXTRA_USER_IDS, mEncryptUserIds.getText().toString().split(","));
+ data.putExtra(OpenPgpApi.EXTRA_REQUEST_ASCII_ARMOR, true);
+ data.putExtra(OpenPgpApi.EXTRA_ACCOUNT_NAME, mAccount.getText().toString());
+
+ InputStream is = getInputstream(false);
+ ByteArrayOutputStream os = new ByteArrayOutputStream();
+
+ OpenPgpApi api = new OpenPgpApi(this, mServiceConnection.getService());
+ api.executeApiAsync(data, is, os, new MyCallback(true, os, REQUEST_CODE_SIGN_AND_ENCRYPT));
+ }
+
+ public void decryptAndVerify(Intent data) {
+ data.setAction(OpenPgpApi.ACTION_DECRYPT_VERIFY);
+ data.putExtra(OpenPgpApi.EXTRA_REQUEST_ASCII_ARMOR, true);
+ data.putExtra(OpenPgpApi.EXTRA_ACCOUNT_NAME, mAccount.getText().toString());
+
+ InputStream is = getInputstream(true);
+ ByteArrayOutputStream os = new ByteArrayOutputStream();
+
+ OpenPgpApi api = new OpenPgpApi(this, mServiceConnection.getService());
+ api.executeApiAsync(data, is, os, new MyCallback(false, os, REQUEST_CODE_DECRYPT_AND_VERIFY));
+ }
+
+ @Override
+ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+ super.onActivityResult(requestCode, resultCode, data);
+ Log.d(Constants.TAG, "onActivityResult resultCode: " + resultCode);
+
+ // try again after user interaction
+ if (resultCode == RESULT_OK) {
+ /*
+ * The data originally given to one of the methods above, is again
+ * returned here to be used when calling the method again after user
+ * interaction. The Intent now also contains results from the user
+ * interaction, for example selected key ids.
+ */
+ switch (requestCode) {
+ case REQUEST_CODE_SIGN: {
+ sign(data);
+ break;
+ }
+ case REQUEST_CODE_ENCRYPT: {
+ encrypt(data);
+ break;
+ }
+ case REQUEST_CODE_SIGN_AND_ENCRYPT: {
+ signAndEncrypt(data);
+ break;
+ }
+ case REQUEST_CODE_DECRYPT_AND_VERIFY: {
+ decryptAndVerify(data);
+ break;
+ }
+ }
+ }
+ }
+
+ @Override
+ public void onDestroy() {
+ super.onDestroy();
+
+ if (mServiceConnection != null) {
+ mServiceConnection.unbindFromService();
+ }
+ }
+
+}
diff --git a/OpenKeychain-API/example-app/src/main/res/drawable-hdpi/ic_launcher.png b/OpenKeychain-API/example-app/src/main/res/drawable-hdpi/ic_launcher.png
new file mode 100644
index 000000000..cf114d7db
--- /dev/null
+++ b/OpenKeychain-API/example-app/src/main/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/OpenKeychain-API/example-app/src/main/res/drawable-mdpi/ic_launcher.png b/OpenKeychain-API/example-app/src/main/res/drawable-mdpi/ic_launcher.png
new file mode 100644
index 000000000..d55318843
--- /dev/null
+++ b/OpenKeychain-API/example-app/src/main/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/OpenKeychain-API/example-app/src/main/res/drawable-xhdpi/ic_launcher.png b/OpenKeychain-API/example-app/src/main/res/drawable-xhdpi/ic_launcher.png
new file mode 100644
index 000000000..13ed3d450
--- /dev/null
+++ b/OpenKeychain-API/example-app/src/main/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/OpenKeychain-API/example-app/src/main/res/drawable-xxhdpi/ic_launcher.png b/OpenKeychain-API/example-app/src/main/res/drawable-xxhdpi/ic_launcher.png
new file mode 100644
index 000000000..831c993d4
--- /dev/null
+++ b/OpenKeychain-API/example-app/src/main/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/OpenKeychain-API/example-app/src/main/res/layout/openpgp_provider.xml b/OpenKeychain-API/example-app/src/main/res/layout/openpgp_provider.xml
new file mode 100644
index 000000000..2b8e8016a
--- /dev/null
+++ b/OpenKeychain-API/example-app/src/main/res/layout/openpgp_provider.xml
@@ -0,0 +1,123 @@
+<?xml version="1.0" encoding="utf-8"?>
+<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/parent_scroll"
+ android:fillViewport="true"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <LinearLayout
+ android:padding="8dp"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="Encrypt UserIds (split with &apos;,&apos;)"
+ android:textAppearance="?android:attr/textAppearanceMedium" />
+
+
+ <EditText
+ android:id="@+id/crypto_provider_demo_encrypt_user_id"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="dominik@dominikschuermann.de"
+ android:textAppearance="@android:style/TextAppearance.Small" />
+
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="Message"
+ android:textAppearance="?android:attr/textAppearanceMedium" />
+
+
+ <ScrollView
+ android:id="@+id/child_scroll1"
+ android:fillViewport="true"
+ android:layout_width="match_parent"
+ android:layout_height="120dp">
+
+ <EditText
+ android:id="@+id/crypto_provider_demo_message"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:scrollHorizontally="true"
+ android:scrollbars="vertical"
+ android:text="message"
+ android:hint="cleartext message"
+ android:textAppearance="@android:style/TextAppearance.Small" />
+ </ScrollView>
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="Ciphertext"
+ android:textAppearance="?android:attr/textAppearanceMedium" />
+
+ <ScrollView
+ android:id="@+id/child_scroll2"
+ android:fillViewport="true"
+ android:layout_width="match_parent"
+ android:layout_height="120dp">
+
+ <EditText
+ android:id="@+id/crypto_provider_demo_ciphertext"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:text="ciphertext"
+ android:hint="ciphertext"
+ android:textAppearance="@android:style/TextAppearance.Small" />
+ </ScrollView>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+
+ <Button
+ android:id="@+id/crypto_provider_demo_sign"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:text="Sign"
+ android:layout_gravity="center_vertical" />
+
+ <Button
+ android:id="@+id/crypto_provider_demo_encrypt"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:text="Encrypt"
+ android:layout_gravity="center_vertical" />
+
+ <Button
+ android:id="@+id/crypto_provider_demo_sign_and_encrypt"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:text="Sign and Encrypt"
+ android:layout_gravity="center_vertical" />
+ </LinearLayout>
+
+ <Button
+ android:id="@+id/crypto_provider_demo_decrypt_and_verify"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="Decrypt and Verify" />
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Account ID:"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:id="@+id/textView" />
+
+ <EditText
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="Alice &lt;alice@example.com&gt;"
+ android:id="@+id/crypto_provider_demo_account" />
+
+ </LinearLayout>
+</ScrollView> \ No newline at end of file
diff --git a/OpenKeychain-API/example-app/src/main/res/xml/base_preference.xml b/OpenKeychain-API/example-app/src/main/res/xml/base_preference.xml
new file mode 100644
index 000000000..b38e07a36
--- /dev/null
+++ b/OpenKeychain-API/example-app/src/main/res/xml/base_preference.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <PreferenceCategory android:title="OpenKeychain Intents">
+ <Preference
+ android:key="intent_demo"
+ android:title="Intent Demo" />
+ </PreferenceCategory>
+ <PreferenceCategory android:title="OpenPGP Provider API">
+ <org.openintents.openpgp.util.OpenPgpListPreference
+ android:key="openpgp_provider_list"
+ android:title="Select OpenPGP Provider!" />
+ <Preference
+ android:key="openpgp_provider_demo"
+ android:title="OpenPGP Provider Demo" />
+ </PreferenceCategory>
+
+</PreferenceScreen> \ No newline at end of file
diff --git a/OpenKeychain-API/example-app/src/main/res/xml/intent_preference.xml b/OpenKeychain-API/example-app/src/main/res/xml/intent_preference.xml
new file mode 100644
index 000000000..801e4a78a
--- /dev/null
+++ b/OpenKeychain-API/example-app/src/main/res/xml/intent_preference.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <PreferenceCategory android:title="Intents (org.sufficientlysecure.keychain.action.)">
+ <Preference
+ android:key="ENCRYPT"
+ android:title="ENCRYPT" />
+ <Preference
+ android:key="ENCRYPT_URI"
+ android:title="ENCRYPT with Uri" />
+ <Preference
+ android:key="DECRYPT"
+ android:title="DECRYPT" />
+ <Preference
+ android:key="IMPORT_KEY"
+ android:title="IMPORT_KEY" />
+ <Preference
+ android:key="IMPORT_KEY_FROM_KEYSERVER"
+ android:title="IMPORT_KEY_FROM_KEYSERVER" />
+ <Preference
+ android:key="IMPORT_KEY_FROM_QR_CODE"
+ android:title="IMPORT_KEY_FROM_QR_CODE" />
+ </PreferenceCategory>
+ <PreferenceCategory android:title="Special Intents">
+ <Preference
+ android:key="openpgp4fpr"
+ android:title="VIEW openpgp4fpr:73EE2314F65FA92EC2390D3A718C070100012282" />
+ </PreferenceCategory>
+
+</PreferenceScreen> \ No newline at end of file
diff --git a/OpenKeychain-API/gradle/gradle/wrapper/gradle-wrapper.jar b/OpenKeychain-API/gradle/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 000000000..583859812
--- /dev/null
+++ b/OpenKeychain-API/gradle/gradle/wrapper/gradle-wrapper.jar
Binary files differ
diff --git a/OpenKeychain-API/gradle/gradle/wrapper/gradle-wrapper.properties b/OpenKeychain-API/gradle/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 000000000..42c0fbd9d
--- /dev/null
+++ b/OpenKeychain-API/gradle/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Sun Feb 09 19:19:25 CET 2014
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=http\://services.gradle.org/distributions/gradle-1.10-bin.zip
diff --git a/OpenKeychain-API/gradle/gradlew b/OpenKeychain-API/gradle/gradlew
new file mode 100755
index 000000000..91a7e269e
--- /dev/null
+++ b/OpenKeychain-API/gradle/gradlew
@@ -0,0 +1,164 @@
+#!/usr/bin/env bash
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn ( ) {
+ echo "$*"
+}
+
+die ( ) {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+esac
+
+# For Cygwin, ensure paths are in UNIX format before anything is touched.
+if $cygwin ; then
+ [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+fi
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >&-
+APP_HOME="`pwd -P`"
+cd "$SAVED" >&-
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
+function splitJvmOpts() {
+ JVM_OPTS=("$@")
+}
+eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
+JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
+
+exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/OpenKeychain-API/gradle/gradlew.bat b/OpenKeychain-API/gradle/gradlew.bat
new file mode 100644
index 000000000..aec99730b
--- /dev/null
+++ b/OpenKeychain-API/gradle/gradlew.bat
@@ -0,0 +1,90 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windowz variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+if "%@eval[2+2]" == "4" goto 4NT_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+goto execute
+
+:4NT_args
+@rem Get arguments from the 4NT Shell from JP Software
+set CMD_LINE_ARGS=%$
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/OpenKeychain-API/gradle/wrapper/gradle-wrapper.jar b/OpenKeychain-API/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 000000000..583859812
--- /dev/null
+++ b/OpenKeychain-API/gradle/wrapper/gradle-wrapper.jar
Binary files differ
diff --git a/OpenKeychain-API/gradle/wrapper/gradle-wrapper.properties b/OpenKeychain-API/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 000000000..d8e0b5b29
--- /dev/null
+++ b/OpenKeychain-API/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Thu Mar 06 22:23:44 CET 2014
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=http\://services.gradle.org/distributions/gradle-1.10-bin.zip
diff --git a/OpenKeychain-API/gradlew b/OpenKeychain-API/gradlew
new file mode 100755
index 000000000..91a7e269e
--- /dev/null
+++ b/OpenKeychain-API/gradlew
@@ -0,0 +1,164 @@
+#!/usr/bin/env bash
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn ( ) {
+ echo "$*"
+}
+
+die ( ) {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+esac
+
+# For Cygwin, ensure paths are in UNIX format before anything is touched.
+if $cygwin ; then
+ [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+fi
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >&-
+APP_HOME="`pwd -P`"
+cd "$SAVED" >&-
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
+function splitJvmOpts() {
+ JVM_OPTS=("$@")
+}
+eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
+JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
+
+exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/OpenKeychain-API/gradlew.bat b/OpenKeychain-API/gradlew.bat
new file mode 100644
index 000000000..aec99730b
--- /dev/null
+++ b/OpenKeychain-API/gradlew.bat
@@ -0,0 +1,90 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windowz variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+if "%@eval[2+2]" == "4" goto 4NT_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+goto execute
+
+:4NT_args
+@rem Get arguments from the 4NT Shell from JP Software
+set CMD_LINE_ARGS=%$
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/OpenKeychain-API/libraries/openkeychain-api-library/.gitignore b/OpenKeychain-API/libraries/openkeychain-api-library/.gitignore
new file mode 100644
index 000000000..aa8bb5760
--- /dev/null
+++ b/OpenKeychain-API/libraries/openkeychain-api-library/.gitignore
@@ -0,0 +1,29 @@
+#Android specific
+bin
+gen
+obj
+lint.xml
+local.properties
+release.properties
+ant.properties
+*.class
+*.apk
+
+#Gradle
+.gradle
+build
+gradle.properties
+
+#Maven
+target
+pom.xml.*
+
+#Eclipse
+.project
+.classpath
+.settings
+.metadata
+
+#IntelliJ IDEA
+.idea
+*.iml
diff --git a/OpenKeychain-API/libraries/openkeychain-api-library/AndroidManifest.xml b/OpenKeychain-API/libraries/openkeychain-api-library/AndroidManifest.xml
new file mode 100644
index 000000000..768922c22
--- /dev/null
+++ b/OpenKeychain-API/libraries/openkeychain-api-library/AndroidManifest.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="org.sufficientlysecure.keychain.api"
+ android:versionCode="1"
+ android:versionName="1.0" >
+
+ <uses-sdk
+ android:minSdkVersion="9"
+ android:targetSdkVersion="19" />
+
+ <application/>
+
+</manifest> \ No newline at end of file
diff --git a/OpenKeychain-API/libraries/openkeychain-api-library/LICENSE b/OpenKeychain-API/libraries/openkeychain-api-library/LICENSE
new file mode 100644
index 000000000..d64569567
--- /dev/null
+++ b/OpenKeychain-API/libraries/openkeychain-api-library/LICENSE
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ 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.
diff --git a/OpenKeychain-API/libraries/openkeychain-api-library/build.gradle b/OpenKeychain-API/libraries/openkeychain-api-library/build.gradle
new file mode 100644
index 000000000..98c9a3bd6
--- /dev/null
+++ b/OpenKeychain-API/libraries/openkeychain-api-library/build.gradle
@@ -0,0 +1,35 @@
+// please leave this here, so this library builds on its own
+buildscript {
+ repositories {
+ mavenCentral()
+ }
+
+ dependencies {
+ classpath 'com.android.tools.build:gradle:0.9.0'
+ }
+}
+
+apply plugin: 'android-library'
+
+android {
+ compileSdkVersion 19
+ buildToolsVersion '19.0.3'
+
+ // NOTE: We are using the old folder structure to also support Eclipse
+ sourceSets {
+ main {
+ manifest.srcFile 'AndroidManifest.xml'
+ java.srcDirs = ['src']
+ resources.srcDirs = ['src']
+ aidl.srcDirs = ['src']
+ renderscript.srcDirs = ['src']
+ res.srcDirs = ['res']
+ assets.srcDirs = ['assets']
+ }
+ }
+
+ // Do not abort build if lint finds errors
+ lintOptions {
+ abortOnError false
+ }
+}
diff --git a/OpenKeychain-API/libraries/openkeychain-api-library/build.xml b/OpenKeychain-API/libraries/openkeychain-api-library/build.xml
new file mode 100644
index 000000000..48ebf198c
--- /dev/null
+++ b/OpenKeychain-API/libraries/openkeychain-api-library/build.xml
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="keychain-api-library" default="help">
+
+ <!-- The local.properties file is created and updated by the 'android' tool.
+ It contains the path to the SDK. It should *NOT* be checked into
+ Version Control Systems. -->
+ <property file="local.properties" />
+
+ <!-- The ant.properties file can be created by you. It is only edited by the
+ 'android' tool to add properties to it.
+ This is the place to change some Ant specific build properties.
+ Here are some properties you may want to change/update:
+
+ source.dir
+ The name of the source directory. Default is 'src'.
+ out.dir
+ The name of the output directory. Default is 'bin'.
+
+ For other overridable properties, look at the beginning of the rules
+ files in the SDK, at tools/ant/build.xml
+
+ Properties related to the SDK location or the project target should
+ be updated using the 'android' tool with the 'update' action.
+
+ This file is an integral part of the build system for your
+ application and should be checked into Version Control Systems.
+
+ -->
+ <property file="ant.properties" />
+
+ <!-- if sdk.dir was not set from one of the property file, then
+ get it from the ANDROID_HOME env var.
+ This must be done before we load project.properties since
+ the proguard config can use sdk.dir -->
+ <property environment="env" />
+ <condition property="sdk.dir" value="${env.ANDROID_HOME}">
+ <isset property="env.ANDROID_HOME" />
+ </condition>
+
+ <!-- The project.properties file is created and updated by the 'android'
+ tool, as well as ADT.
+
+ This contains project specific properties such as project target, and library
+ dependencies. Lower level build properties are stored in ant.properties
+ (or in .classpath for Eclipse projects).
+
+ This file is an integral part of the build system for your
+ application and should be checked into Version Control Systems. -->
+ <loadproperties srcFile="project.properties" />
+
+ <!-- quick check on sdk.dir -->
+ <fail
+ message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable."
+ unless="sdk.dir"
+ />
+
+ <!--
+ Import per project custom build rules if present at the root of the project.
+ This is the place to put custom intermediary targets such as:
+ -pre-build
+ -pre-compile
+ -post-compile (This is typically used for code obfuscation.
+ Compiled code location: ${out.classes.absolute.dir}
+ If this is not done in place, override ${out.dex.input.absolute.dir})
+ -post-package
+ -post-build
+ -pre-clean
+ -->
+ <import file="custom_rules.xml" optional="true" />
+
+ <!-- Import the actual build file.
+
+ To customize existing targets, there are two options:
+ - Customize only one target:
+ - copy/paste the target into this file, *before* the
+ <import> task.
+ - customize it to your needs.
+ - Customize the whole content of build.xml
+ - copy/paste the content of the rules files (minus the top node)
+ into this file, replacing the <import> task.
+ - customize to your needs.
+
+ ***********************
+ ****** IMPORTANT ******
+ ***********************
+ In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
+ in order to avoid having your file be overridden by tools such as "android update project"
+ -->
+ <!-- version-tag: 1 -->
+ <import file="${sdk.dir}/tools/ant/build.xml" />
+
+</project>
diff --git a/OpenKeychain-API/libraries/openkeychain-api-library/proguard-project.txt b/OpenKeychain-API/libraries/openkeychain-api-library/proguard-project.txt
new file mode 100644
index 000000000..f2fe1559a
--- /dev/null
+++ b/OpenKeychain-API/libraries/openkeychain-api-library/proguard-project.txt
@@ -0,0 +1,20 @@
+# To enable ProGuard in your project, edit project.properties
+# to define the proguard.config property as described in that file.
+#
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in ${sdk.dir}/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the ProGuard
+# include property in project.properties.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
diff --git a/OpenKeychain-API/libraries/openkeychain-api-library/project.properties b/OpenKeychain-API/libraries/openkeychain-api-library/project.properties
new file mode 100644
index 000000000..91d2b0246
--- /dev/null
+++ b/OpenKeychain-API/libraries/openkeychain-api-library/project.properties
@@ -0,0 +1,15 @@
+# This file is automatically generated by Android Tools.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+#
+# This file must be checked in Version Control Systems.
+#
+# To customize properties used by the Ant build system edit
+# "ant.properties", and override values to adapt the script to your
+# project structure.
+#
+# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
+#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
+
+# Project target.
+target=android-19
+android.library=true
diff --git a/OpenKeychain-API/libraries/openkeychain-api-library/src/org/sufficientlysecure/keychain/api/OpenKeychainIntents.java b/OpenKeychain-API/libraries/openkeychain-api-library/src/org/sufficientlysecure/keychain/api/OpenKeychainIntents.java
new file mode 100644
index 000000000..15aceb534
--- /dev/null
+++ b/OpenKeychain-API/libraries/openkeychain-api-library/src/org/sufficientlysecure/keychain/api/OpenKeychainIntents.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 Dominik Schürmann <dominik@dominikschuermann.de>
+ *
+ * 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.api;
+
+public class OpenKeychainIntents {
+
+ public static final String ENCRYPT = "org.sufficientlysecure.keychain.action.ENCRYPT";
+ public static final String ENCRYPT_EXTRA_TEXT = "text"; // String
+ public static final String ENCRYPT_ASCII_ARMOR = "ascii_armor"; // boolean
+
+ public static final String DECRYPT = "org.sufficientlysecure.keychain.action.DECRYPT";
+ public static final String DECRYPT_EXTRA_TEXT = "text"; // String
+
+ public static final String IMPORT_KEY = "org.sufficientlysecure.keychain.action.IMPORT_KEY";
+ public static final String IMPORT_KEY_EXTRA_KEY_BYTES = "key_bytes"; // byte[]
+
+ public static final String IMPORT_KEY_FROM_KEYSERVER = "org.sufficientlysecure.keychain.action.IMPORT_KEY_FROM_KEYSERVER";
+ public static final String IMPORT_KEY_FROM_KEYSERVER_QUERY = "query"; // String
+ public static final String IMPORT_KEY_FROM_KEYSERVER_FINGERPRINT = "fingerprint"; // String
+
+ public static final String IMPORT_KEY_FROM_QR_CODE = "org.sufficientlysecure.keychain.action.IMPORT_KEY_FROM_QR_CODE";
+
+}
diff --git a/OpenKeychain-API/libraries/openpgp-api-library/.gitignore b/OpenKeychain-API/libraries/openpgp-api-library/.gitignore
new file mode 100644
index 000000000..aa8bb5760
--- /dev/null
+++ b/OpenKeychain-API/libraries/openpgp-api-library/.gitignore
@@ -0,0 +1,29 @@
+#Android specific
+bin
+gen
+obj
+lint.xml
+local.properties
+release.properties
+ant.properties
+*.class
+*.apk
+
+#Gradle
+.gradle
+build
+gradle.properties
+
+#Maven
+target
+pom.xml.*
+
+#Eclipse
+.project
+.classpath
+.settings
+.metadata
+
+#IntelliJ IDEA
+.idea
+*.iml
diff --git a/OpenKeychain-API/libraries/openpgp-api-library/AndroidManifest.xml b/OpenKeychain-API/libraries/openpgp-api-library/AndroidManifest.xml
new file mode 100644
index 000000000..98cb89faa
--- /dev/null
+++ b/OpenKeychain-API/libraries/openpgp-api-library/AndroidManifest.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="org.openintents.openpgp"
+ android:versionCode="1"
+ android:versionName="1.0" >
+
+ <uses-sdk
+ android:minSdkVersion="9"
+ android:targetSdkVersion="19" />
+
+ <application/>
+
+</manifest> \ No newline at end of file
diff --git a/OpenKeychain-API/libraries/openpgp-api-library/LICENSE b/OpenKeychain-API/libraries/openpgp-api-library/LICENSE
new file mode 100644
index 000000000..d64569567
--- /dev/null
+++ b/OpenKeychain-API/libraries/openpgp-api-library/LICENSE
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ 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.
diff --git a/OpenKeychain-API/libraries/openpgp-api-library/build.gradle b/OpenKeychain-API/libraries/openpgp-api-library/build.gradle
new file mode 100644
index 000000000..98c9a3bd6
--- /dev/null
+++ b/OpenKeychain-API/libraries/openpgp-api-library/build.gradle
@@ -0,0 +1,35 @@
+// please leave this here, so this library builds on its own
+buildscript {
+ repositories {
+ mavenCentral()
+ }
+
+ dependencies {
+ classpath 'com.android.tools.build:gradle:0.9.0'
+ }
+}
+
+apply plugin: 'android-library'
+
+android {
+ compileSdkVersion 19
+ buildToolsVersion '19.0.3'
+
+ // NOTE: We are using the old folder structure to also support Eclipse
+ sourceSets {
+ main {
+ manifest.srcFile 'AndroidManifest.xml'
+ java.srcDirs = ['src']
+ resources.srcDirs = ['src']
+ aidl.srcDirs = ['src']
+ renderscript.srcDirs = ['src']
+ res.srcDirs = ['res']
+ assets.srcDirs = ['assets']
+ }
+ }
+
+ // Do not abort build if lint finds errors
+ lintOptions {
+ abortOnError false
+ }
+}
diff --git a/OpenKeychain-API/libraries/openpgp-api-library/build.xml b/OpenKeychain-API/libraries/openpgp-api-library/build.xml
new file mode 100644
index 000000000..48ebf198c
--- /dev/null
+++ b/OpenKeychain-API/libraries/openpgp-api-library/build.xml
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="keychain-api-library" default="help">
+
+ <!-- The local.properties file is created and updated by the 'android' tool.
+ It contains the path to the SDK. It should *NOT* be checked into
+ Version Control Systems. -->
+ <property file="local.properties" />
+
+ <!-- The ant.properties file can be created by you. It is only edited by the
+ 'android' tool to add properties to it.
+ This is the place to change some Ant specific build properties.
+ Here are some properties you may want to change/update:
+
+ source.dir
+ The name of the source directory. Default is 'src'.
+ out.dir
+ The name of the output directory. Default is 'bin'.
+
+ For other overridable properties, look at the beginning of the rules
+ files in the SDK, at tools/ant/build.xml
+
+ Properties related to the SDK location or the project target should
+ be updated using the 'android' tool with the 'update' action.
+
+ This file is an integral part of the build system for your
+ application and should be checked into Version Control Systems.
+
+ -->
+ <property file="ant.properties" />
+
+ <!-- if sdk.dir was not set from one of the property file, then
+ get it from the ANDROID_HOME env var.
+ This must be done before we load project.properties since
+ the proguard config can use sdk.dir -->
+ <property environment="env" />
+ <condition property="sdk.dir" value="${env.ANDROID_HOME}">
+ <isset property="env.ANDROID_HOME" />
+ </condition>
+
+ <!-- The project.properties file is created and updated by the 'android'
+ tool, as well as ADT.
+
+ This contains project specific properties such as project target, and library
+ dependencies. Lower level build properties are stored in ant.properties
+ (or in .classpath for Eclipse projects).
+
+ This file is an integral part of the build system for your
+ application and should be checked into Version Control Systems. -->
+ <loadproperties srcFile="project.properties" />
+
+ <!-- quick check on sdk.dir -->
+ <fail
+ message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable."
+ unless="sdk.dir"
+ />
+
+ <!--
+ Import per project custom build rules if present at the root of the project.
+ This is the place to put custom intermediary targets such as:
+ -pre-build
+ -pre-compile
+ -post-compile (This is typically used for code obfuscation.
+ Compiled code location: ${out.classes.absolute.dir}
+ If this is not done in place, override ${out.dex.input.absolute.dir})
+ -post-package
+ -post-build
+ -pre-clean
+ -->
+ <import file="custom_rules.xml" optional="true" />
+
+ <!-- Import the actual build file.
+
+ To customize existing targets, there are two options:
+ - Customize only one target:
+ - copy/paste the target into this file, *before* the
+ <import> task.
+ - customize it to your needs.
+ - Customize the whole content of build.xml
+ - copy/paste the content of the rules files (minus the top node)
+ into this file, replacing the <import> task.
+ - customize to your needs.
+
+ ***********************
+ ****** IMPORTANT ******
+ ***********************
+ In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
+ in order to avoid having your file be overridden by tools such as "android update project"
+ -->
+ <!-- version-tag: 1 -->
+ <import file="${sdk.dir}/tools/ant/build.xml" />
+
+</project>
diff --git a/OpenKeychain-API/libraries/openpgp-api-library/proguard-project.txt b/OpenKeychain-API/libraries/openpgp-api-library/proguard-project.txt
new file mode 100644
index 000000000..f2fe1559a
--- /dev/null
+++ b/OpenKeychain-API/libraries/openpgp-api-library/proguard-project.txt
@@ -0,0 +1,20 @@
+# To enable ProGuard in your project, edit project.properties
+# to define the proguard.config property as described in that file.
+#
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in ${sdk.dir}/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the ProGuard
+# include property in project.properties.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
diff --git a/OpenKeychain-API/libraries/openpgp-api-library/project.properties b/OpenKeychain-API/libraries/openpgp-api-library/project.properties
new file mode 100644
index 000000000..91d2b0246
--- /dev/null
+++ b/OpenKeychain-API/libraries/openpgp-api-library/project.properties
@@ -0,0 +1,15 @@
+# This file is automatically generated by Android Tools.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+#
+# This file must be checked in Version Control Systems.
+#
+# To customize properties used by the Ant build system edit
+# "ant.properties", and override values to adapt the script to your
+# project structure.
+#
+# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
+#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
+
+# Project target.
+target=android-19
+android.library=true
diff --git a/OpenKeychain-API/libraries/openpgp-api-library/res/drawable-hdpi/ic_action_cancel_launchersize.png b/OpenKeychain-API/libraries/openpgp-api-library/res/drawable-hdpi/ic_action_cancel_launchersize.png
new file mode 100644
index 000000000..71b9118dc
--- /dev/null
+++ b/OpenKeychain-API/libraries/openpgp-api-library/res/drawable-hdpi/ic_action_cancel_launchersize.png
Binary files differ
diff --git a/OpenKeychain-API/libraries/openpgp-api-library/res/drawable-hdpi/ic_action_cancel_launchersize_light.png b/OpenKeychain-API/libraries/openpgp-api-library/res/drawable-hdpi/ic_action_cancel_launchersize_light.png
new file mode 100644
index 000000000..73b1d08f3
--- /dev/null
+++ b/OpenKeychain-API/libraries/openpgp-api-library/res/drawable-hdpi/ic_action_cancel_launchersize_light.png
Binary files differ
diff --git a/OpenKeychain-API/libraries/openpgp-api-library/res/drawable-mdpi/ic_action_cancel_launchersize.png b/OpenKeychain-API/libraries/openpgp-api-library/res/drawable-mdpi/ic_action_cancel_launchersize.png
new file mode 100644
index 000000000..270abf45f
--- /dev/null
+++ b/OpenKeychain-API/libraries/openpgp-api-library/res/drawable-mdpi/ic_action_cancel_launchersize.png
Binary files differ
diff --git a/OpenKeychain-API/libraries/openpgp-api-library/res/drawable-mdpi/ic_action_cancel_launchersize_light.png b/OpenKeychain-API/libraries/openpgp-api-library/res/drawable-mdpi/ic_action_cancel_launchersize_light.png
new file mode 100644
index 000000000..d841821c8
--- /dev/null
+++ b/OpenKeychain-API/libraries/openpgp-api-library/res/drawable-mdpi/ic_action_cancel_launchersize_light.png
Binary files differ
diff --git a/OpenKeychain-API/libraries/openpgp-api-library/res/drawable-xhdpi/ic_action_cancel_launchersize.png b/OpenKeychain-API/libraries/openpgp-api-library/res/drawable-xhdpi/ic_action_cancel_launchersize.png
new file mode 100644
index 000000000..1e3571fa5
--- /dev/null
+++ b/OpenKeychain-API/libraries/openpgp-api-library/res/drawable-xhdpi/ic_action_cancel_launchersize.png
Binary files differ
diff --git a/OpenKeychain-API/libraries/openpgp-api-library/res/drawable-xhdpi/ic_action_cancel_launchersize_light.png b/OpenKeychain-API/libraries/openpgp-api-library/res/drawable-xhdpi/ic_action_cancel_launchersize_light.png
new file mode 100644
index 000000000..d505046b4
--- /dev/null
+++ b/OpenKeychain-API/libraries/openpgp-api-library/res/drawable-xhdpi/ic_action_cancel_launchersize_light.png
Binary files differ
diff --git a/OpenKeychain-API/libraries/openpgp-api-library/res/drawable-xxhdpi/ic_action_cancel_launchersize.png b/OpenKeychain-API/libraries/openpgp-api-library/res/drawable-xxhdpi/ic_action_cancel_launchersize.png
new file mode 100644
index 000000000..52044601e
--- /dev/null
+++ b/OpenKeychain-API/libraries/openpgp-api-library/res/drawable-xxhdpi/ic_action_cancel_launchersize.png
Binary files differ
diff --git a/OpenKeychain-API/libraries/openpgp-api-library/res/drawable-xxhdpi/ic_action_cancel_launchersize_light.png b/OpenKeychain-API/libraries/openpgp-api-library/res/drawable-xxhdpi/ic_action_cancel_launchersize_light.png
new file mode 100644
index 000000000..d6fb86bdd
--- /dev/null
+++ b/OpenKeychain-API/libraries/openpgp-api-library/res/drawable-xxhdpi/ic_action_cancel_launchersize_light.png
Binary files differ
diff --git a/OpenKeychain-API/libraries/openpgp-api-library/res/values/strings.xml b/OpenKeychain-API/libraries/openpgp-api-library/res/values/strings.xml
new file mode 100644
index 000000000..0119831cc
--- /dev/null
+++ b/OpenKeychain-API/libraries/openpgp-api-library/res/values/strings.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+
+ <string name="openpgp_list_preference_none">None</string>
+ <string name="openpgp_install_openkeychain_via">Install OpenKeychain via %s</string>
+
+</resources> \ No newline at end of file
diff --git a/OpenKeychain-API/libraries/openpgp-api-library/src/org/openintents/openpgp/IOpenPgpService.aidl b/OpenKeychain-API/libraries/openpgp-api-library/src/org/openintents/openpgp/IOpenPgpService.aidl
new file mode 100644
index 000000000..7ee79d6ab
--- /dev/null
+++ b/OpenKeychain-API/libraries/openpgp-api-library/src/org/openintents/openpgp/IOpenPgpService.aidl
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2014 Dominik Schürmann <dominik@dominikschuermann.de>
+ *
+ * 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.openintents.openpgp;
+
+interface IOpenPgpService {
+
+ // see OpenPgpApi for documentation
+ Intent execute(in Intent data, in ParcelFileDescriptor input, in ParcelFileDescriptor output);
+
+} \ No newline at end of file
diff --git a/OpenKeychain-API/libraries/openpgp-api-library/src/org/openintents/openpgp/OpenPgpError.java b/OpenKeychain-API/libraries/openpgp-api-library/src/org/openintents/openpgp/OpenPgpError.java
new file mode 100644
index 000000000..b894a4609
--- /dev/null
+++ b/OpenKeychain-API/libraries/openpgp-api-library/src/org/openintents/openpgp/OpenPgpError.java
@@ -0,0 +1,118 @@
+/*
+ * Copyright (C) 2014 Dominik Schürmann <dominik@dominikschuermann.de>
+ *
+ * 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.openintents.openpgp;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+/**
+ * Parcelable versioning has been copied from Dashclock Widget
+ * https://code.google.com/p/dashclock/source/browse/api/src/main/java/com/google/android/apps/dashclock/api/ExtensionData.java
+ */
+public class OpenPgpError implements Parcelable {
+ /**
+ * Since there might be a case where new versions of the client using the library getting
+ * old versions of the protocol (and thus old versions of this class), we need a versioning
+ * system for the parcels sent between the clients and the providers.
+ */
+ public static final int PARCELABLE_VERSION = 1;
+
+ // possible values for errorId
+ public static final int CLIENT_SIDE_ERROR = -1;
+ public static final int GENERIC_ERROR = 0;
+ public static final int INCOMPATIBLE_API_VERSIONS = 1;
+ public static final int NO_OR_WRONG_PASSPHRASE = 2;
+ public static final int NO_USER_IDS = 3;
+
+ int errorId;
+ String message;
+
+ public OpenPgpError() {
+ }
+
+ public OpenPgpError(int errorId, String message) {
+ this.errorId = errorId;
+ this.message = message;
+ }
+
+ public OpenPgpError(OpenPgpError b) {
+ this.errorId = b.errorId;
+ this.message = b.message;
+ }
+
+ public int getErrorId() {
+ return errorId;
+ }
+
+ public void setErrorId(int errorId) {
+ this.errorId = errorId;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public int describeContents() {
+ return 0;
+ }
+
+ public void writeToParcel(Parcel dest, int flags) {
+ /**
+ * NOTE: When adding fields in the process of updating this API, make sure to bump
+ * {@link #PARCELABLE_VERSION}.
+ */
+ dest.writeInt(PARCELABLE_VERSION);
+ // Inject a placeholder that will store the parcel size from this point on
+ // (not including the size itself).
+ int sizePosition = dest.dataPosition();
+ dest.writeInt(0);
+ int startPosition = dest.dataPosition();
+ // version 1
+ dest.writeInt(errorId);
+ dest.writeString(message);
+ // Go back and write the size
+ int parcelableSize = dest.dataPosition() - startPosition;
+ dest.setDataPosition(sizePosition);
+ dest.writeInt(parcelableSize);
+ dest.setDataPosition(startPosition + parcelableSize);
+ }
+
+ public static final Creator<OpenPgpError> CREATOR = new Creator<OpenPgpError>() {
+ public OpenPgpError createFromParcel(final Parcel source) {
+ int parcelableVersion = source.readInt();
+ int parcelableSize = source.readInt();
+ int startPosition = source.dataPosition();
+
+ OpenPgpError error = new OpenPgpError();
+ error.errorId = source.readInt();
+ error.message = source.readString();
+
+ // skip over all fields added in future versions of this parcel
+ source.setDataPosition(startPosition + parcelableSize);
+
+ return error;
+ }
+
+ public OpenPgpError[] newArray(final int size) {
+ return new OpenPgpError[size];
+ }
+ };
+}
diff --git a/OpenKeychain-API/libraries/openpgp-api-library/src/org/openintents/openpgp/OpenPgpSignatureResult.java b/OpenKeychain-API/libraries/openpgp-api-library/src/org/openintents/openpgp/OpenPgpSignatureResult.java
new file mode 100644
index 000000000..157dd1aad
--- /dev/null
+++ b/OpenKeychain-API/libraries/openpgp-api-library/src/org/openintents/openpgp/OpenPgpSignatureResult.java
@@ -0,0 +1,159 @@
+/*
+ * Copyright (C) 2014 Dominik Schürmann <dominik@dominikschuermann.de>
+ *
+ * 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.openintents.openpgp;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+/**
+ * Parcelable versioning has been copied from Dashclock Widget
+ * https://code.google.com/p/dashclock/source/browse/api/src/main/java/com/google/android/apps/dashclock/api/ExtensionData.java
+ */
+public class OpenPgpSignatureResult implements Parcelable {
+ /**
+ * Since there might be a case where new versions of the client using the library getting
+ * old versions of the protocol (and thus old versions of this class), we need a versioning
+ * system for the parcels sent between the clients and the providers.
+ */
+ public static final int PARCELABLE_VERSION = 1;
+
+ // generic error on signature verification
+ public static final int SIGNATURE_ERROR = 0;
+ // successfully verified signature, with certified public key
+ public static final int SIGNATURE_SUCCESS_CERTIFIED = 1;
+ // no public key was found for this signature verification
+ public static final int SIGNATURE_UNKNOWN_PUB_KEY = 2;
+ // successfully verified signature, but with uncertified public key
+ public static final int SIGNATURE_SUCCESS_UNCERTIFIED = 3;
+
+ int status;
+ boolean signatureOnly;
+ String userId;
+ long keyId;
+
+ public int getStatus() {
+ return status;
+ }
+
+ public void setStatus(int status) {
+ this.status = status;
+ }
+
+ public boolean isSignatureOnly() {
+ return signatureOnly;
+ }
+
+ public void setSignatureOnly(boolean signatureOnly) {
+ this.signatureOnly = signatureOnly;
+ }
+
+ public String getUserId() {
+ return userId;
+ }
+
+ public void setUserId(String userId) {
+ this.userId = userId;
+ }
+
+ public long getKeyId() {
+ return keyId;
+ }
+
+ public void setKeyId(long keyId) {
+ this.keyId = keyId;
+ }
+
+ public OpenPgpSignatureResult() {
+
+ }
+
+ public OpenPgpSignatureResult(int signatureStatus, String signatureUserId,
+ boolean signatureOnly, long keyId) {
+ this.status = signatureStatus;
+ this.signatureOnly = signatureOnly;
+ this.userId = signatureUserId;
+ this.keyId = keyId;
+ }
+
+ public OpenPgpSignatureResult(OpenPgpSignatureResult b) {
+ this.status = b.status;
+ this.userId = b.userId;
+ this.signatureOnly = b.signatureOnly;
+ this.keyId = b.keyId;
+ }
+
+ public int describeContents() {
+ return 0;
+ }
+
+ public void writeToParcel(Parcel dest, int flags) {
+ /**
+ * NOTE: When adding fields in the process of updating this API, make sure to bump
+ * {@link #PARCELABLE_VERSION}.
+ */
+ dest.writeInt(PARCELABLE_VERSION);
+ // Inject a placeholder that will store the parcel size from this point on
+ // (not including the size itself).
+ int sizePosition = dest.dataPosition();
+ dest.writeInt(0);
+ int startPosition = dest.dataPosition();
+ // version 1
+ dest.writeInt(status);
+ dest.writeByte((byte) (signatureOnly ? 1 : 0));
+ dest.writeString(userId);
+ dest.writeLong(keyId);
+ // Go back and write the size
+ int parcelableSize = dest.dataPosition() - startPosition;
+ dest.setDataPosition(sizePosition);
+ dest.writeInt(parcelableSize);
+ dest.setDataPosition(startPosition + parcelableSize);
+ }
+
+ public static final Creator<OpenPgpSignatureResult> CREATOR = new Creator<OpenPgpSignatureResult>() {
+ public OpenPgpSignatureResult createFromParcel(final Parcel source) {
+ int parcelableVersion = source.readInt();
+ int parcelableSize = source.readInt();
+ int startPosition = source.dataPosition();
+
+ OpenPgpSignatureResult vr = new OpenPgpSignatureResult();
+ vr.status = source.readInt();
+ vr.signatureOnly = source.readByte() == 1;
+ vr.userId = source.readString();
+ vr.keyId = source.readLong();
+
+ // skip over all fields added in future versions of this parcel
+ source.setDataPosition(startPosition + parcelableSize);
+
+ return vr;
+ }
+
+ public OpenPgpSignatureResult[] newArray(final int size) {
+ return new OpenPgpSignatureResult[size];
+ }
+ };
+
+ @Override
+ public String toString() {
+ String out = new String();
+ out += "\nstatus: " + status;
+ out += "\nuserId: " + userId;
+ out += "\nsignatureOnly: " + signatureOnly;
+ out += "\nkeyId: " + keyId;
+ return out;
+ }
+
+}
diff --git a/OpenKeychain-API/libraries/openpgp-api-library/src/org/openintents/openpgp/util/OpenPgpApi.java b/OpenKeychain-API/libraries/openpgp-api-library/src/org/openintents/openpgp/util/OpenPgpApi.java
new file mode 100644
index 000000000..465a12002
--- /dev/null
+++ b/OpenKeychain-API/libraries/openpgp-api-library/src/org/openintents/openpgp/util/OpenPgpApi.java
@@ -0,0 +1,261 @@
+/*
+ * Copyright (C) 2014 Dominik Schürmann <dominik@dominikschuermann.de>
+ *
+ * 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.openintents.openpgp.util;
+
+import android.annotation.TargetApi;
+import android.content.Context;
+import android.content.Intent;
+import android.os.AsyncTask;
+import android.os.Build;
+import android.os.ParcelFileDescriptor;
+import android.util.Log;
+import org.openintents.openpgp.IOpenPgpService;
+import org.openintents.openpgp.OpenPgpError;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+public class OpenPgpApi {
+
+ public static final String TAG = "OpenPgp API";
+
+ public static final int API_VERSION = 3;
+ public static final String SERVICE_INTENT = "org.openintents.openpgp.IOpenPgpService";
+
+ /**
+ * General extras
+ * --------------
+ *
+ * required extras:
+ * int EXTRA_API_VERSION (always required)
+ *
+ * returned extras:
+ * int RESULT_CODE (RESULT_CODE_ERROR, RESULT_CODE_SUCCESS or RESULT_CODE_USER_INTERACTION_REQUIRED)
+ * OpenPgpError RESULT_ERROR (if RESULT_CODE == RESULT_CODE_ERROR)
+ * PendingIntent RESULT_INTENT (if RESULT_CODE == RESULT_CODE_USER_INTERACTION_REQUIRED)
+ */
+
+ /**
+ * Sign only
+ *
+ * optional extras:
+ * boolean EXTRA_REQUEST_ASCII_ARMOR (request ascii armor for ouput)
+ * String EXTRA_PASSPHRASE (key passphrase)
+ */
+ public static final String ACTION_SIGN = "org.openintents.openpgp.action.SIGN";
+
+ /**
+ * Encrypt
+ *
+ * required extras:
+ * String[] EXTRA_USER_IDS (=emails of recipients, if more than one key has a user_id, a PendingIntent is returned via RESULT_INTENT)
+ * or
+ * long[] EXTRA_KEY_IDS
+ *
+ * optional extras:
+ * boolean EXTRA_REQUEST_ASCII_ARMOR (request ascii armor for ouput)
+ * String EXTRA_PASSPHRASE (key passphrase)
+ */
+ public static final String ACTION_ENCRYPT = "org.openintents.openpgp.action.ENCRYPT";
+
+ /**
+ * Sign and encrypt
+ *
+ * required extras:
+ * String[] EXTRA_USER_IDS (=emails of recipients, if more than one key has a user_id, a PendingIntent is returned via RESULT_INTENT)
+ * or
+ * long[] EXTRA_KEY_IDS
+ *
+ * optional extras:
+ * boolean EXTRA_REQUEST_ASCII_ARMOR (request ascii armor for ouput)
+ * String EXTRA_PASSPHRASE (key passphrase)
+ */
+ public static final String ACTION_SIGN_AND_ENCRYPT = "org.openintents.openpgp.action.SIGN_AND_ENCRYPT";
+
+ /**
+ * Decrypts and verifies given input stream. This methods handles encrypted-only, signed-and-encrypted,
+ * and also signed-only input.
+ *
+ * If OpenPgpSignatureResult.getStatus() == OpenPgpSignatureResult.SIGNATURE_UNKNOWN_PUB_KEY
+ * in addition a PendingIntent is returned via RESULT_INTENT to download missing keys.
+ *
+ * optional extras:
+ * boolean EXTRA_REQUEST_ASCII_ARMOR (request ascii armor for ouput)
+ *
+ * returned extras:
+ * OpenPgpSignatureResult RESULT_SIGNATURE
+ */
+ public static final String ACTION_DECRYPT_VERIFY = "org.openintents.openpgp.action.DECRYPT_VERIFY";
+
+ /**
+ * Get key ids based on given user ids (=emails)
+ *
+ * required extras:
+ * String[] EXTRA_USER_IDS
+ *
+ * returned extras:
+ * long[] EXTRA_KEY_IDS
+ */
+ public static final String ACTION_GET_KEY_IDS = "org.openintents.openpgp.action.GET_KEY_IDS";
+
+ /**
+ * This action returns RESULT_CODE_SUCCESS if the OpenPGP Provider already has the key
+ * corresponding to the given key id in its database.
+ *
+ * It returns RESULT_CODE_USER_INTERACTION_REQUIRED if the Provider does not have the key.
+ * The PendingIntent from RESULT_INTENT can be used to retrieve those from a keyserver.
+ *
+ * required extras:
+ * long EXTRA_KEY_ID
+ */
+ public static final String ACTION_GET_KEY = "org.openintents.openpgp.action.GET_KEY";
+
+ /* Intent extras */
+ public static final String EXTRA_API_VERSION = "api_version";
+
+ public static final String EXTRA_ACCOUNT_NAME = "account_name";
+
+ // SIGN, ENCRYPT, SIGN_AND_ENCRYPT, DECRYPT_VERIFY
+ // request ASCII Armor for output
+ // OpenPGP Radix-64, 33 percent overhead compared to binary, see http://tools.ietf.org/html/rfc4880#page-53)
+ public static final String EXTRA_REQUEST_ASCII_ARMOR = "ascii_armor";
+
+ // ENCRYPT, SIGN_AND_ENCRYPT
+ public static final String EXTRA_USER_IDS = "user_ids";
+ public static final String EXTRA_KEY_IDS = "key_ids";
+ // optional extras:
+ public static final String EXTRA_PASSPHRASE = "passphrase";
+
+ // GET_KEY
+ public static final String EXTRA_KEY_ID = "key_id";
+
+ /* Service Intent returns */
+ public static final String RESULT_CODE = "result_code";
+
+ // get actual error object from RESULT_ERROR
+ public static final int RESULT_CODE_ERROR = 0;
+ // success!
+ public static final int RESULT_CODE_SUCCESS = 1;
+ // get PendingIntent from RESULT_INTENT, start PendingIntent with startIntentSenderForResult,
+ // and execute service method again in onActivityResult
+ public static final int RESULT_CODE_USER_INTERACTION_REQUIRED = 2;
+
+ public static final String RESULT_ERROR = "error";
+ public static final String RESULT_INTENT = "intent";
+
+ // DECRYPT_VERIFY
+ public static final String RESULT_SIGNATURE = "signature";
+
+ IOpenPgpService mService;
+ Context mContext;
+
+ public OpenPgpApi(Context context, IOpenPgpService service) {
+ this.mContext = context;
+ this.mService = service;
+ }
+
+ public interface IOpenPgpCallback {
+ void onReturn(final Intent result);
+ }
+
+ private class OpenPgpAsyncTask extends AsyncTask<Void, Integer, Intent> {
+ Intent data;
+ InputStream is;
+ OutputStream os;
+ IOpenPgpCallback callback;
+
+ private OpenPgpAsyncTask(Intent data, InputStream is, OutputStream os, IOpenPgpCallback callback) {
+ this.data = data;
+ this.is = is;
+ this.os = os;
+ this.callback = callback;
+ }
+
+ @Override
+ protected Intent doInBackground(Void... unused) {
+ return executeApi(data, is, os);
+ }
+
+ protected void onPostExecute(Intent result) {
+ callback.onReturn(result);
+ }
+
+ }
+
+ @TargetApi(Build.VERSION_CODES.HONEYCOMB)
+ public void executeApiAsync(Intent data, InputStream is, OutputStream os, IOpenPgpCallback callback) {
+ OpenPgpAsyncTask task = new OpenPgpAsyncTask(data, is, os, callback);
+
+ // don't serialize async tasks!
+ // http://commonsware.com/blog/2012/04/20/asynctask-threading-regression-confirmed.html
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
+ task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, (Void[]) null);
+ } else {
+ task.execute((Void[]) null);
+ }
+ }
+
+ public Intent executeApi(Intent data, InputStream is, OutputStream os) {
+ try {
+ data.putExtra(EXTRA_API_VERSION, OpenPgpApi.API_VERSION);
+
+ Intent result = null;
+
+ if (ACTION_GET_KEY_IDS.equals(data.getAction())) {
+ result = mService.execute(data, null, null);
+ return result;
+ } else {
+ // pipe the input and output
+ ParcelFileDescriptor input = ParcelFileDescriptorUtil.pipeFrom(is,
+ new ParcelFileDescriptorUtil.IThreadListener() {
+
+ @Override
+ public void onThreadFinished(Thread thread) {
+ //Log.d(OpenPgpApi.TAG, "Copy to service finished");
+ }
+ });
+ ParcelFileDescriptor output = ParcelFileDescriptorUtil.pipeTo(os,
+ new ParcelFileDescriptorUtil.IThreadListener() {
+
+ @Override
+ public void onThreadFinished(Thread thread) {
+ //Log.d(OpenPgpApi.TAG, "Service finished writing!");
+ }
+ });
+
+ // blocks until result is ready
+ result = mService.execute(data, input, output);
+ // close() is required to halt the TransferThread
+ output.close();
+
+ // set class loader to current context to allow unparcelling
+ // of OpenPgpError and OpenPgpSignatureResult
+ // http://stackoverflow.com/a/3806769
+ result.setExtrasClassLoader(mContext.getClassLoader());
+
+ return result;
+ }
+ } catch (Exception e) {
+ Log.e(OpenPgpApi.TAG, "Exception", e);
+ Intent result = new Intent();
+ result.putExtra(RESULT_CODE, RESULT_CODE_ERROR);
+ result.putExtra(RESULT_ERROR,
+ new OpenPgpError(OpenPgpError.CLIENT_SIDE_ERROR, e.getMessage()));
+ return result;
+ }
+ }
+
+}
diff --git a/OpenKeychain-API/libraries/openpgp-api-library/src/org/openintents/openpgp/util/OpenPgpListPreference.java b/OpenKeychain-API/libraries/openpgp-api-library/src/org/openintents/openpgp/util/OpenPgpListPreference.java
new file mode 100644
index 000000000..cf5864620
--- /dev/null
+++ b/OpenKeychain-API/libraries/openpgp-api-library/src/org/openintents/openpgp/util/OpenPgpListPreference.java
@@ -0,0 +1,257 @@
+/*
+ * Copyright (C) 2014 Dominik Schürmann <dominik@dominikschuermann.de>
+ *
+ * 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.openintents.openpgp.util;
+
+import android.app.AlertDialog.Builder;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.pm.ResolveInfo;
+import android.content.res.TypedArray;
+import android.graphics.drawable.Drawable;
+import android.net.Uri;
+import android.preference.DialogPreference;
+import android.util.AttributeSet;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ArrayAdapter;
+import android.widget.ListAdapter;
+import android.widget.TextView;
+import org.openintents.openpgp.R;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Does not extend ListPreference, but is very similar to it!
+ * http://grepcode.com/file_/repository.grepcode.com/java/ext/com.google.android/android/4.4_r1/android/preference/ListPreference.java/?v=source
+ */
+public class OpenPgpListPreference extends DialogPreference {
+ private static final String OPENKEYCHAIN_PACKAGE = "org.sufficientlysecure.keychain";
+ private static final String MARKET_INTENT_URI_BASE = "market://details?id=%s";
+ private static final Intent MARKET_INTENT = new Intent(Intent.ACTION_VIEW, Uri.parse(
+ String.format(MARKET_INTENT_URI_BASE, OPENKEYCHAIN_PACKAGE)));
+
+ private ArrayList<OpenPgpProviderEntry> mLegacyList = new ArrayList<OpenPgpProviderEntry>();
+ private ArrayList<OpenPgpProviderEntry> mList = new ArrayList<OpenPgpProviderEntry>();
+
+ private String mSelectedPackage;
+
+ public OpenPgpListPreference(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ public OpenPgpListPreference(Context context) {
+ this(context, null);
+ }
+
+ /**
+ * Public method to add new entries for legacy applications
+ *
+ * @param packageName
+ * @param simpleName
+ * @param icon
+ */
+ public void addLegacyProvider(int position, String packageName, String simpleName, Drawable icon) {
+ mLegacyList.add(position, new OpenPgpProviderEntry(packageName, simpleName, icon));
+ }
+
+ @Override
+ protected void onPrepareDialogBuilder(Builder builder) {
+ mList.clear();
+
+ // add "none"-entry
+ mList.add(0, new OpenPgpProviderEntry("",
+ getContext().getString(R.string.openpgp_list_preference_none),
+ getContext().getResources().getDrawable(R.drawable.ic_action_cancel_launchersize)));
+
+ // add all additional (legacy) providers
+ mList.addAll(mLegacyList);
+
+ // search for OpenPGP providers...
+ ArrayList<OpenPgpProviderEntry> providerList = new ArrayList<OpenPgpProviderEntry>();
+ Intent intent = new Intent(OpenPgpApi.SERVICE_INTENT);
+ List<ResolveInfo> resInfo = getContext().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(getContext()
+ .getPackageManager()));
+ Drawable icon = resolveInfo.serviceInfo.loadIcon(getContext().getPackageManager());
+
+ providerList.add(new OpenPgpProviderEntry(packageName, simpleName, icon));
+ }
+ }
+
+ if (providerList.isEmpty()) {
+ // add install links if provider list is empty
+ resInfo = getContext().getPackageManager().queryIntentActivities
+ (MARKET_INTENT, 0);
+ for (ResolveInfo resolveInfo : resInfo) {
+ Intent marketIntent = new Intent(MARKET_INTENT);
+ marketIntent.setPackage(resolveInfo.activityInfo.packageName);
+ Drawable icon = resolveInfo.activityInfo.loadIcon(getContext().getPackageManager());
+ String marketName = String.valueOf(resolveInfo.activityInfo.applicationInfo
+ .loadLabel(getContext().getPackageManager()));
+ String simpleName = String.format(getContext().getString(R.string
+ .openpgp_install_openkeychain_via), marketName);
+ mList.add(new OpenPgpProviderEntry(OPENKEYCHAIN_PACKAGE, simpleName,
+ icon, marketIntent));
+ }
+ } else {
+ // add provider
+ mList.addAll(providerList);
+ }
+
+ // Init ArrayAdapter with OpenPGP Providers
+ ListAdapter adapter = new ArrayAdapter<OpenPgpProviderEntry>(getContext(),
+ android.R.layout.select_dialog_singlechoice, android.R.id.text1, mList) {
+ 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(mList.get(position).icon, null,
+ null, null);
+
+ // Add margin between image and text (support various screen densities)
+ int dp10 = (int) (10 * getContext().getResources().getDisplayMetrics().density + 0.5f);
+ tv.setCompoundDrawablePadding(dp10);
+
+ return v;
+ }
+ };
+
+ builder.setSingleChoiceItems(adapter, getIndexOfProviderList(getValue()),
+ new DialogInterface.OnClickListener() {
+
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ OpenPgpProviderEntry entry = mList.get(which);
+
+ if (entry.intent != null) {
+ /*
+ * Intents are called as activity
+ *
+ * Current approach is to assume the user installed the app.
+ * If he does not, the selected package is not valid.
+ *
+ * However applications should always consider this could happen,
+ * as the user might remove the currently used OpenPGP app.
+ */
+ getContext().startActivity(entry.intent);
+ }
+
+ mSelectedPackage = entry.packageName;
+
+ /*
+ * Clicking on an item simulates the positive button click, and dismisses
+ * the dialog.
+ */
+ OpenPgpListPreference.this.onClick(dialog, DialogInterface.BUTTON_POSITIVE);
+ dialog.dismiss();
+ }
+ });
+
+ /*
+ * The typical interaction for list-based dialogs is to have click-on-an-item dismiss the
+ * dialog instead of the user having to press 'Ok'.
+ */
+ builder.setPositiveButton(null, null);
+ }
+
+ @Override
+ protected void onDialogClosed(boolean positiveResult) {
+ super.onDialogClosed(positiveResult);
+
+ if (positiveResult && (mSelectedPackage != null)) {
+ if (callChangeListener(mSelectedPackage)) {
+ setValue(mSelectedPackage);
+ }
+ }
+ }
+
+ private int getIndexOfProviderList(String packageName) {
+ for (OpenPgpProviderEntry app : mList) {
+ if (app.packageName.equals(packageName)) {
+ return mList.indexOf(app);
+ }
+ }
+
+ return -1;
+ }
+
+ public void setValue(String packageName) {
+ mSelectedPackage = packageName;
+ persistString(packageName);
+ }
+
+ public String getValue() {
+ return mSelectedPackage;
+ }
+
+ public String getEntry() {
+ return getEntryByValue(mSelectedPackage);
+ }
+
+ @Override
+ protected Object onGetDefaultValue(TypedArray a, int index) {
+ return a.getString(index);
+ }
+
+ @Override
+ protected void onSetInitialValue(boolean restoreValue, Object defaultValue) {
+ setValue(restoreValue ? getPersistedString(mSelectedPackage) : (String) defaultValue);
+ }
+
+ public String getEntryByValue(String packageName) {
+ for (OpenPgpProviderEntry app : mList) {
+ if (app.packageName.equals(packageName)) {
+ return app.simpleName;
+ }
+ }
+
+ return null;
+ }
+
+ private static class OpenPgpProviderEntry {
+ private String packageName;
+ private String simpleName;
+ private Drawable icon;
+ private Intent intent;
+
+ public OpenPgpProviderEntry(String packageName, String simpleName, Drawable icon) {
+ this.packageName = packageName;
+ this.simpleName = simpleName;
+ this.icon = icon;
+ }
+
+ public OpenPgpProviderEntry(String packageName, String simpleName, Drawable icon, Intent intent) {
+ this(packageName, simpleName, icon);
+ this.intent = intent;
+ }
+
+ @Override
+ public String toString() {
+ return simpleName;
+ }
+ }
+}
diff --git a/OpenKeychain-API/libraries/openpgp-api-library/src/org/openintents/openpgp/util/OpenPgpServiceConnection.java b/OpenKeychain-API/libraries/openpgp-api-library/src/org/openintents/openpgp/util/OpenPgpServiceConnection.java
new file mode 100644
index 000000000..0395a7bc5
--- /dev/null
+++ b/OpenKeychain-API/libraries/openpgp-api-library/src/org/openintents/openpgp/util/OpenPgpServiceConnection.java
@@ -0,0 +1,118 @@
+/*
+ * Copyright (C) 2014 Dominik Schürmann <dominik@dominikschuermann.de>
+ *
+ * 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.openintents.openpgp.util;
+
+import org.openintents.openpgp.IOpenPgpService;
+
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.content.ServiceConnection;
+import android.os.IBinder;
+
+public class OpenPgpServiceConnection {
+
+ // interface to create callbacks for onServiceConnected
+ public interface OnBound {
+ public void onBound(IOpenPgpService service);
+ }
+
+ private Context mApplicationContext;
+
+ private IOpenPgpService mService;
+ private String mProviderPackageName;
+
+ private OnBound mOnBoundListener;
+
+ /**
+ * Create new OpenPgpServiceConnection
+ *
+ * @param context
+ * @param providerPackageName specify package name of OpenPGP provider,
+ * e.g., "org.sufficientlysecure.keychain"
+ */
+ public OpenPgpServiceConnection(Context context, String providerPackageName) {
+ this.mApplicationContext = context.getApplicationContext();
+ this.mProviderPackageName = providerPackageName;
+ }
+
+ /**
+ * Create new OpenPgpServiceConnection
+ *
+ * @param context
+ * @param providerPackageName specify package name of OpenPGP provider,
+ * e.g., "org.sufficientlysecure.keychain"
+ * @param onBoundListener callback, executed when connection to service has been established
+ */
+ public OpenPgpServiceConnection(Context context, String providerPackageName,
+ OnBound onBoundListener) {
+ this.mApplicationContext = context.getApplicationContext();
+ this.mProviderPackageName = providerPackageName;
+ this.mOnBoundListener = onBoundListener;
+ }
+
+ public IOpenPgpService getService() {
+ return mService;
+ }
+
+ public boolean isBound() {
+ return (mService != null);
+ }
+
+ private ServiceConnection mServiceConnection = new ServiceConnection() {
+ public void onServiceConnected(ComponentName name, IBinder service) {
+ mService = IOpenPgpService.Stub.asInterface(service);
+ if (mOnBoundListener != null) {
+ mOnBoundListener.onBound(mService);
+ }
+ }
+
+ public void onServiceDisconnected(ComponentName name) {
+ mService = null;
+ }
+ };
+
+ /**
+ * If not already bound, bind to service!
+ *
+ * @return
+ */
+ public boolean bindToService() {
+ // if not already bound...
+ if (mService == null) {
+ try {
+ Intent serviceIntent = new Intent();
+ serviceIntent.setAction(IOpenPgpService.class.getName());
+ // NOTE: setPackage is very important to restrict the intent to this provider only!
+ serviceIntent.setPackage(mProviderPackageName);
+ mApplicationContext.bindService(serviceIntent, mServiceConnection,
+ Context.BIND_AUTO_CREATE);
+
+ return true;
+ } catch (Exception e) {
+ return false;
+ }
+ } else {
+ return true;
+ }
+ }
+
+ public void unbindFromService() {
+ mApplicationContext.unbindService(mServiceConnection);
+ }
+
+}
diff --git a/OpenKeychain-API/libraries/openpgp-api-library/src/org/openintents/openpgp/util/OpenPgpUtils.java b/OpenKeychain-API/libraries/openpgp-api-library/src/org/openintents/openpgp/util/OpenPgpUtils.java
new file mode 100644
index 000000000..67fe86291
--- /dev/null
+++ b/OpenKeychain-API/libraries/openpgp-api-library/src/org/openintents/openpgp/util/OpenPgpUtils.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2014 Dominik Schürmann <dominik@dominikschuermann.de>
+ *
+ * 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.openintents.openpgp.util;
+
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.ResolveInfo;
+
+public class OpenPgpUtils {
+
+ public static final Pattern PGP_MESSAGE = Pattern.compile(
+ ".*?(-----BEGIN PGP MESSAGE-----.*?-----END PGP MESSAGE-----).*",
+ Pattern.DOTALL);
+
+ public static final Pattern PGP_SIGNED_MESSAGE = Pattern.compile(
+ ".*?(-----BEGIN PGP SIGNED MESSAGE-----.*?-----BEGIN PGP SIGNATURE-----.*?-----END PGP SIGNATURE-----).*",
+ Pattern.DOTALL);
+
+ public static final int PARSE_RESULT_NO_PGP = -1;
+ public static final int PARSE_RESULT_MESSAGE = 0;
+ public static final int PARSE_RESULT_SIGNED_MESSAGE = 1;
+
+ public static int parseMessage(String message) {
+ Matcher matcherSigned = PGP_SIGNED_MESSAGE.matcher(message);
+ Matcher matcherMessage = PGP_MESSAGE.matcher(message);
+
+ if (matcherMessage.matches()) {
+ return PARSE_RESULT_MESSAGE;
+ } else if (matcherSigned.matches()) {
+ return PARSE_RESULT_SIGNED_MESSAGE;
+ } else {
+ return PARSE_RESULT_NO_PGP;
+ }
+ }
+
+ public static boolean isAvailable(Context context) {
+ Intent intent = new Intent(OpenPgpApi.SERVICE_INTENT);
+ List<ResolveInfo> resInfo = context.getPackageManager().queryIntentServices(intent, 0);
+ if (!resInfo.isEmpty()) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+}
diff --git a/OpenKeychain-API/libraries/openpgp-api-library/src/org/openintents/openpgp/util/ParcelFileDescriptorUtil.java b/OpenKeychain-API/libraries/openpgp-api-library/src/org/openintents/openpgp/util/ParcelFileDescriptorUtil.java
new file mode 100644
index 000000000..58c62110d
--- /dev/null
+++ b/OpenKeychain-API/libraries/openpgp-api-library/src/org/openintents/openpgp/util/ParcelFileDescriptorUtil.java
@@ -0,0 +1,103 @@
+/*
+ * Copyright (C) 2014 Dominik Schürmann <dominik@dominikschuermann.de>
+ * 2013 Flow (http://stackoverflow.com/questions/18212152/transfer-inputstream-to-another-service-across-process-boundaries-with-parcelf)
+ *
+ * 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.openintents.openpgp.util;
+
+import android.os.ParcelFileDescriptor;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+public class ParcelFileDescriptorUtil {
+
+ public interface IThreadListener {
+ void onThreadFinished(final Thread thread);
+ }
+
+ public static ParcelFileDescriptor pipeFrom(InputStream inputStream, IThreadListener listener)
+ throws IOException {
+ ParcelFileDescriptor[] pipe = ParcelFileDescriptor.createPipe();
+ ParcelFileDescriptor readSide = pipe[0];
+ ParcelFileDescriptor writeSide = pipe[1];
+
+ // start the transfer thread
+ new TransferThread(inputStream, new ParcelFileDescriptor.AutoCloseOutputStream(writeSide),
+ listener)
+ .start();
+
+ return readSide;
+ }
+
+ public static ParcelFileDescriptor pipeTo(OutputStream outputStream, IThreadListener listener)
+ throws IOException {
+ ParcelFileDescriptor[] pipe = ParcelFileDescriptor.createPipe();
+ ParcelFileDescriptor readSide = pipe[0];
+ ParcelFileDescriptor writeSide = pipe[1];
+
+ // start the transfer thread
+ new TransferThread(new ParcelFileDescriptor.AutoCloseInputStream(readSide), outputStream,
+ listener)
+ .start();
+
+ return writeSide;
+ }
+
+ static class TransferThread extends Thread {
+ final InputStream mIn;
+ final OutputStream mOut;
+ final IThreadListener mListener;
+
+ TransferThread(InputStream in, OutputStream out, IThreadListener listener) {
+ super("ParcelFileDescriptor Transfer Thread");
+ mIn = in;
+ mOut = out;
+ mListener = listener;
+ setDaemon(true);
+ }
+
+ @Override
+ public void run() {
+ byte[] buf = new byte[1024];
+ int len;
+
+ try {
+ while ((len = mIn.read(buf)) > 0) {
+ mOut.write(buf, 0, len);
+ }
+ mOut.flush(); // just to be safe
+ } catch (IOException e) {
+ //Log.e(OpenPgpApi.TAG, "TransferThread" + getId() + ": writing failed", e);
+ } finally {
+ try {
+ mIn.close();
+ } catch (IOException e) {
+ //Log.e(OpenPgpApi.TAG, "TransferThread" + getId(), e);
+ }
+ try {
+ mOut.close();
+ } catch (IOException e) {
+ //Log.e(OpenPgpApi.TAG, "TransferThread" + getId(), e);
+ }
+ }
+ if (mListener != null) {
+ //Log.d(OpenPgpApi.TAG, "TransferThread " + getId() + " finished!");
+ mListener.onThreadFinished(this);
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/OpenKeychain-API/settings.gradle b/OpenKeychain-API/settings.gradle
new file mode 100644
index 000000000..a819a021b
--- /dev/null
+++ b/OpenKeychain-API/settings.gradle
@@ -0,0 +1,3 @@
+include ':example-app'
+include ':libraries:openpgp-api-library'
+include ':libraries:openkeychain-api-library' \ No newline at end of file