From 754b2a6cb15a6af61150cd4b1ce472bebd4fec22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Sun, 9 Feb 2014 19:22:14 +0100 Subject: Restructuring for new API library --- OpenPGP-Keychain-API-Demo/.gitignore | 29 -- OpenPGP-Keychain-API-Demo/build.gradle | 62 ---- .../gradle/wrapper/gradle-wrapper.jar | Bin 50508 -> 0 bytes .../gradle/wrapper/gradle-wrapper.properties | 6 - OpenPGP-Keychain-API-Demo/gradlew | 164 ---------- OpenPGP-Keychain-API-Demo/gradlew.bat | 90 ------ OpenPGP-Keychain-API-Demo/ic_launcher-web.png | Bin 23512 -> 0 bytes .../src/main/AndroidManifest.xml | 34 -- .../org/openintents/openpgp/IOpenPgpCallback.aidl | 45 --- .../openpgp/IOpenPgpKeyIdsCallback.aidl | 39 --- .../org/openintents/openpgp/IOpenPgpService.aidl | 143 --------- .../aidl/org/openintents/openpgp/OpenPgpData.aidl | 20 -- .../aidl/org/openintents/openpgp/OpenPgpError.aidl | 20 -- .../openpgp/OpenPgpSignatureResult.aidl | 20 -- .../org/openintents/openpgp/IOpenPgpCallback.aidl | 45 --- .../openpgp/IOpenPgpKeyIdsCallback.aidl | 39 --- .../org/openintents/openpgp/IOpenPgpService.aidl | 143 --------- .../org/openintents/openpgp/OpenPgpConstants.java | 10 - .../java/org/openintents/openpgp/OpenPgpData.aidl | 20 -- .../java/org/openintents/openpgp/OpenPgpData.java | 127 -------- .../java/org/openintents/openpgp/OpenPgpError.aidl | 20 -- .../java/org/openintents/openpgp/OpenPgpError.java | 81 ----- .../org/openintents/openpgp/OpenPgpHelper.java | 52 --- .../openintents/openpgp/OpenPgpListPreference.java | 203 ------------ .../openpgp/OpenPgpServiceConnection.java | 93 ------ .../openpgp/OpenPgpSignatureResult.aidl | 20 -- .../openpgp/OpenPgpSignatureResult.java | 110 ------- .../keychain/demo/AidlDemoActivity2.java | 168 ---------- .../keychain/demo/BaseActivity.java | 87 ----- .../keychain/demo/Constants.java | 25 -- .../keychain/demo/OpenPgpProviderActivity.java | 352 --------------------- .../src/main/res/drawable-hdpi/ic_launcher.png | Bin 2626 -> 0 bytes .../src/main/res/drawable-mdpi/ic_launcher.png | Bin 1732 -> 0 bytes .../src/main/res/drawable-xhdpi/ic_launcher.png | Bin 3517 -> 0 bytes .../src/main/res/drawable-xxhdpi/ic_launcher.png | Bin 5717 -> 0 bytes .../src/main/res/layout/aidl_demo2.xml | 40 --- .../src/main/res/layout/crypto_provider_demo.xml | 83 ----- .../src/main/res/layout/intent_demo.xml | 93 ------ .../src/main/res/xml/base_preference.xml | 23 -- OpenPGP-Keychain-API/.gitignore | 29 ++ OpenPGP-Keychain-API/build.gradle | 3 + OpenPGP-Keychain-API/example-app/build.gradle | 59 ++++ .../example-app/ic_launcher-web.png | Bin 0 -> 23512 bytes .../example-app/src/main/AndroidManifest.xml | 34 ++ .../keychain/demo/AidlDemoActivity2.java | 168 ++++++++++ .../keychain/demo/BaseActivity.java | 87 +++++ .../keychain/demo/Constants.java | 25 ++ .../keychain/demo/OpenPgpProviderActivity.java | 352 +++++++++++++++++++++ .../src/main/res/drawable-hdpi/ic_launcher.png | Bin 0 -> 2626 bytes .../src/main/res/drawable-mdpi/ic_launcher.png | Bin 0 -> 1732 bytes .../src/main/res/drawable-xhdpi/ic_launcher.png | Bin 0 -> 3517 bytes .../src/main/res/drawable-xxhdpi/ic_launcher.png | Bin 0 -> 5717 bytes .../example-app/src/main/res/layout/aidl_demo2.xml | 40 +++ .../src/main/res/layout/crypto_provider_demo.xml | 83 +++++ .../src/main/res/layout/intent_demo.xml | 93 ++++++ .../src/main/res/xml/base_preference.xml | 23 ++ .../gradle/gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 50557 bytes .../gradle/wrapper/gradle-wrapper.properties | 6 + OpenPGP-Keychain-API/gradle/gradlew | 164 ++++++++++ OpenPGP-Keychain-API/gradle/gradlew.bat | 90 ++++++ .../gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 50557 bytes .../gradle/wrapper/gradle-wrapper.properties | 6 + OpenPGP-Keychain-API/gradlew | 164 ++++++++++ OpenPGP-Keychain-API/gradlew.bat | 90 ++++++ .../libraries/keychain-api-library/.gitignore | 29 ++ .../libraries/keychain-api-library/LICENSE | 202 ++++++++++++ .../libraries/keychain-api-library/build.gradle | 21 ++ .../src/main/AndroidManifest.xml | 13 + .../org/openintents/openpgp/IOpenPgpCallback.aidl | 45 +++ .../openpgp/IOpenPgpKeyIdsCallback.aidl | 39 +++ .../org/openintents/openpgp/IOpenPgpService.aidl | 143 +++++++++ .../aidl/org/openintents/openpgp/OpenPgpData.aidl | 20 ++ .../aidl/org/openintents/openpgp/OpenPgpError.aidl | 20 ++ .../openpgp/OpenPgpSignatureResult.aidl | 20 ++ .../service/remote/IExtendedApiCallback.aidl | 24 ++ .../service/remote/IExtendedApiService.aidl | 48 +++ .../org/openintents/openpgp/OpenPgpConstants.java | 10 + .../java/org/openintents/openpgp/OpenPgpData.java | 127 ++++++++ .../java/org/openintents/openpgp/OpenPgpError.java | 81 +++++ .../org/openintents/openpgp/OpenPgpHelper.java | 52 +++ .../openintents/openpgp/OpenPgpListPreference.java | 201 ++++++++++++ .../openpgp/OpenPgpServiceConnection.java | 93 ++++++ .../openpgp/OpenPgpSignatureResult.java | 110 +++++++ OpenPGP-Keychain-API/settings.gradle | 2 + OpenPGP-Keychain/build.gradle | 1 + .../org/openintents/openpgp/IOpenPgpCallback.aidl | 45 --- .../openpgp/IOpenPgpKeyIdsCallback.aidl | 39 --- .../org/openintents/openpgp/IOpenPgpService.aidl | 143 --------- .../aidl/org/openintents/openpgp/OpenPgpData.aidl | 20 -- .../aidl/org/openintents/openpgp/OpenPgpError.aidl | 20 -- .../openpgp/OpenPgpSignatureResult.aidl | 20 -- .../service/remote/IExtendedApiCallback.aidl | 24 -- .../service/remote/IExtendedApiService.aidl | 48 --- .../org/openintents/openpgp/OpenPgpConstants.java | 10 - .../java/org/openintents/openpgp/OpenPgpData.java | 127 -------- .../java/org/openintents/openpgp/OpenPgpError.java | 81 ----- .../org/openintents/openpgp/OpenPgpHelper.java | 52 --- .../openintents/openpgp/OpenPgpListPreference.java | 201 ------------ .../openpgp/OpenPgpServiceConnection.java | 93 ------ .../openpgp/OpenPgpSignatureResult.java | 110 ------- OpenPGP-Keychain/src/main/res/values/strings.xml | 2 +- build.gradle | 2 +- gradle/wrapper/gradle-wrapper.properties | 4 +- libraries/keychain-api-library/.gitignore | 29 ++ libraries/keychain-api-library/LICENSE | 202 ++++++++++++ libraries/keychain-api-library/build.gradle | 12 + .../src/main/AndroidManifest.xml | 13 + .../org/openintents/openpgp/IOpenPgpCallback.aidl | 45 +++ .../openpgp/IOpenPgpKeyIdsCallback.aidl | 39 +++ .../org/openintents/openpgp/IOpenPgpService.aidl | 143 +++++++++ .../aidl/org/openintents/openpgp/OpenPgpData.aidl | 20 ++ .../aidl/org/openintents/openpgp/OpenPgpError.aidl | 20 ++ .../openpgp/OpenPgpSignatureResult.aidl | 20 ++ .../service/remote/IExtendedApiCallback.aidl | 24 ++ .../service/remote/IExtendedApiService.aidl | 48 +++ .../org/openintents/openpgp/OpenPgpConstants.java | 10 + .../java/org/openintents/openpgp/OpenPgpData.java | 127 ++++++++ .../java/org/openintents/openpgp/OpenPgpError.java | 81 +++++ .../org/openintents/openpgp/OpenPgpHelper.java | 52 +++ .../openintents/openpgp/OpenPgpListPreference.java | 201 ++++++++++++ .../openpgp/OpenPgpServiceConnection.java | 93 ++++++ .../openpgp/OpenPgpSignatureResult.java | 110 +++++++ settings.gradle | 1 + 123 files changed, 4111 insertions(+), 3543 deletions(-) delete mode 100644 OpenPGP-Keychain-API-Demo/.gitignore delete mode 100644 OpenPGP-Keychain-API-Demo/build.gradle delete mode 100644 OpenPGP-Keychain-API-Demo/gradle/wrapper/gradle-wrapper.jar delete mode 100644 OpenPGP-Keychain-API-Demo/gradle/wrapper/gradle-wrapper.properties delete mode 100755 OpenPGP-Keychain-API-Demo/gradlew delete mode 100644 OpenPGP-Keychain-API-Demo/gradlew.bat delete mode 100644 OpenPGP-Keychain-API-Demo/ic_launcher-web.png delete mode 100644 OpenPGP-Keychain-API-Demo/src/main/AndroidManifest.xml delete mode 100644 OpenPGP-Keychain-API-Demo/src/main/aidl/org/openintents/openpgp/IOpenPgpCallback.aidl delete mode 100644 OpenPGP-Keychain-API-Demo/src/main/aidl/org/openintents/openpgp/IOpenPgpKeyIdsCallback.aidl delete mode 100644 OpenPGP-Keychain-API-Demo/src/main/aidl/org/openintents/openpgp/IOpenPgpService.aidl delete mode 100644 OpenPGP-Keychain-API-Demo/src/main/aidl/org/openintents/openpgp/OpenPgpData.aidl delete mode 100644 OpenPGP-Keychain-API-Demo/src/main/aidl/org/openintents/openpgp/OpenPgpError.aidl delete mode 100644 OpenPGP-Keychain-API-Demo/src/main/aidl/org/openintents/openpgp/OpenPgpSignatureResult.aidl delete mode 100644 OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/IOpenPgpCallback.aidl delete mode 100644 OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/IOpenPgpKeyIdsCallback.aidl delete mode 100644 OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/IOpenPgpService.aidl delete mode 100644 OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/OpenPgpConstants.java delete mode 100644 OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/OpenPgpData.aidl delete mode 100644 OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/OpenPgpData.java delete mode 100644 OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/OpenPgpError.aidl delete mode 100644 OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/OpenPgpError.java delete mode 100644 OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/OpenPgpHelper.java delete mode 100644 OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/OpenPgpListPreference.java delete mode 100644 OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/OpenPgpServiceConnection.java delete mode 100644 OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/OpenPgpSignatureResult.aidl delete mode 100644 OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/OpenPgpSignatureResult.java delete mode 100644 OpenPGP-Keychain-API-Demo/src/main/java/org/sufficientlysecure/keychain/demo/AidlDemoActivity2.java delete mode 100644 OpenPGP-Keychain-API-Demo/src/main/java/org/sufficientlysecure/keychain/demo/BaseActivity.java delete mode 100644 OpenPGP-Keychain-API-Demo/src/main/java/org/sufficientlysecure/keychain/demo/Constants.java delete mode 100644 OpenPGP-Keychain-API-Demo/src/main/java/org/sufficientlysecure/keychain/demo/OpenPgpProviderActivity.java delete mode 100644 OpenPGP-Keychain-API-Demo/src/main/res/drawable-hdpi/ic_launcher.png delete mode 100644 OpenPGP-Keychain-API-Demo/src/main/res/drawable-mdpi/ic_launcher.png delete mode 100644 OpenPGP-Keychain-API-Demo/src/main/res/drawable-xhdpi/ic_launcher.png delete mode 100644 OpenPGP-Keychain-API-Demo/src/main/res/drawable-xxhdpi/ic_launcher.png delete mode 100644 OpenPGP-Keychain-API-Demo/src/main/res/layout/aidl_demo2.xml delete mode 100644 OpenPGP-Keychain-API-Demo/src/main/res/layout/crypto_provider_demo.xml delete mode 100644 OpenPGP-Keychain-API-Demo/src/main/res/layout/intent_demo.xml delete mode 100644 OpenPGP-Keychain-API-Demo/src/main/res/xml/base_preference.xml create mode 100644 OpenPGP-Keychain-API/.gitignore create mode 100644 OpenPGP-Keychain-API/build.gradle create mode 100644 OpenPGP-Keychain-API/example-app/build.gradle create mode 100644 OpenPGP-Keychain-API/example-app/ic_launcher-web.png create mode 100644 OpenPGP-Keychain-API/example-app/src/main/AndroidManifest.xml create mode 100644 OpenPGP-Keychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/AidlDemoActivity2.java create mode 100644 OpenPGP-Keychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/BaseActivity.java create mode 100644 OpenPGP-Keychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/Constants.java create mode 100644 OpenPGP-Keychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/OpenPgpProviderActivity.java create mode 100644 OpenPGP-Keychain-API/example-app/src/main/res/drawable-hdpi/ic_launcher.png create mode 100644 OpenPGP-Keychain-API/example-app/src/main/res/drawable-mdpi/ic_launcher.png create mode 100644 OpenPGP-Keychain-API/example-app/src/main/res/drawable-xhdpi/ic_launcher.png create mode 100644 OpenPGP-Keychain-API/example-app/src/main/res/drawable-xxhdpi/ic_launcher.png create mode 100644 OpenPGP-Keychain-API/example-app/src/main/res/layout/aidl_demo2.xml create mode 100644 OpenPGP-Keychain-API/example-app/src/main/res/layout/crypto_provider_demo.xml create mode 100644 OpenPGP-Keychain-API/example-app/src/main/res/layout/intent_demo.xml create mode 100644 OpenPGP-Keychain-API/example-app/src/main/res/xml/base_preference.xml create mode 100644 OpenPGP-Keychain-API/gradle/gradle/wrapper/gradle-wrapper.jar create mode 100644 OpenPGP-Keychain-API/gradle/gradle/wrapper/gradle-wrapper.properties create mode 100755 OpenPGP-Keychain-API/gradle/gradlew create mode 100644 OpenPGP-Keychain-API/gradle/gradlew.bat create mode 100644 OpenPGP-Keychain-API/gradle/wrapper/gradle-wrapper.jar create mode 100644 OpenPGP-Keychain-API/gradle/wrapper/gradle-wrapper.properties create mode 100755 OpenPGP-Keychain-API/gradlew create mode 100644 OpenPGP-Keychain-API/gradlew.bat create mode 100644 OpenPGP-Keychain-API/libraries/keychain-api-library/.gitignore create mode 100644 OpenPGP-Keychain-API/libraries/keychain-api-library/LICENSE create mode 100644 OpenPGP-Keychain-API/libraries/keychain-api-library/build.gradle create mode 100644 OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/AndroidManifest.xml create mode 100644 OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/aidl/org/openintents/openpgp/IOpenPgpCallback.aidl create mode 100644 OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/aidl/org/openintents/openpgp/IOpenPgpKeyIdsCallback.aidl create mode 100644 OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/aidl/org/openintents/openpgp/IOpenPgpService.aidl create mode 100644 OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/aidl/org/openintents/openpgp/OpenPgpData.aidl create mode 100644 OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/aidl/org/openintents/openpgp/OpenPgpError.aidl create mode 100644 OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/aidl/org/openintents/openpgp/OpenPgpSignatureResult.aidl create mode 100644 OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/aidl/org/sufficientlysecure/keychain/service/remote/IExtendedApiCallback.aidl create mode 100644 OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/aidl/org/sufficientlysecure/keychain/service/remote/IExtendedApiService.aidl create mode 100644 OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/java/org/openintents/openpgp/OpenPgpConstants.java create mode 100644 OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/java/org/openintents/openpgp/OpenPgpData.java create mode 100644 OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/java/org/openintents/openpgp/OpenPgpError.java create mode 100644 OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/java/org/openintents/openpgp/OpenPgpHelper.java create mode 100644 OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/java/org/openintents/openpgp/OpenPgpListPreference.java create mode 100644 OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/java/org/openintents/openpgp/OpenPgpServiceConnection.java create mode 100644 OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/java/org/openintents/openpgp/OpenPgpSignatureResult.java create mode 100644 OpenPGP-Keychain-API/settings.gradle delete mode 100644 OpenPGP-Keychain/src/main/aidl/org/openintents/openpgp/IOpenPgpCallback.aidl delete mode 100644 OpenPGP-Keychain/src/main/aidl/org/openintents/openpgp/IOpenPgpKeyIdsCallback.aidl delete mode 100644 OpenPGP-Keychain/src/main/aidl/org/openintents/openpgp/IOpenPgpService.aidl delete mode 100644 OpenPGP-Keychain/src/main/aidl/org/openintents/openpgp/OpenPgpData.aidl delete mode 100644 OpenPGP-Keychain/src/main/aidl/org/openintents/openpgp/OpenPgpError.aidl delete mode 100644 OpenPGP-Keychain/src/main/aidl/org/openintents/openpgp/OpenPgpSignatureResult.aidl delete mode 100644 OpenPGP-Keychain/src/main/aidl/org/sufficientlysecure/keychain/service/remote/IExtendedApiCallback.aidl delete mode 100644 OpenPGP-Keychain/src/main/aidl/org/sufficientlysecure/keychain/service/remote/IExtendedApiService.aidl delete mode 100644 OpenPGP-Keychain/src/main/java/org/openintents/openpgp/OpenPgpConstants.java delete mode 100644 OpenPGP-Keychain/src/main/java/org/openintents/openpgp/OpenPgpData.java delete mode 100644 OpenPGP-Keychain/src/main/java/org/openintents/openpgp/OpenPgpError.java delete mode 100644 OpenPGP-Keychain/src/main/java/org/openintents/openpgp/OpenPgpHelper.java delete mode 100644 OpenPGP-Keychain/src/main/java/org/openintents/openpgp/OpenPgpListPreference.java delete mode 100644 OpenPGP-Keychain/src/main/java/org/openintents/openpgp/OpenPgpServiceConnection.java delete mode 100644 OpenPGP-Keychain/src/main/java/org/openintents/openpgp/OpenPgpSignatureResult.java create mode 100644 libraries/keychain-api-library/.gitignore create mode 100644 libraries/keychain-api-library/LICENSE create mode 100644 libraries/keychain-api-library/build.gradle create mode 100644 libraries/keychain-api-library/src/main/AndroidManifest.xml create mode 100644 libraries/keychain-api-library/src/main/aidl/org/openintents/openpgp/IOpenPgpCallback.aidl create mode 100644 libraries/keychain-api-library/src/main/aidl/org/openintents/openpgp/IOpenPgpKeyIdsCallback.aidl create mode 100644 libraries/keychain-api-library/src/main/aidl/org/openintents/openpgp/IOpenPgpService.aidl create mode 100644 libraries/keychain-api-library/src/main/aidl/org/openintents/openpgp/OpenPgpData.aidl create mode 100644 libraries/keychain-api-library/src/main/aidl/org/openintents/openpgp/OpenPgpError.aidl create mode 100644 libraries/keychain-api-library/src/main/aidl/org/openintents/openpgp/OpenPgpSignatureResult.aidl create mode 100644 libraries/keychain-api-library/src/main/aidl/org/sufficientlysecure/keychain/service/remote/IExtendedApiCallback.aidl create mode 100644 libraries/keychain-api-library/src/main/aidl/org/sufficientlysecure/keychain/service/remote/IExtendedApiService.aidl create mode 100644 libraries/keychain-api-library/src/main/java/org/openintents/openpgp/OpenPgpConstants.java create mode 100644 libraries/keychain-api-library/src/main/java/org/openintents/openpgp/OpenPgpData.java create mode 100644 libraries/keychain-api-library/src/main/java/org/openintents/openpgp/OpenPgpError.java create mode 100644 libraries/keychain-api-library/src/main/java/org/openintents/openpgp/OpenPgpHelper.java create mode 100644 libraries/keychain-api-library/src/main/java/org/openintents/openpgp/OpenPgpListPreference.java create mode 100644 libraries/keychain-api-library/src/main/java/org/openintents/openpgp/OpenPgpServiceConnection.java create mode 100644 libraries/keychain-api-library/src/main/java/org/openintents/openpgp/OpenPgpSignatureResult.java diff --git a/OpenPGP-Keychain-API-Demo/.gitignore b/OpenPGP-Keychain-API-Demo/.gitignore deleted file mode 100644 index aa8bb5760..000000000 --- a/OpenPGP-Keychain-API-Demo/.gitignore +++ /dev/null @@ -1,29 +0,0 @@ -#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/OpenPGP-Keychain-API-Demo/build.gradle b/OpenPGP-Keychain-API-Demo/build.gradle deleted file mode 100644 index 025ff417b..000000000 --- a/OpenPGP-Keychain-API-Demo/build.gradle +++ /dev/null @@ -1,62 +0,0 @@ -buildscript { - repositories { - mavenCentral() - } - - dependencies { - classpath 'com.android.tools.build:gradle:0.8.0' - } -} - -apply plugin: 'android' - -repositories { - mavenCentral() -} - -dependencies { - compile 'com.android.support:support-v4:19.0.1' -} - -android { - compileSdkVersion 19 - buildToolsVersion "19.0.1" - - defaultConfig { - minSdkVersion 8 - 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/OpenPGP-Keychain-API-Demo/gradle/wrapper/gradle-wrapper.jar b/OpenPGP-Keychain-API-Demo/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index d5c591c9c..000000000 Binary files a/OpenPGP-Keychain-API-Demo/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/OpenPGP-Keychain-API-Demo/gradle/wrapper/gradle-wrapper.properties b/OpenPGP-Keychain-API-Demo/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index e3efa88f1..000000000 --- a/OpenPGP-Keychain-API-Demo/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,6 +0,0 @@ -#Mon Jan 27 14:45:08 CET 2014 -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=http\://services.gradle.org/distributions/gradle-1.9-bin.zip diff --git a/OpenPGP-Keychain-API-Demo/gradlew b/OpenPGP-Keychain-API-Demo/gradlew deleted file mode 100755 index 91a7e269e..000000000 --- a/OpenPGP-Keychain-API-Demo/gradlew +++ /dev/null @@ -1,164 +0,0 @@ -#!/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/OpenPGP-Keychain-API-Demo/gradlew.bat b/OpenPGP-Keychain-API-Demo/gradlew.bat deleted file mode 100644 index aec99730b..000000000 --- a/OpenPGP-Keychain-API-Demo/gradlew.bat +++ /dev/null @@ -1,90 +0,0 @@ -@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/OpenPGP-Keychain-API-Demo/ic_launcher-web.png b/OpenPGP-Keychain-API-Demo/ic_launcher-web.png deleted file mode 100644 index ae4cd0976..000000000 Binary files a/OpenPGP-Keychain-API-Demo/ic_launcher-web.png and /dev/null differ diff --git a/OpenPGP-Keychain-API-Demo/src/main/AndroidManifest.xml b/OpenPGP-Keychain-API-Demo/src/main/AndroidManifest.xml deleted file mode 100644 index 8b8c43776..000000000 --- a/OpenPGP-Keychain-API-Demo/src/main/AndroidManifest.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/OpenPGP-Keychain-API-Demo/src/main/aidl/org/openintents/openpgp/IOpenPgpCallback.aidl b/OpenPGP-Keychain-API-Demo/src/main/aidl/org/openintents/openpgp/IOpenPgpCallback.aidl deleted file mode 100644 index ba41de1ba..000000000 --- a/OpenPGP-Keychain-API-Demo/src/main/aidl/org/openintents/openpgp/IOpenPgpCallback.aidl +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2013 Dominik Schürmann - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.openintents.openpgp; - -import org.openintents.openpgp.OpenPgpData; -import org.openintents.openpgp.OpenPgpSignatureResult; -import org.openintents.openpgp.OpenPgpError; - -interface IOpenPgpCallback { - - /** - * onSuccess returns on successful OpenPGP operations. - * - * @param output - * contains resulting output (decrypted content (when input was encrypted) - * or content without signature (when input was signed-only)) - * @param signatureResult - * signatureResult is only non-null if decryptAndVerify() was called and the content - * was encrypted or signed-and-encrypted. - */ - oneway void onSuccess(in OpenPgpData output, in OpenPgpSignatureResult signatureResult); - - /** - * onError returns on errors or when allowUserInteraction was set to false, but user interaction - * was required execute an OpenPGP operation. - * - * @param error - * See OpenPgpError class for more information. - */ - oneway void onError(in OpenPgpError error); -} \ No newline at end of file diff --git a/OpenPGP-Keychain-API-Demo/src/main/aidl/org/openintents/openpgp/IOpenPgpKeyIdsCallback.aidl b/OpenPGP-Keychain-API-Demo/src/main/aidl/org/openintents/openpgp/IOpenPgpKeyIdsCallback.aidl deleted file mode 100644 index 4ca356fad..000000000 --- a/OpenPGP-Keychain-API-Demo/src/main/aidl/org/openintents/openpgp/IOpenPgpKeyIdsCallback.aidl +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2013 Dominik Schürmann - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.openintents.openpgp; - -import org.openintents.openpgp.OpenPgpError; - -interface IOpenPgpKeyIdsCallback { - - /** - * onSuccess returns on successful getKeyIds operations. - * - * @param keyIds - * returned key ids - */ - oneway void onSuccess(in long[] keyIds); - - /** - * onError returns on errors or when allowUserInteraction was set to false, but user interaction - * was required execute an OpenPGP operation. - * - * @param error - * See OpenPgpError class for more information. - */ - oneway void onError(in OpenPgpError error); -} \ No newline at end of file diff --git a/OpenPGP-Keychain-API-Demo/src/main/aidl/org/openintents/openpgp/IOpenPgpService.aidl b/OpenPGP-Keychain-API-Demo/src/main/aidl/org/openintents/openpgp/IOpenPgpService.aidl deleted file mode 100644 index 8f9e8a0fd..000000000 --- a/OpenPGP-Keychain-API-Demo/src/main/aidl/org/openintents/openpgp/IOpenPgpService.aidl +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (C) 2013 Dominik Schürmann - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.openintents.openpgp; - -import org.openintents.openpgp.OpenPgpData; -import org.openintents.openpgp.IOpenPgpCallback; -import org.openintents.openpgp.IOpenPgpKeyIdsCallback; - -/** - * All methods are oneway, which means they are asynchronous and non-blocking. - * Results are returned to the callback, which has to be implemented on client side. - */ -interface IOpenPgpService { - - /** - * Sign - * - * After successful signing, callback's onSuccess will contain the resulting output. - * - * @param input - * OpenPgpData object containing String, byte[], ParcelFileDescriptor, or Uri - * @param output - * Request output format by defining OpenPgpData object - * - * new OpenPgpData(OpenPgpData.TYPE_STRING) - * Returns as String - * (OpenPGP Radix-64, 33 percent overhead compared to binary, see http://tools.ietf.org/html/rfc4880#page-53) - * new OpenPgpData(OpenPgpData.TYPE_BYTE_ARRAY) - * Returns as byte[] - * new OpenPgpData(uri) - * Writes output to given Uri - * new OpenPgpData(fileDescriptor) - * Writes output to given ParcelFileDescriptor - * @param callback - * Callback where to return results - */ - oneway void sign(in OpenPgpData input, in OpenPgpData output, in IOpenPgpCallback callback); - - /** - * Encrypt - * - * After successful encryption, callback's onSuccess will contain the resulting output. - * - * @param input - * OpenPgpData object containing String, byte[], ParcelFileDescriptor, or Uri - * @param output - * Request output format by defining OpenPgpData object - * - * new OpenPgpData(OpenPgpData.TYPE_STRING) - * Returns as String - * (OpenPGP Radix-64, 33 percent overhead compared to binary, see http://tools.ietf.org/html/rfc4880#page-53) - * new OpenPgpData(OpenPgpData.TYPE_BYTE_ARRAY) - * Returns as byte[] - * new OpenPgpData(uri) - * Writes output to given Uri - * new OpenPgpData(fileDescriptor) - * Writes output to given ParcelFileDescriptor - * @param keyIds - * Key Ids of recipients. Can be retrieved with getKeyIds() - * @param callback - * Callback where to return results - */ - oneway void encrypt(in OpenPgpData input, in OpenPgpData output, in long[] keyIds, in IOpenPgpCallback callback); - - /** - * Sign then encrypt - * - * After successful signing and encryption, callback's onSuccess will contain the resulting output. - * - * @param input - * OpenPgpData object containing String, byte[], ParcelFileDescriptor, or Uri - * @param output - * Request output format by defining OpenPgpData object - * - * new OpenPgpData(OpenPgpData.TYPE_STRING) - * Returns as String - * (OpenPGP Radix-64, 33 percent overhead compared to binary, see http://tools.ietf.org/html/rfc4880#page-53) - * new OpenPgpData(OpenPgpData.TYPE_BYTE_ARRAY) - * Returns as byte[] - * new OpenPgpData(uri) - * Writes output to given Uri - * new OpenPgpData(fileDescriptor) - * Writes output to given ParcelFileDescriptor - * @param keyIds - * Key Ids of recipients. Can be retrieved with getKeyIds() - * @param callback - * Callback where to return results - */ - oneway void signAndEncrypt(in OpenPgpData input, in OpenPgpData output, in long[] keyIds, in IOpenPgpCallback callback); - - /** - * Decrypts and verifies given input bytes. This methods handles encrypted-only, signed-and-encrypted, - * and also signed-only input. - * - * After successful decryption/verification, callback's onSuccess will contain the resulting output. - * The signatureResult in onSuccess is only non-null if signed-and-encrypted or signed-only inputBytes were given. - * - * @param input - * OpenPgpData object containing String, byte[], ParcelFileDescriptor, or Uri - * @param output - * Request output format by defining OpenPgpData object - * - * new OpenPgpData(OpenPgpData.TYPE_STRING) - * Returns as String - * (OpenPGP Radix-64, 33 percent overhead compared to binary, see http://tools.ietf.org/html/rfc4880#page-53) - * new OpenPgpData(OpenPgpData.TYPE_BYTE_ARRAY) - * Returns as byte[] - * new OpenPgpData(uri) - * Writes output to given Uri - * new OpenPgpData(fileDescriptor) - * Writes output to given ParcelFileDescriptor - * @param callback - * Callback where to return results - */ - oneway void decryptAndVerify(in OpenPgpData input, in OpenPgpData output, in IOpenPgpCallback callback); - - /** - * Get available key ids based on given user ids - * - * @param ids - * User Ids (emails) of recipients OR key ids - * @param allowUserInteraction - * Enable user interaction to lookup and import unknown keys - * @param callback - * Callback where to return results (different type than callback in other functions!) - */ - oneway void getKeyIds(in String[] ids, in boolean allowUserInteraction, in IOpenPgpKeyIdsCallback callback); - -} \ No newline at end of file diff --git a/OpenPGP-Keychain-API-Demo/src/main/aidl/org/openintents/openpgp/OpenPgpData.aidl b/OpenPGP-Keychain-API-Demo/src/main/aidl/org/openintents/openpgp/OpenPgpData.aidl deleted file mode 100644 index 3711e4fb4..000000000 --- a/OpenPGP-Keychain-API-Demo/src/main/aidl/org/openintents/openpgp/OpenPgpData.aidl +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (C) 2013 Dominik Schürmann - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.openintents.openpgp; - -// Declare OpenPgpData so AIDL can find it and knows that it implements the parcelable protocol. -parcelable OpenPgpData; \ No newline at end of file diff --git a/OpenPGP-Keychain-API-Demo/src/main/aidl/org/openintents/openpgp/OpenPgpError.aidl b/OpenPGP-Keychain-API-Demo/src/main/aidl/org/openintents/openpgp/OpenPgpError.aidl deleted file mode 100644 index 7a6bed1e6..000000000 --- a/OpenPGP-Keychain-API-Demo/src/main/aidl/org/openintents/openpgp/OpenPgpError.aidl +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (C) 2013 Dominik Schürmann - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.openintents.openpgp; - -// Declare OpenPgpError so AIDL can find it and knows that it implements the parcelable protocol. -parcelable OpenPgpError; \ No newline at end of file diff --git a/OpenPGP-Keychain-API-Demo/src/main/aidl/org/openintents/openpgp/OpenPgpSignatureResult.aidl b/OpenPGP-Keychain-API-Demo/src/main/aidl/org/openintents/openpgp/OpenPgpSignatureResult.aidl deleted file mode 100644 index e246792d0..000000000 --- a/OpenPGP-Keychain-API-Demo/src/main/aidl/org/openintents/openpgp/OpenPgpSignatureResult.aidl +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (C) 2013 Dominik Schürmann - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.openintents.openpgp; - -// Declare OpenPgpSignatureResult so AIDL can find it and knows that it implements the parcelable protocol. -parcelable OpenPgpSignatureResult; \ No newline at end of file diff --git a/OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/IOpenPgpCallback.aidl b/OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/IOpenPgpCallback.aidl deleted file mode 100644 index ba41de1ba..000000000 --- a/OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/IOpenPgpCallback.aidl +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2013 Dominik Schürmann - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.openintents.openpgp; - -import org.openintents.openpgp.OpenPgpData; -import org.openintents.openpgp.OpenPgpSignatureResult; -import org.openintents.openpgp.OpenPgpError; - -interface IOpenPgpCallback { - - /** - * onSuccess returns on successful OpenPGP operations. - * - * @param output - * contains resulting output (decrypted content (when input was encrypted) - * or content without signature (when input was signed-only)) - * @param signatureResult - * signatureResult is only non-null if decryptAndVerify() was called and the content - * was encrypted or signed-and-encrypted. - */ - oneway void onSuccess(in OpenPgpData output, in OpenPgpSignatureResult signatureResult); - - /** - * onError returns on errors or when allowUserInteraction was set to false, but user interaction - * was required execute an OpenPGP operation. - * - * @param error - * See OpenPgpError class for more information. - */ - oneway void onError(in OpenPgpError error); -} \ No newline at end of file diff --git a/OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/IOpenPgpKeyIdsCallback.aidl b/OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/IOpenPgpKeyIdsCallback.aidl deleted file mode 100644 index 4ca356fad..000000000 --- a/OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/IOpenPgpKeyIdsCallback.aidl +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2013 Dominik Schürmann - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.openintents.openpgp; - -import org.openintents.openpgp.OpenPgpError; - -interface IOpenPgpKeyIdsCallback { - - /** - * onSuccess returns on successful getKeyIds operations. - * - * @param keyIds - * returned key ids - */ - oneway void onSuccess(in long[] keyIds); - - /** - * onError returns on errors or when allowUserInteraction was set to false, but user interaction - * was required execute an OpenPGP operation. - * - * @param error - * See OpenPgpError class for more information. - */ - oneway void onError(in OpenPgpError error); -} \ No newline at end of file diff --git a/OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/IOpenPgpService.aidl b/OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/IOpenPgpService.aidl deleted file mode 100644 index 8f9e8a0fd..000000000 --- a/OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/IOpenPgpService.aidl +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (C) 2013 Dominik Schürmann - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.openintents.openpgp; - -import org.openintents.openpgp.OpenPgpData; -import org.openintents.openpgp.IOpenPgpCallback; -import org.openintents.openpgp.IOpenPgpKeyIdsCallback; - -/** - * All methods are oneway, which means they are asynchronous and non-blocking. - * Results are returned to the callback, which has to be implemented on client side. - */ -interface IOpenPgpService { - - /** - * Sign - * - * After successful signing, callback's onSuccess will contain the resulting output. - * - * @param input - * OpenPgpData object containing String, byte[], ParcelFileDescriptor, or Uri - * @param output - * Request output format by defining OpenPgpData object - * - * new OpenPgpData(OpenPgpData.TYPE_STRING) - * Returns as String - * (OpenPGP Radix-64, 33 percent overhead compared to binary, see http://tools.ietf.org/html/rfc4880#page-53) - * new OpenPgpData(OpenPgpData.TYPE_BYTE_ARRAY) - * Returns as byte[] - * new OpenPgpData(uri) - * Writes output to given Uri - * new OpenPgpData(fileDescriptor) - * Writes output to given ParcelFileDescriptor - * @param callback - * Callback where to return results - */ - oneway void sign(in OpenPgpData input, in OpenPgpData output, in IOpenPgpCallback callback); - - /** - * Encrypt - * - * After successful encryption, callback's onSuccess will contain the resulting output. - * - * @param input - * OpenPgpData object containing String, byte[], ParcelFileDescriptor, or Uri - * @param output - * Request output format by defining OpenPgpData object - * - * new OpenPgpData(OpenPgpData.TYPE_STRING) - * Returns as String - * (OpenPGP Radix-64, 33 percent overhead compared to binary, see http://tools.ietf.org/html/rfc4880#page-53) - * new OpenPgpData(OpenPgpData.TYPE_BYTE_ARRAY) - * Returns as byte[] - * new OpenPgpData(uri) - * Writes output to given Uri - * new OpenPgpData(fileDescriptor) - * Writes output to given ParcelFileDescriptor - * @param keyIds - * Key Ids of recipients. Can be retrieved with getKeyIds() - * @param callback - * Callback where to return results - */ - oneway void encrypt(in OpenPgpData input, in OpenPgpData output, in long[] keyIds, in IOpenPgpCallback callback); - - /** - * Sign then encrypt - * - * After successful signing and encryption, callback's onSuccess will contain the resulting output. - * - * @param input - * OpenPgpData object containing String, byte[], ParcelFileDescriptor, or Uri - * @param output - * Request output format by defining OpenPgpData object - * - * new OpenPgpData(OpenPgpData.TYPE_STRING) - * Returns as String - * (OpenPGP Radix-64, 33 percent overhead compared to binary, see http://tools.ietf.org/html/rfc4880#page-53) - * new OpenPgpData(OpenPgpData.TYPE_BYTE_ARRAY) - * Returns as byte[] - * new OpenPgpData(uri) - * Writes output to given Uri - * new OpenPgpData(fileDescriptor) - * Writes output to given ParcelFileDescriptor - * @param keyIds - * Key Ids of recipients. Can be retrieved with getKeyIds() - * @param callback - * Callback where to return results - */ - oneway void signAndEncrypt(in OpenPgpData input, in OpenPgpData output, in long[] keyIds, in IOpenPgpCallback callback); - - /** - * Decrypts and verifies given input bytes. This methods handles encrypted-only, signed-and-encrypted, - * and also signed-only input. - * - * After successful decryption/verification, callback's onSuccess will contain the resulting output. - * The signatureResult in onSuccess is only non-null if signed-and-encrypted or signed-only inputBytes were given. - * - * @param input - * OpenPgpData object containing String, byte[], ParcelFileDescriptor, or Uri - * @param output - * Request output format by defining OpenPgpData object - * - * new OpenPgpData(OpenPgpData.TYPE_STRING) - * Returns as String - * (OpenPGP Radix-64, 33 percent overhead compared to binary, see http://tools.ietf.org/html/rfc4880#page-53) - * new OpenPgpData(OpenPgpData.TYPE_BYTE_ARRAY) - * Returns as byte[] - * new OpenPgpData(uri) - * Writes output to given Uri - * new OpenPgpData(fileDescriptor) - * Writes output to given ParcelFileDescriptor - * @param callback - * Callback where to return results - */ - oneway void decryptAndVerify(in OpenPgpData input, in OpenPgpData output, in IOpenPgpCallback callback); - - /** - * Get available key ids based on given user ids - * - * @param ids - * User Ids (emails) of recipients OR key ids - * @param allowUserInteraction - * Enable user interaction to lookup and import unknown keys - * @param callback - * Callback where to return results (different type than callback in other functions!) - */ - oneway void getKeyIds(in String[] ids, in boolean allowUserInteraction, in IOpenPgpKeyIdsCallback callback); - -} \ No newline at end of file diff --git a/OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/OpenPgpConstants.java b/OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/OpenPgpConstants.java deleted file mode 100644 index b1ca1bfe6..000000000 --- a/OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/OpenPgpConstants.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.openintents.openpgp; - -public class OpenPgpConstants { - - public static final String TAG = "OpenPgp API"; - - public static final int REQUIRED_API_VERSION = 1; - public static final String SERVICE_INTENT = "org.openintents.openpgp.IOpenPgpService"; - -} diff --git a/OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/OpenPgpData.aidl b/OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/OpenPgpData.aidl deleted file mode 100644 index 3711e4fb4..000000000 --- a/OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/OpenPgpData.aidl +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (C) 2013 Dominik Schürmann - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.openintents.openpgp; - -// Declare OpenPgpData so AIDL can find it and knows that it implements the parcelable protocol. -parcelable OpenPgpData; \ No newline at end of file diff --git a/OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/OpenPgpData.java b/OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/OpenPgpData.java deleted file mode 100644 index 6615c2146..000000000 --- a/OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/OpenPgpData.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (C) 2013 Dominik Schürmann - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.openintents.openpgp; - -import android.net.Uri; -import android.os.Parcel; -import android.os.ParcelFileDescriptor; -import android.os.Parcelable; - -public class OpenPgpData implements Parcelable { - public static final int TYPE_STRING = 0; - public static final int TYPE_BYTE_ARRAY = 1; - public static final int TYPE_FILE_DESCRIPTOR = 2; - public static final int TYPE_URI = 3; - - int type; - - String string; - byte[] bytes = new byte[0]; - ParcelFileDescriptor fileDescriptor; - Uri uri; - - public int getType() { - return type; - } - - public String getString() { - return string; - } - - public byte[] getBytes() { - return bytes; - } - - public ParcelFileDescriptor getFileDescriptor() { - return fileDescriptor; - } - - public Uri getUri() { - return uri; - } - - public OpenPgpData() { - - } - - /** - * Not a real constructor. This can be used to define requested output type. - * - * @param type - */ - public OpenPgpData(int type) { - this.type = type; - } - - public OpenPgpData(String string) { - this.string = string; - this.type = TYPE_STRING; - } - - public OpenPgpData(byte[] bytes) { - this.bytes = bytes; - this.type = TYPE_BYTE_ARRAY; - } - - public OpenPgpData(ParcelFileDescriptor fileDescriptor) { - this.fileDescriptor = fileDescriptor; - this.type = TYPE_FILE_DESCRIPTOR; - } - - public OpenPgpData(Uri uri) { - this.uri = uri; - this.type = TYPE_URI; - } - - public OpenPgpData(OpenPgpData b) { - this.string = b.string; - this.bytes = b.bytes; - this.fileDescriptor = b.fileDescriptor; - this.uri = b.uri; - } - - public int describeContents() { - return 0; - } - - public void writeToParcel(Parcel dest, int flags) { - dest.writeInt(type); - dest.writeString(string); - dest.writeInt(bytes.length); - dest.writeByteArray(bytes); - dest.writeParcelable(fileDescriptor, 0); - dest.writeParcelable(uri, 0); - } - - public static final Creator CREATOR = new Creator() { - public OpenPgpData createFromParcel(final Parcel source) { - OpenPgpData vr = new OpenPgpData(); - vr.type = source.readInt(); - vr.string = source.readString(); - vr.bytes = new byte[source.readInt()]; - source.readByteArray(vr.bytes); - vr.fileDescriptor = source.readParcelable(ParcelFileDescriptor.class.getClassLoader()); - vr.fileDescriptor = source.readParcelable(Uri.class.getClassLoader()); - return vr; - } - - public OpenPgpData[] newArray(final int size) { - return new OpenPgpData[size]; - } - }; - -} diff --git a/OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/OpenPgpError.aidl b/OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/OpenPgpError.aidl deleted file mode 100644 index 7a6bed1e6..000000000 --- a/OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/OpenPgpError.aidl +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (C) 2013 Dominik Schürmann - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.openintents.openpgp; - -// Declare OpenPgpError so AIDL can find it and knows that it implements the parcelable protocol. -parcelable OpenPgpError; \ No newline at end of file diff --git a/OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/OpenPgpError.java b/OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/OpenPgpError.java deleted file mode 100644 index f108d3169..000000000 --- a/OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/OpenPgpError.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (C) 2013 Dominik Schürmann - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.openintents.openpgp; - -import android.os.Parcel; -import android.os.Parcelable; - -public class OpenPgpError implements Parcelable { - public static final int GENERIC_ERROR = 0; - public static final int NO_OR_WRONG_PASSPHRASE = 1; - public static final int NO_USER_IDS = 2; - public static final int USER_INTERACTION_REQUIRED = 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) { - dest.writeInt(errorId); - dest.writeString(message); - } - - public static final Creator CREATOR = new Creator() { - public OpenPgpError createFromParcel(final Parcel source) { - OpenPgpError error = new OpenPgpError(); - error.errorId = source.readInt(); - error.message = source.readString(); - return error; - } - - public OpenPgpError[] newArray(final int size) { - return new OpenPgpError[size]; - } - }; -} diff --git a/OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/OpenPgpHelper.java b/OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/OpenPgpHelper.java deleted file mode 100644 index 7305c47ce..000000000 --- a/OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/OpenPgpHelper.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (C) 2013 Dominik Schürmann - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.openintents.openpgp; - -import java.util.List; -import java.util.regex.Pattern; - -import android.content.Context; -import android.content.Intent; -import android.content.pm.ResolveInfo; - -public class OpenPgpHelper { - private Context context; - - public static Pattern PGP_MESSAGE = Pattern.compile( - ".*?(-----BEGIN PGP MESSAGE-----.*?-----END PGP MESSAGE-----).*", Pattern.DOTALL); - - public static Pattern PGP_SIGNED_MESSAGE = Pattern - .compile( - ".*?(-----BEGIN PGP SIGNED MESSAGE-----.*?-----BEGIN PGP SIGNATURE-----.*?-----END PGP SIGNATURE-----).*", - Pattern.DOTALL); - - public OpenPgpHelper(Context context) { - super(); - this.context = context; - } - - public boolean isAvailable() { - Intent intent = new Intent(OpenPgpConstants.SERVICE_INTENT); - List resInfo = context.getPackageManager().queryIntentServices(intent, 0); - if (!resInfo.isEmpty()) { - return true; - } else { - return false; - } - } - -} diff --git a/OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/OpenPgpListPreference.java b/OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/OpenPgpListPreference.java deleted file mode 100644 index c8e709df9..000000000 --- a/OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/OpenPgpListPreference.java +++ /dev/null @@ -1,203 +0,0 @@ -/* - * Copyright (C) 2013 Dominik Schürmann - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.openintents.openpgp; - -import java.util.ArrayList; -import java.util.List; - -import android.app.AlertDialog.Builder; -import android.content.Context; -import android.content.DialogInterface; -import android.content.Intent; -import android.content.pm.PackageManager; -import android.content.pm.ResolveInfo; -import android.content.pm.ServiceInfo; -import android.graphics.Bitmap; -import android.graphics.drawable.BitmapDrawable; -import android.graphics.drawable.Drawable; -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; - -public class OpenPgpListPreference extends DialogPreference { - ArrayList mProviderList = new ArrayList(); - private String mSelectedPackage; - - public OpenPgpListPreference(Context context, AttributeSet attrs) { - super(context, attrs); - - List resInfo = context.getPackageManager().queryIntentServices( - new Intent(OpenPgpConstants.SERVICE_INTENT), PackageManager.GET_META_DATA); - if (!resInfo.isEmpty()) { - for (ResolveInfo resolveInfo : resInfo) { - if (resolveInfo.serviceInfo == null) - continue; - - String packageName = resolveInfo.serviceInfo.packageName; - String simpleName = String.valueOf(resolveInfo.serviceInfo.loadLabel(context - .getPackageManager())); - Drawable icon = resolveInfo.serviceInfo.loadIcon(context.getPackageManager()); - - // get api version - ServiceInfo si = resolveInfo.serviceInfo; - int apiVersion = si.metaData.getInt("api_version"); - - mProviderList.add(new OpenPgpProviderEntry(packageName, simpleName, icon, - apiVersion)); - } - } - } - - public OpenPgpListPreference(Context context) { - this(context, null); - } - - /** - * Can be used to add "no selection" - * - * @param packageName - * @param simpleName - * @param icon - */ - public void addProvider(int position, String packageName, String simpleName, Drawable icon, - int apiVersion) { - mProviderList.add(position, new OpenPgpProviderEntry(packageName, simpleName, icon, - apiVersion)); - } - - @Override - protected void onPrepareDialogBuilder(Builder builder) { - // Init ArrayAdapter with OpenPGP Providers - ListAdapter adapter = new ArrayAdapter(getContext(), - android.R.layout.select_dialog_singlechoice, android.R.id.text1, mProviderList) { - 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(mProviderList.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); - - // disable if it has the wrong api_version - if (mProviderList.get(position).apiVersion == OpenPgpConstants.REQUIRED_API_VERSION) { - tv.setEnabled(true); - } else { - tv.setEnabled(false); - tv.setText(tv.getText() + " (API v" + mProviderList.get(position).apiVersion - + ", needs v" + OpenPgpConstants.REQUIRED_API_VERSION + ")"); - } - - return v; - } - }; - - builder.setSingleChoiceItems(adapter, getIndexOfProviderList(getValue()), - new DialogInterface.OnClickListener() { - - @Override - public void onClick(DialogInterface dialog, int which) { - mSelectedPackage = mProviderList.get(which).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 : mProviderList) { - if (app.packageName.equals(packageName)) { - return mProviderList.indexOf(app); - } - } - - return -1; - } - - public void setValue(String packageName) { - mSelectedPackage = packageName; - persistString(packageName); - } - - public String getValue() { - return mSelectedPackage; - } - - public String getEntry() { - return getEntryByValue(mSelectedPackage); - } - - public String getEntryByValue(String packageName) { - for (OpenPgpProviderEntry app : mProviderList) { - if (app.packageName.equals(packageName)) { - return app.simpleName; - } - } - - return null; - } - - private static class OpenPgpProviderEntry { - private String packageName; - private String simpleName; - private Drawable icon; - private int apiVersion; - - public OpenPgpProviderEntry(String packageName, String simpleName, Drawable icon, - int apiVersion) { - this.packageName = packageName; - this.simpleName = simpleName; - this.icon = icon; - this.apiVersion = apiVersion; - } - - @Override - public String toString() { - return simpleName; - } - } -} diff --git a/OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/OpenPgpServiceConnection.java b/OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/OpenPgpServiceConnection.java deleted file mode 100644 index f7ba06aaf..000000000 --- a/OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/OpenPgpServiceConnection.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (C) 2013 Dominik Schürmann - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.openintents.openpgp; - -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; -import android.util.Log; - -public class OpenPgpServiceConnection { - private Context mApplicationContext; - - private IOpenPgpService mService; - private boolean mBound; - private String mCryptoProviderPackageName; - - public OpenPgpServiceConnection(Context context, String cryptoProviderPackageName) { - this.mApplicationContext = context.getApplicationContext(); - this.mCryptoProviderPackageName = cryptoProviderPackageName; - } - - public IOpenPgpService getService() { - return mService; - } - - public boolean isBound() { - return mBound; - } - - private ServiceConnection mCryptoServiceConnection = new ServiceConnection() { - public void onServiceConnected(ComponentName name, IBinder service) { - mService = IOpenPgpService.Stub.asInterface(service); - Log.d(OpenPgpConstants.TAG, "connected to service"); - mBound = true; - } - - public void onServiceDisconnected(ComponentName name) { - mService = null; - Log.d(OpenPgpConstants.TAG, "disconnected from service"); - mBound = false; - } - }; - - /** - * If not already bound, bind! - * - * @return - */ - public boolean bindToService() { - if (mService == null && !mBound) { // if not already connected - try { - Log.d(OpenPgpConstants.TAG, "not bound yet"); - - Intent serviceIntent = new Intent(); - serviceIntent.setAction(IOpenPgpService.class.getName()); - serviceIntent.setPackage(mCryptoProviderPackageName); - mApplicationContext.bindService(serviceIntent, mCryptoServiceConnection, - Context.BIND_AUTO_CREATE); - - return true; - } catch (Exception e) { - Log.d(OpenPgpConstants.TAG, "Exception on binding", e); - return false; - } - } else { - Log.d(OpenPgpConstants.TAG, "already bound"); - return true; - } - } - - public void unbindFromService() { - mApplicationContext.unbindService(mCryptoServiceConnection); - } - -} diff --git a/OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/OpenPgpSignatureResult.aidl b/OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/OpenPgpSignatureResult.aidl deleted file mode 100644 index e246792d0..000000000 --- a/OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/OpenPgpSignatureResult.aidl +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (C) 2013 Dominik Schürmann - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.openintents.openpgp; - -// Declare OpenPgpSignatureResult so AIDL can find it and knows that it implements the parcelable protocol. -parcelable OpenPgpSignatureResult; \ No newline at end of file diff --git a/OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/OpenPgpSignatureResult.java b/OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/OpenPgpSignatureResult.java deleted file mode 100644 index 829f8f8cf..000000000 --- a/OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/OpenPgpSignatureResult.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (C) 2013 Dominik Schürmann - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.openintents.openpgp; - -import android.os.Parcel; -import android.os.Parcelable; - -public class OpenPgpSignatureResult implements Parcelable { - // generic error on signature verification - public static final int SIGNATURE_ERROR = 0; - // successfully verified signature, with trusted public key - public static final int SIGNATURE_SUCCESS_TRUSTED = 1; - // no public key was found for this signature verification - // you can retrieve the key with - // getKeys(new String[] {String.valueOf(signatureResult.getKeyId)}, true, callback) - public static final int SIGNATURE_UNKNOWN_PUB_KEY = 2; - // successfully verified signature, but with untrusted public key - public static final int SIGNATURE_SUCCESS_UNTRUSTED = 3; - - int status; - boolean signatureOnly; - String userId; - long keyId; - - public int getStatus() { - return status; - } - - public boolean isSignatureOnly() { - return signatureOnly; - } - - public String getUserId() { - return userId; - } - - public long getKeyId() { - return 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) { - dest.writeInt(status); - dest.writeByte((byte) (signatureOnly ? 1 : 0)); - dest.writeString(userId); - dest.writeLong(keyId); - } - - public static final Creator CREATOR = new Creator() { - public OpenPgpSignatureResult createFromParcel(final Parcel source) { - OpenPgpSignatureResult vr = new OpenPgpSignatureResult(); - vr.status = source.readInt(); - vr.signatureOnly = source.readByte() == 1; - vr.userId = source.readString(); - vr.keyId = source.readLong(); - 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/OpenPGP-Keychain-API-Demo/src/main/java/org/sufficientlysecure/keychain/demo/AidlDemoActivity2.java b/OpenPGP-Keychain-API-Demo/src/main/java/org/sufficientlysecure/keychain/demo/AidlDemoActivity2.java deleted file mode 100644 index b6e211955..000000000 --- a/OpenPGP-Keychain-API-Demo/src/main/java/org/sufficientlysecure/keychain/demo/AidlDemoActivity2.java +++ /dev/null @@ -1,168 +0,0 @@ -///* -// * Copyright (C) 2012 Dominik Schürmann -// * -// * Licensed under the Apache License, Version 2.0 (the "License"); -// * you may not use this file except in compliance with the License. -// * You may obtain a copy of the License at -// * -// * http://www.apache.org/licenses/LICENSE-2.0 -// * -// * Unless required by applicable law or agreed to in writing, software -// * distributed under the License is distributed on an "AS IS" BASIS, -// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// * See the License for the specific language governing permissions and -// * limitations under the License. -// */ -// -//package org.sufficientlysecure.keychain.demo; -// -//import java.util.ArrayList; -//import java.util.List; -// -//import org.sufficientlysecure.keychain.demo.R; -//import org.sufficientlysecure.keychain.integration.KeychainData; -//import org.sufficientlysecure.keychain.integration.KeychainIntentHelper; -//import org.sufficientlysecure.keychain.service.IKeychainKeyService; -//import org.sufficientlysecure.keychain.service.handler.IKeychainGetKeyringsHandler; -// -//import android.annotation.SuppressLint; -//import android.app.Activity; -//import android.app.AlertDialog; -//import android.content.ComponentName; -//import android.content.Context; -//import android.content.Intent; -//import android.content.ServiceConnection; -//import android.os.Bundle; -//import android.os.IBinder; -//import android.os.RemoteException; -//import android.util.Base64; -//import android.view.View; -//import android.widget.TextView; -// -//public class AidlDemoActivity2 extends Activity { -// Activity mActivity; -// -// TextView mKeyringsTextView; -// -// KeychainIntentHelper mKeychainIntentHelper; -// KeychainData mKeychainData; -// -// byte[] keysBytes; -// ArrayList keysStrings; -// -// private IKeychainKeyService service = null; -// private ServiceConnection svcConn = new ServiceConnection() { -// public void onServiceConnected(ComponentName className, IBinder binder) { -// service = IKeychainKeyService.Stub.asInterface(binder); -// } -// -// public void onServiceDisconnected(ComponentName className) { -// service = null; -// } -// }; -// -// @Override -// public void onCreate(Bundle icicle) { -// super.onCreate(icicle); -// setContentView(R.layout.aidl_demo2); -// -// mActivity = this; -// -// mKeyringsTextView = (TextView) findViewById(R.id.aidl_demo_keyrings); -// -// mKeychainIntentHelper = new KeychainIntentHelper(mActivity); -// mKeychainData = new KeychainData(); -// -// bindService(new Intent(IKeychainKeyService.class.getName()), svcConn, -// Context.BIND_AUTO_CREATE); -// } -// -// public void getKeyringsStringsOnClick(View view) { -// try { -// service.getPublicKeyRings(mKeychainData.getPublicKeys(), true, getKeyringsHandler); -// } catch (RemoteException e) { -// exceptionImplementation(-1, e.toString()); -// } -// } -// -// public void getKeyringsBytesOnClick(View view) { -// try { -// service.getPublicKeyRings(mKeychainData.getPublicKeys(), false, getKeyringsHandler); -// } catch (RemoteException e) { -// exceptionImplementation(-1, e.toString()); -// } -// } -// -// @SuppressLint("NewApi") -// private void updateView() { -// if (keysBytes != null) { -// mKeyringsTextView.setText(Base64.encodeToString(keysBytes, Base64.DEFAULT)); -// } else if (keysStrings != null) { -// mKeyringsTextView.setText(""); -// for (String output : keysStrings) { -// mKeyringsTextView.append(output); -// } -// } -// } -// -// @Override -// public void onDestroy() { -// super.onDestroy(); -// -// unbindService(svcConn); -// } -// -// private void exceptionImplementation(int exceptionId, String error) { -// AlertDialog.Builder builder = new AlertDialog.Builder(this); -// builder.setTitle("Exception!").setMessage(error).setPositiveButton("OK", null).show(); -// } -// -// private final IKeychainGetKeyringsHandler.Stub getKeyringsHandler = new IKeychainGetKeyringsHandler.Stub() { -// -// @Override -// public void onException(final int exceptionId, final String message) throws RemoteException { -// runOnUiThread(new Runnable() { -// public void run() { -// exceptionImplementation(exceptionId, message); -// } -// }); -// } -// -// @Override -// public void onSuccess(final byte[] outputBytes, final List outputStrings) -// throws RemoteException { -// runOnUiThread(new Runnable() { -// public void run() { -// if (outputBytes != null) { -// keysBytes = outputBytes; -// keysStrings = null; -// } else if (outputStrings != null) { -// keysBytes = null; -// keysStrings = (ArrayList) outputStrings; -// } -// updateView(); -// } -// }); -// -// } -// -// }; -// -// public void selectEncryptionKeysOnClick(View view) { -// mKeychainIntentHelper.selectPublicKeys("user@example.com"); -// } -// -// @Override -// protected void onActivityResult(int requestCode, int resultCode, Intent data) { -// // this updates the mKeychainData object to the result of the methods -// boolean result = mKeychainIntentHelper.onActivityResult(requestCode, resultCode, data, -// mKeychainData); -// if (result) { -// updateView(); -// } -// -// // continue with other activity results -// super.onActivityResult(requestCode, resultCode, data); -// } -// -//} diff --git a/OpenPGP-Keychain-API-Demo/src/main/java/org/sufficientlysecure/keychain/demo/BaseActivity.java b/OpenPGP-Keychain-API-Demo/src/main/java/org/sufficientlysecure/keychain/demo/BaseActivity.java deleted file mode 100644 index 5b286f208..000000000 --- a/OpenPGP-Keychain-API-Demo/src/main/java/org/sufficientlysecure/keychain/demo/BaseActivity.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (C) 2012 Dominik Schürmann - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.sufficientlysecure.keychain.demo; - -import org.sufficientlysecure.keychain.demo.R; - -import android.app.Activity; -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 Activity mActivity; - - private Preference mIntentDemo; - private Preference mContentProviderDemo; - private Preference mCryptoProvider; - private Preference mAidlDemo; - private Preference mAidlDemo2; - - /** - * Called when the activity is first created. - */ - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - mActivity = this; - - // load preferences from xml - addPreferencesFromResource(R.xml.base_preference); - - // find preferences - mIntentDemo = (Preference) findPreference("intent_demo"); - mContentProviderDemo = (Preference) findPreference("content_provider_demo"); - mCryptoProvider = (Preference) findPreference("openpgp_provider_demo"); - mAidlDemo = (Preference) findPreference("aidl_demo"); - mAidlDemo2 = (Preference) findPreference("aidl_demo2"); - - mIntentDemo.setOnPreferenceClickListener(new OnPreferenceClickListener() { - @Override - public boolean onPreferenceClick(Preference preference) { - // startActivity(new Intent(mActivity, IntentDemoActivity.class)); - Toast.makeText(BaseActivity.this, "Not implemented!", Toast.LENGTH_LONG).show(); - - return false; - } - }); - - mCryptoProvider.setOnPreferenceClickListener(new OnPreferenceClickListener() { - @Override - public boolean onPreferenceClick(Preference preference) { - startActivity(new Intent(mActivity, OpenPgpProviderActivity.class)); - - return false; - } - }); - - // mAidlDemo2.setOnPreferenceClickListener(new OnPreferenceClickListener() { - // @Override - // public boolean onPreferenceClick(Preference preference) { - // startActivity(new Intent(mActivity, AidlDemoActivity2.class)); - // - // return false; - // } - // }); - - } - -} diff --git a/OpenPGP-Keychain-API-Demo/src/main/java/org/sufficientlysecure/keychain/demo/Constants.java b/OpenPGP-Keychain-API-Demo/src/main/java/org/sufficientlysecure/keychain/demo/Constants.java deleted file mode 100644 index 03e76254c..000000000 --- a/OpenPGP-Keychain-API-Demo/src/main/java/org/sufficientlysecure/keychain/demo/Constants.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (C) 2013 Dominik Schürmann - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.sufficientlysecure.keychain.demo; - -public final class Constants { - - public static final boolean DEBUG = BuildConfig.DEBUG; - - public static final String TAG = "Keychain"; - -} diff --git a/OpenPGP-Keychain-API-Demo/src/main/java/org/sufficientlysecure/keychain/demo/OpenPgpProviderActivity.java b/OpenPGP-Keychain-API-Demo/src/main/java/org/sufficientlysecure/keychain/demo/OpenPgpProviderActivity.java deleted file mode 100644 index 4a96de5a1..000000000 --- a/OpenPGP-Keychain-API-Demo/src/main/java/org/sufficientlysecure/keychain/demo/OpenPgpProviderActivity.java +++ /dev/null @@ -1,352 +0,0 @@ -/* - * Copyright (C) 2013 Dominik Schürmann - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.sufficientlysecure.keychain.demo; - -import java.util.ArrayList; -import java.util.List; - -import org.openintents.openpgp.IOpenPgpKeyIdsCallback; -import org.openintents.openpgp.OpenPgpData; -import org.openintents.openpgp.OpenPgpError; -import org.openintents.openpgp.OpenPgpServiceConnection; -import org.openintents.openpgp.OpenPgpSignatureResult; -import org.openintents.openpgp.IOpenPgpCallback; -import org.openintents.openpgp.IOpenPgpService; - -import android.app.Activity; -import android.app.AlertDialog; -import android.content.DialogInterface; -import android.content.Intent; -import android.content.pm.ResolveInfo; -import android.graphics.drawable.Drawable; -import android.os.Bundle; -import android.os.RemoteException; -import android.util.Log; -import android.view.View; -import android.view.ViewGroup; -import android.widget.ArrayAdapter; -import android.widget.EditText; -import android.widget.ListAdapter; -import android.widget.TextView; -import android.widget.Toast; - -public class OpenPgpProviderActivity extends Activity { - Activity mActivity; - - EditText mMessage; - EditText mCiphertext; - EditText mEncryptUserIds; - - private OpenPgpServiceConnection mCryptoServiceConnection; - - @Override - public void onCreate(Bundle icicle) { - super.onCreate(icicle); - setContentView(R.layout.crypto_provider_demo); - - mActivity = this; - - mMessage = (EditText) findViewById(R.id.crypto_provider_demo_message); - mCiphertext = (EditText) findViewById(R.id.crypto_provider_demo_ciphertext); - mEncryptUserIds = (EditText) findViewById(R.id.crypto_provider_demo_encrypt_user_id); - - selectCryptoProvider(); - } - - /** - * Callback from remote openpgp service - */ - final IOpenPgpKeyIdsCallback.Stub getKeysEncryptCallback = new IOpenPgpKeyIdsCallback.Stub() { - - @Override - public void onSuccess(final long[] keyIds) throws RemoteException { - Log.d(Constants.TAG, "getKeysEncryptCallback keyId " + keyIds[0]); - mActivity.runOnUiThread(new Runnable() { - - @Override - public void run() { - // encrypt after getting key ids - String inputStr = mMessage.getText().toString(); - OpenPgpData input = new OpenPgpData(inputStr); - - Log.d(Constants.TAG, "getKeysEncryptCallback inputStr " + inputStr); - - try { - mCryptoServiceConnection.getService().encrypt(input, - new OpenPgpData(OpenPgpData.TYPE_STRING), keyIds, encryptCallback); - } catch (RemoteException e) { - Log.e(Constants.TAG, "CryptoProviderDemo", e); - } - } - }); - } - - @Override - public void onError(OpenPgpError error) throws RemoteException { - handleError(error); - } - - }; - - final IOpenPgpKeyIdsCallback.Stub getKeysSignAndEncryptCallback = new IOpenPgpKeyIdsCallback.Stub() { - - @Override - public void onSuccess(final long[] keyIds) throws RemoteException { - Log.d(Constants.TAG, "getKeysSignAndEncryptCallback keyId " + keyIds[0]); - - mActivity.runOnUiThread(new Runnable() { - - @Override - public void run() { - // encrypt after getting key ids - String inputStr = mMessage.getText().toString(); - OpenPgpData input = new OpenPgpData(inputStr); - - try { - mCryptoServiceConnection.getService().signAndEncrypt(input, - new OpenPgpData(OpenPgpData.TYPE_STRING), keyIds, encryptCallback); - } catch (RemoteException e) { - Log.e(Constants.TAG, "CryptoProviderDemo", e); - } - } - }); - } - - @Override - public void onError(OpenPgpError error) throws RemoteException { - handleError(error); - } - - }; - - final IOpenPgpCallback.Stub encryptCallback = new IOpenPgpCallback.Stub() { - - @Override - public void onSuccess(final OpenPgpData output, OpenPgpSignatureResult signatureResult) - throws RemoteException { - Log.d(Constants.TAG, "encryptCallback"); - - runOnUiThread(new Runnable() { - - @Override - public void run() { - mCiphertext.setText(output.getString()); - } - }); - } - - @Override - public void onError(OpenPgpError error) throws RemoteException { - handleError(error); - } - - }; - - final IOpenPgpCallback.Stub decryptAndVerifyCallback = new IOpenPgpCallback.Stub() { - - @Override - public void onSuccess(final OpenPgpData output, final OpenPgpSignatureResult signatureResult) - throws RemoteException { - Log.d(Constants.TAG, "decryptAndVerifyCallback"); - - runOnUiThread(new Runnable() { - - @Override - public void run() { - mMessage.setText(output.getString()); - if (signatureResult != null) { - Toast.makeText(OpenPgpProviderActivity.this, - "signature result:\n" + signatureResult.toString(), - Toast.LENGTH_LONG).show(); - } - } - }); - - } - - @Override - public void onError(OpenPgpError error) throws RemoteException { - handleError(error); - } - - }; - - private void handleError(final OpenPgpError error) { - mActivity.runOnUiThread(new Runnable() { - - @Override - public void run() { - Toast.makeText(mActivity, - "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()); - } - }); - } - - public void encryptOnClick(View view) { - try { - mCryptoServiceConnection.getService().getKeyIds( - mEncryptUserIds.getText().toString().split(","), true, getKeysEncryptCallback); - } catch (RemoteException e) { - Log.e(Constants.TAG, "CryptoProviderDemo", e); - } - } - - public void signOnClick(View view) { - String inputStr = mMessage.getText().toString(); - OpenPgpData input = new OpenPgpData(inputStr); - - try { - mCryptoServiceConnection.getService().sign(input, - new OpenPgpData(OpenPgpData.TYPE_STRING), encryptCallback); - } catch (RemoteException e) { - Log.e(Constants.TAG, "CryptoProviderDemo", e); - } - } - - public void signAndEncryptOnClick(View view) { - try { - mCryptoServiceConnection.getService().getKeyIds( - mEncryptUserIds.getText().toString().split(","), true, - getKeysSignAndEncryptCallback); - } catch (RemoteException e) { - Log.e(Constants.TAG, "CryptoProviderDemo", e); - } - } - - public void decryptAndVerifyOnClick(View view) { - String inputStr = mCiphertext.getText().toString(); - OpenPgpData input = new OpenPgpData(inputStr); - - try { - mCryptoServiceConnection.getService().decryptAndVerify(input, - new OpenPgpData(OpenPgpData.TYPE_STRING), decryptAndVerifyCallback); - } catch (RemoteException e) { - Log.e(Constants.TAG, "CryptoProviderDemo", e); - } - } - - @Override - public void onDestroy() { - super.onDestroy(); - - if (mCryptoServiceConnection != null) { - mCryptoServiceConnection.unbindFromService(); - } - } - - private static class OpenPgpProviderElement { - private String packageName; - private String simpleName; - private Drawable icon; - - public OpenPgpProviderElement(String packageName, String simpleName, Drawable icon) { - this.packageName = packageName; - this.simpleName = simpleName; - this.icon = icon; - } - - @Override - public String toString() { - return simpleName; - } - } - - private void selectCryptoProvider() { - Intent intent = new Intent(IOpenPgpService.class.getName()); - - final ArrayList providerList = new ArrayList(); - - List resInfo = getPackageManager().queryIntentServices(intent, 0); - if (!resInfo.isEmpty()) { - for (ResolveInfo resolveInfo : resInfo) { - if (resolveInfo.serviceInfo == null) - continue; - - String packageName = resolveInfo.serviceInfo.packageName; - String simpleName = String.valueOf(resolveInfo.serviceInfo - .loadLabel(getPackageManager())); - Drawable icon = resolveInfo.serviceInfo.loadIcon(getPackageManager()); - providerList.add(new OpenPgpProviderElement(packageName, simpleName, icon)); - } - } - - AlertDialog.Builder alert = new AlertDialog.Builder(this); - alert.setTitle("Select OpenPGP Provider!"); - alert.setCancelable(false); - - if (!providerList.isEmpty()) { - // add "disable OpenPGP provider" - providerList.add(0, new OpenPgpProviderElement(null, "Disable OpenPGP Provider", - getResources().getDrawable(android.R.drawable.ic_menu_close_clear_cancel))); - - // Init ArrayAdapter with OpenPGP Providers - ListAdapter adapter = new ArrayAdapter(this, - android.R.layout.select_dialog_item, android.R.id.text1, providerList) { - public View getView(int position, View convertView, ViewGroup parent) { - // User super class to create the View - View v = super.getView(position, convertView, parent); - TextView tv = (TextView) v.findViewById(android.R.id.text1); - - // Put the image on the TextView - tv.setCompoundDrawablesWithIntrinsicBounds(providerList.get(position).icon, - null, null, null); - - // Add margin between image and text (support various screen densities) - int dp5 = (int) (5 * getResources().getDisplayMetrics().density + 0.5f); - tv.setCompoundDrawablePadding(dp5); - - return v; - } - }; - - alert.setSingleChoiceItems(adapter, -1, new DialogInterface.OnClickListener() { - - public void onClick(DialogInterface dialog, int position) { - String packageName = providerList.get(position).packageName; - - if (packageName == null) { - dialog.cancel(); - finish(); - } - - // bind to service - mCryptoServiceConnection = new OpenPgpServiceConnection( - OpenPgpProviderActivity.this, packageName); - mCryptoServiceConnection.bindToService(); - - dialog.dismiss(); - } - }); - } else { - alert.setMessage("No OpenPGP Provider installed!"); - } - - alert.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { - - public void onClick(DialogInterface dialog, int id) { - dialog.cancel(); - finish(); - } - }); - - AlertDialog ad = alert.create(); - ad.show(); - } -} diff --git a/OpenPGP-Keychain-API-Demo/src/main/res/drawable-hdpi/ic_launcher.png b/OpenPGP-Keychain-API-Demo/src/main/res/drawable-hdpi/ic_launcher.png deleted file mode 100644 index cf114d7db..000000000 Binary files a/OpenPGP-Keychain-API-Demo/src/main/res/drawable-hdpi/ic_launcher.png and /dev/null differ diff --git a/OpenPGP-Keychain-API-Demo/src/main/res/drawable-mdpi/ic_launcher.png b/OpenPGP-Keychain-API-Demo/src/main/res/drawable-mdpi/ic_launcher.png deleted file mode 100644 index d55318843..000000000 Binary files a/OpenPGP-Keychain-API-Demo/src/main/res/drawable-mdpi/ic_launcher.png and /dev/null differ diff --git a/OpenPGP-Keychain-API-Demo/src/main/res/drawable-xhdpi/ic_launcher.png b/OpenPGP-Keychain-API-Demo/src/main/res/drawable-xhdpi/ic_launcher.png deleted file mode 100644 index 13ed3d450..000000000 Binary files a/OpenPGP-Keychain-API-Demo/src/main/res/drawable-xhdpi/ic_launcher.png and /dev/null differ diff --git a/OpenPGP-Keychain-API-Demo/src/main/res/drawable-xxhdpi/ic_launcher.png b/OpenPGP-Keychain-API-Demo/src/main/res/drawable-xxhdpi/ic_launcher.png deleted file mode 100644 index 831c993d4..000000000 Binary files a/OpenPGP-Keychain-API-Demo/src/main/res/drawable-xxhdpi/ic_launcher.png and /dev/null differ diff --git a/OpenPGP-Keychain-API-Demo/src/main/res/layout/aidl_demo2.xml b/OpenPGP-Keychain-API-Demo/src/main/res/layout/aidl_demo2.xml deleted file mode 100644 index 73abd9b5c..000000000 --- a/OpenPGP-Keychain-API-Demo/src/main/res/layout/aidl_demo2.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - -