diff --git a/OpenPGP-Keychain-API-Demo/.gitignore b/OpenPGP-Keychain-API/.gitignore similarity index 100% rename from OpenPGP-Keychain-API-Demo/.gitignore rename to OpenPGP-Keychain-API/.gitignore diff --git a/OpenPGP-Keychain-API/build.gradle b/OpenPGP-Keychain-API/build.gradle new file mode 100644 index 000000000..2e41492a3 --- /dev/null +++ b/OpenPGP-Keychain-API/build.gradle @@ -0,0 +1,3 @@ +task wrapper(type: Wrapper) { + gradleVersion = '1.10' +} \ No newline at end of file diff --git a/OpenPGP-Keychain-API-Demo/build.gradle b/OpenPGP-Keychain-API/example-app/build.gradle similarity index 96% rename from OpenPGP-Keychain-API-Demo/build.gradle rename to OpenPGP-Keychain-API/example-app/build.gradle index 025ff417b..99a09f094 100644 --- a/OpenPGP-Keychain-API-Demo/build.gradle +++ b/OpenPGP-Keychain-API/example-app/build.gradle @@ -10,12 +10,9 @@ buildscript { apply plugin: 'android' -repositories { - mavenCentral() -} - dependencies { compile 'com.android.support:support-v4:19.0.1' + compile project(':libraries:keychain-api-library') } android { diff --git a/OpenPGP-Keychain-API-Demo/ic_launcher-web.png b/OpenPGP-Keychain-API/example-app/ic_launcher-web.png similarity index 100% rename from OpenPGP-Keychain-API-Demo/ic_launcher-web.png rename to OpenPGP-Keychain-API/example-app/ic_launcher-web.png diff --git a/OpenPGP-Keychain-API-Demo/src/main/AndroidManifest.xml b/OpenPGP-Keychain-API/example-app/src/main/AndroidManifest.xml similarity index 100% rename from OpenPGP-Keychain-API-Demo/src/main/AndroidManifest.xml rename to OpenPGP-Keychain-API/example-app/src/main/AndroidManifest.xml diff --git a/OpenPGP-Keychain-API-Demo/src/main/java/org/sufficientlysecure/keychain/demo/AidlDemoActivity2.java b/OpenPGP-Keychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/AidlDemoActivity2.java similarity index 100% rename from OpenPGP-Keychain-API-Demo/src/main/java/org/sufficientlysecure/keychain/demo/AidlDemoActivity2.java rename to OpenPGP-Keychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/AidlDemoActivity2.java diff --git a/OpenPGP-Keychain-API-Demo/src/main/java/org/sufficientlysecure/keychain/demo/BaseActivity.java b/OpenPGP-Keychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/BaseActivity.java similarity index 100% rename from OpenPGP-Keychain-API-Demo/src/main/java/org/sufficientlysecure/keychain/demo/BaseActivity.java rename to OpenPGP-Keychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/BaseActivity.java diff --git a/OpenPGP-Keychain-API-Demo/src/main/java/org/sufficientlysecure/keychain/demo/Constants.java b/OpenPGP-Keychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/Constants.java similarity index 100% rename from OpenPGP-Keychain-API-Demo/src/main/java/org/sufficientlysecure/keychain/demo/Constants.java rename to OpenPGP-Keychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/Constants.java diff --git a/OpenPGP-Keychain-API-Demo/src/main/java/org/sufficientlysecure/keychain/demo/OpenPgpProviderActivity.java b/OpenPGP-Keychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/OpenPgpProviderActivity.java similarity index 100% rename from OpenPGP-Keychain-API-Demo/src/main/java/org/sufficientlysecure/keychain/demo/OpenPgpProviderActivity.java rename to OpenPGP-Keychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/OpenPgpProviderActivity.java diff --git a/OpenPGP-Keychain-API-Demo/src/main/res/drawable-hdpi/ic_launcher.png b/OpenPGP-Keychain-API/example-app/src/main/res/drawable-hdpi/ic_launcher.png similarity index 100% rename from OpenPGP-Keychain-API-Demo/src/main/res/drawable-hdpi/ic_launcher.png rename to OpenPGP-Keychain-API/example-app/src/main/res/drawable-hdpi/ic_launcher.png diff --git a/OpenPGP-Keychain-API-Demo/src/main/res/drawable-mdpi/ic_launcher.png b/OpenPGP-Keychain-API/example-app/src/main/res/drawable-mdpi/ic_launcher.png similarity index 100% rename from OpenPGP-Keychain-API-Demo/src/main/res/drawable-mdpi/ic_launcher.png rename to OpenPGP-Keychain-API/example-app/src/main/res/drawable-mdpi/ic_launcher.png diff --git a/OpenPGP-Keychain-API-Demo/src/main/res/drawable-xhdpi/ic_launcher.png b/OpenPGP-Keychain-API/example-app/src/main/res/drawable-xhdpi/ic_launcher.png similarity index 100% rename from OpenPGP-Keychain-API-Demo/src/main/res/drawable-xhdpi/ic_launcher.png rename to OpenPGP-Keychain-API/example-app/src/main/res/drawable-xhdpi/ic_launcher.png diff --git a/OpenPGP-Keychain-API-Demo/src/main/res/drawable-xxhdpi/ic_launcher.png b/OpenPGP-Keychain-API/example-app/src/main/res/drawable-xxhdpi/ic_launcher.png similarity index 100% rename from OpenPGP-Keychain-API-Demo/src/main/res/drawable-xxhdpi/ic_launcher.png rename to OpenPGP-Keychain-API/example-app/src/main/res/drawable-xxhdpi/ic_launcher.png diff --git a/OpenPGP-Keychain-API-Demo/src/main/res/layout/aidl_demo2.xml b/OpenPGP-Keychain-API/example-app/src/main/res/layout/aidl_demo2.xml similarity index 100% rename from OpenPGP-Keychain-API-Demo/src/main/res/layout/aidl_demo2.xml rename to OpenPGP-Keychain-API/example-app/src/main/res/layout/aidl_demo2.xml diff --git a/OpenPGP-Keychain-API-Demo/src/main/res/layout/crypto_provider_demo.xml b/OpenPGP-Keychain-API/example-app/src/main/res/layout/crypto_provider_demo.xml similarity index 100% rename from OpenPGP-Keychain-API-Demo/src/main/res/layout/crypto_provider_demo.xml rename to OpenPGP-Keychain-API/example-app/src/main/res/layout/crypto_provider_demo.xml diff --git a/OpenPGP-Keychain-API-Demo/src/main/res/layout/intent_demo.xml b/OpenPGP-Keychain-API/example-app/src/main/res/layout/intent_demo.xml similarity index 100% rename from OpenPGP-Keychain-API-Demo/src/main/res/layout/intent_demo.xml rename to OpenPGP-Keychain-API/example-app/src/main/res/layout/intent_demo.xml diff --git a/OpenPGP-Keychain-API-Demo/src/main/res/xml/base_preference.xml b/OpenPGP-Keychain-API/example-app/src/main/res/xml/base_preference.xml similarity index 100% rename from OpenPGP-Keychain-API-Demo/src/main/res/xml/base_preference.xml rename to OpenPGP-Keychain-API/example-app/src/main/res/xml/base_preference.xml diff --git a/OpenPGP-Keychain-API-Demo/gradle/wrapper/gradle-wrapper.jar b/OpenPGP-Keychain-API/gradle/gradle/wrapper/gradle-wrapper.jar similarity index 85% rename from OpenPGP-Keychain-API-Demo/gradle/wrapper/gradle-wrapper.jar rename to OpenPGP-Keychain-API/gradle/gradle/wrapper/gradle-wrapper.jar index d5c591c9c..583859812 100644 Binary files a/OpenPGP-Keychain-API-Demo/gradle/wrapper/gradle-wrapper.jar and b/OpenPGP-Keychain-API/gradle/gradle/wrapper/gradle-wrapper.jar differ diff --git a/OpenPGP-Keychain-API-Demo/gradle/wrapper/gradle-wrapper.properties b/OpenPGP-Keychain-API/gradle/gradle/wrapper/gradle-wrapper.properties similarity index 80% rename from OpenPGP-Keychain-API-Demo/gradle/wrapper/gradle-wrapper.properties rename to OpenPGP-Keychain-API/gradle/gradle/wrapper/gradle-wrapper.properties index e3efa88f1..42c0fbd9d 100644 --- a/OpenPGP-Keychain-API-Demo/gradle/wrapper/gradle-wrapper.properties +++ b/OpenPGP-Keychain-API/gradle/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Mon Jan 27 14:45:08 CET 2014 +#Sun Feb 09 19:19:25 CET 2014 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=http\://services.gradle.org/distributions/gradle-1.9-bin.zip +distributionUrl=http\://services.gradle.org/distributions/gradle-1.10-bin.zip diff --git a/OpenPGP-Keychain-API-Demo/gradlew b/OpenPGP-Keychain-API/gradle/gradlew similarity index 100% rename from OpenPGP-Keychain-API-Demo/gradlew rename to OpenPGP-Keychain-API/gradle/gradlew diff --git a/OpenPGP-Keychain-API-Demo/gradlew.bat b/OpenPGP-Keychain-API/gradle/gradlew.bat similarity index 100% rename from OpenPGP-Keychain-API-Demo/gradlew.bat rename to OpenPGP-Keychain-API/gradle/gradlew.bat diff --git a/OpenPGP-Keychain-API/gradle/wrapper/gradle-wrapper.jar b/OpenPGP-Keychain-API/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 000000000..583859812 Binary files /dev/null and b/OpenPGP-Keychain-API/gradle/wrapper/gradle-wrapper.jar differ diff --git a/OpenPGP-Keychain-API/gradle/wrapper/gradle-wrapper.properties b/OpenPGP-Keychain-API/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 000000000..425cd64c7 --- /dev/null +++ b/OpenPGP-Keychain-API/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Sun Feb 09 19:10:32 CET 2014 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=http\://services.gradle.org/distributions/gradle-1.10-bin.zip diff --git a/OpenPGP-Keychain-API/gradlew b/OpenPGP-Keychain-API/gradlew new file mode 100755 index 000000000..91a7e269e --- /dev/null +++ b/OpenPGP-Keychain-API/gradlew @@ -0,0 +1,164 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# For Cygwin, ensure paths are in UNIX format before anything is touched. +if $cygwin ; then + [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` +fi + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >&- +APP_HOME="`pwd -P`" +cd "$SAVED" >&- + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/OpenPGP-Keychain-API/gradlew.bat b/OpenPGP-Keychain-API/gradlew.bat new file mode 100644 index 000000000..aec99730b --- /dev/null +++ b/OpenPGP-Keychain-API/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/OpenPGP-Keychain-API/libraries/keychain-api-library/.gitignore b/OpenPGP-Keychain-API/libraries/keychain-api-library/.gitignore new file mode 100644 index 000000000..aa8bb5760 --- /dev/null +++ b/OpenPGP-Keychain-API/libraries/keychain-api-library/.gitignore @@ -0,0 +1,29 @@ +#Android specific +bin +gen +obj +lint.xml +local.properties +release.properties +ant.properties +*.class +*.apk + +#Gradle +.gradle +build +gradle.properties + +#Maven +target +pom.xml.* + +#Eclipse +.project +.classpath +.settings +.metadata + +#IntelliJ IDEA +.idea +*.iml diff --git a/OpenPGP-Keychain-API/libraries/keychain-api-library/LICENSE b/OpenPGP-Keychain-API/libraries/keychain-api-library/LICENSE new file mode 100644 index 000000000..d64569567 --- /dev/null +++ b/OpenPGP-Keychain-API/libraries/keychain-api-library/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/OpenPGP-Keychain-API/libraries/keychain-api-library/build.gradle b/OpenPGP-Keychain-API/libraries/keychain-api-library/build.gradle new file mode 100644 index 000000000..2eacd2065 --- /dev/null +++ b/OpenPGP-Keychain-API/libraries/keychain-api-library/build.gradle @@ -0,0 +1,21 @@ +buildscript { + repositories { + mavenCentral() + } + + dependencies { + classpath 'com.android.tools.build:gradle:0.8.0' + } +} + +apply plugin: 'android-library' + +android { + compileSdkVersion 19 + buildToolsVersion '19.0.1' + + // Do not abort build if lint finds errors + lintOptions { + abortOnError false + } +} diff --git a/OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/AndroidManifest.xml b/OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/AndroidManifest.xml new file mode 100644 index 000000000..32b4a82e5 --- /dev/null +++ b/OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/AndroidManifest.xml @@ -0,0 +1,13 @@ + + + + + + + + \ 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/libraries/keychain-api-library/src/main/aidl/org/openintents/openpgp/IOpenPgpCallback.aidl similarity index 100% rename from OpenPGP-Keychain-API-Demo/src/main/aidl/org/openintents/openpgp/IOpenPgpCallback.aidl rename to OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/aidl/org/openintents/openpgp/IOpenPgpCallback.aidl diff --git a/OpenPGP-Keychain-API-Demo/src/main/aidl/org/openintents/openpgp/IOpenPgpKeyIdsCallback.aidl b/OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/aidl/org/openintents/openpgp/IOpenPgpKeyIdsCallback.aidl similarity index 100% rename from OpenPGP-Keychain-API-Demo/src/main/aidl/org/openintents/openpgp/IOpenPgpKeyIdsCallback.aidl rename to OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/aidl/org/openintents/openpgp/IOpenPgpKeyIdsCallback.aidl diff --git a/OpenPGP-Keychain-API-Demo/src/main/aidl/org/openintents/openpgp/IOpenPgpService.aidl b/OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/aidl/org/openintents/openpgp/IOpenPgpService.aidl similarity index 100% rename from OpenPGP-Keychain-API-Demo/src/main/aidl/org/openintents/openpgp/IOpenPgpService.aidl rename to OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/aidl/org/openintents/openpgp/IOpenPgpService.aidl diff --git a/OpenPGP-Keychain-API-Demo/src/main/aidl/org/openintents/openpgp/OpenPgpData.aidl b/OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/aidl/org/openintents/openpgp/OpenPgpData.aidl similarity index 100% rename from OpenPGP-Keychain-API-Demo/src/main/aidl/org/openintents/openpgp/OpenPgpData.aidl rename to OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/aidl/org/openintents/openpgp/OpenPgpData.aidl diff --git a/OpenPGP-Keychain-API-Demo/src/main/aidl/org/openintents/openpgp/OpenPgpError.aidl b/OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/aidl/org/openintents/openpgp/OpenPgpError.aidl similarity index 100% rename from OpenPGP-Keychain-API-Demo/src/main/aidl/org/openintents/openpgp/OpenPgpError.aidl rename to OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/aidl/org/openintents/openpgp/OpenPgpError.aidl diff --git a/OpenPGP-Keychain-API-Demo/src/main/aidl/org/openintents/openpgp/OpenPgpSignatureResult.aidl b/OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/aidl/org/openintents/openpgp/OpenPgpSignatureResult.aidl similarity index 100% rename from OpenPGP-Keychain-API-Demo/src/main/aidl/org/openintents/openpgp/OpenPgpSignatureResult.aidl rename to OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/aidl/org/openintents/openpgp/OpenPgpSignatureResult.aidl diff --git a/OpenPGP-Keychain/src/main/aidl/org/sufficientlysecure/keychain/service/remote/IExtendedApiCallback.aidl b/OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/aidl/org/sufficientlysecure/keychain/service/remote/IExtendedApiCallback.aidl similarity index 100% rename from OpenPGP-Keychain/src/main/aidl/org/sufficientlysecure/keychain/service/remote/IExtendedApiCallback.aidl rename to OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/aidl/org/sufficientlysecure/keychain/service/remote/IExtendedApiCallback.aidl diff --git a/OpenPGP-Keychain/src/main/aidl/org/sufficientlysecure/keychain/service/remote/IExtendedApiService.aidl b/OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/aidl/org/sufficientlysecure/keychain/service/remote/IExtendedApiService.aidl similarity index 100% rename from OpenPGP-Keychain/src/main/aidl/org/sufficientlysecure/keychain/service/remote/IExtendedApiService.aidl rename to OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/aidl/org/sufficientlysecure/keychain/service/remote/IExtendedApiService.aidl diff --git a/OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/OpenPgpConstants.java b/OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/java/org/openintents/openpgp/OpenPgpConstants.java similarity index 100% rename from OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/OpenPgpConstants.java rename to OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/java/org/openintents/openpgp/OpenPgpConstants.java diff --git a/OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/OpenPgpData.java b/OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/java/org/openintents/openpgp/OpenPgpData.java similarity index 100% rename from OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/OpenPgpData.java rename to OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/java/org/openintents/openpgp/OpenPgpData.java diff --git a/OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/OpenPgpError.java b/OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/java/org/openintents/openpgp/OpenPgpError.java similarity index 100% rename from OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/OpenPgpError.java rename to OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/java/org/openintents/openpgp/OpenPgpError.java diff --git a/OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/OpenPgpHelper.java b/OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/java/org/openintents/openpgp/OpenPgpHelper.java similarity index 100% rename from OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/OpenPgpHelper.java rename to OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/java/org/openintents/openpgp/OpenPgpHelper.java diff --git a/OpenPGP-Keychain/src/main/java/org/openintents/openpgp/OpenPgpListPreference.java b/OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/java/org/openintents/openpgp/OpenPgpListPreference.java similarity index 100% rename from OpenPGP-Keychain/src/main/java/org/openintents/openpgp/OpenPgpListPreference.java rename to OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/java/org/openintents/openpgp/OpenPgpListPreference.java diff --git a/OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/OpenPgpServiceConnection.java b/OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/java/org/openintents/openpgp/OpenPgpServiceConnection.java similarity index 100% rename from OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/OpenPgpServiceConnection.java rename to OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/java/org/openintents/openpgp/OpenPgpServiceConnection.java diff --git a/OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/OpenPgpSignatureResult.java b/OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/java/org/openintents/openpgp/OpenPgpSignatureResult.java similarity index 100% rename from OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/OpenPgpSignatureResult.java rename to OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/java/org/openintents/openpgp/OpenPgpSignatureResult.java diff --git a/OpenPGP-Keychain-API/settings.gradle b/OpenPGP-Keychain-API/settings.gradle new file mode 100644 index 000000000..4df1d7b4f --- /dev/null +++ b/OpenPGP-Keychain-API/settings.gradle @@ -0,0 +1,2 @@ +include ':example-app' +include ':libraries:keychain-api-library' \ No newline at end of file diff --git a/OpenPGP-Keychain/build.gradle b/OpenPGP-Keychain/build.gradle index 44f5ca280..66c6a0e8f 100644 --- a/OpenPGP-Keychain/build.gradle +++ b/OpenPGP-Keychain/build.gradle @@ -3,6 +3,7 @@ apply plugin: 'android' dependencies { compile 'com.android.support:support-v4:19.0.1' compile 'com.android.support:appcompat-v7:19.0.1' + compile project(':libraries:keychain-api-library') compile project(':libraries:HtmlTextView') compile project(':libraries:StickyListHeaders:library') compile project(':libraries:AndroidBootstrap') diff --git a/OpenPGP-Keychain/src/main/aidl/org/openintents/openpgp/IOpenPgpCallback.aidl b/OpenPGP-Keychain/src/main/aidl/org/openintents/openpgp/IOpenPgpCallback.aidl deleted file mode 100644 index ba41de1ba..000000000 --- a/OpenPGP-Keychain/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/src/main/aidl/org/openintents/openpgp/IOpenPgpKeyIdsCallback.aidl b/OpenPGP-Keychain/src/main/aidl/org/openintents/openpgp/IOpenPgpKeyIdsCallback.aidl deleted file mode 100644 index 4ca356fad..000000000 --- a/OpenPGP-Keychain/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/src/main/aidl/org/openintents/openpgp/IOpenPgpService.aidl b/OpenPGP-Keychain/src/main/aidl/org/openintents/openpgp/IOpenPgpService.aidl deleted file mode 100644 index 8f9e8a0fd..000000000 --- a/OpenPGP-Keychain/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/src/main/aidl/org/openintents/openpgp/OpenPgpData.aidl b/OpenPGP-Keychain/src/main/aidl/org/openintents/openpgp/OpenPgpData.aidl deleted file mode 100644 index 3711e4fb4..000000000 --- a/OpenPGP-Keychain/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/src/main/aidl/org/openintents/openpgp/OpenPgpError.aidl b/OpenPGP-Keychain/src/main/aidl/org/openintents/openpgp/OpenPgpError.aidl deleted file mode 100644 index 7a6bed1e6..000000000 --- a/OpenPGP-Keychain/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/src/main/res/values/strings.xml b/OpenPGP-Keychain/src/main/res/values/strings.xml index ddc3c9789..059b6ca9e 100644 --- a/OpenPGP-Keychain/src/main/res/values/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values/strings.xml @@ -413,7 +413,7 @@ Encrypt to this contact - Certify this contact's key + Certify this contact\'s key Contacts diff --git a/build.gradle b/build.gradle index c5ca596fc..a84ab6b3c 100644 --- a/build.gradle +++ b/build.gradle @@ -16,4 +16,4 @@ allprojects { task wrapper(type: Wrapper) { gradleVersion = '1.10' -} +} \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ddc691c4f..9559bfd8b 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Wed Jan 29 01:43:20 CET 2014 +#Sun Feb 09 18:34:27 CET 2014 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=http\://services.gradle.org/distributions/gradle-1.10-bin.zip +distributionUrl=http\://services.gradle.org/distributions/gradle-1.10-all.zip diff --git a/libraries/keychain-api-library/.gitignore b/libraries/keychain-api-library/.gitignore new file mode 100644 index 000000000..aa8bb5760 --- /dev/null +++ b/libraries/keychain-api-library/.gitignore @@ -0,0 +1,29 @@ +#Android specific +bin +gen +obj +lint.xml +local.properties +release.properties +ant.properties +*.class +*.apk + +#Gradle +.gradle +build +gradle.properties + +#Maven +target +pom.xml.* + +#Eclipse +.project +.classpath +.settings +.metadata + +#IntelliJ IDEA +.idea +*.iml diff --git a/libraries/keychain-api-library/LICENSE b/libraries/keychain-api-library/LICENSE new file mode 100644 index 000000000..d64569567 --- /dev/null +++ b/libraries/keychain-api-library/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/libraries/keychain-api-library/build.gradle b/libraries/keychain-api-library/build.gradle new file mode 100644 index 000000000..5436ecd0a --- /dev/null +++ b/libraries/keychain-api-library/build.gradle @@ -0,0 +1,12 @@ +apply plugin: 'android-library' + + +android { + compileSdkVersion 19 + buildToolsVersion '19.0.1' + + // Do not abort build if lint finds errors + lintOptions { + abortOnError false + } +} diff --git a/libraries/keychain-api-library/src/main/AndroidManifest.xml b/libraries/keychain-api-library/src/main/AndroidManifest.xml new file mode 100644 index 000000000..32b4a82e5 --- /dev/null +++ b/libraries/keychain-api-library/src/main/AndroidManifest.xml @@ -0,0 +1,13 @@ + + + + + + + + \ No newline at end of file diff --git a/OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/IOpenPgpCallback.aidl b/libraries/keychain-api-library/src/main/aidl/org/openintents/openpgp/IOpenPgpCallback.aidl similarity index 100% rename from OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/IOpenPgpCallback.aidl rename to libraries/keychain-api-library/src/main/aidl/org/openintents/openpgp/IOpenPgpCallback.aidl diff --git a/OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/IOpenPgpKeyIdsCallback.aidl b/libraries/keychain-api-library/src/main/aidl/org/openintents/openpgp/IOpenPgpKeyIdsCallback.aidl similarity index 100% rename from OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/IOpenPgpKeyIdsCallback.aidl rename to libraries/keychain-api-library/src/main/aidl/org/openintents/openpgp/IOpenPgpKeyIdsCallback.aidl diff --git a/OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/IOpenPgpService.aidl b/libraries/keychain-api-library/src/main/aidl/org/openintents/openpgp/IOpenPgpService.aidl similarity index 100% rename from OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/IOpenPgpService.aidl rename to libraries/keychain-api-library/src/main/aidl/org/openintents/openpgp/IOpenPgpService.aidl diff --git a/OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/OpenPgpData.aidl b/libraries/keychain-api-library/src/main/aidl/org/openintents/openpgp/OpenPgpData.aidl similarity index 100% rename from OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/OpenPgpData.aidl rename to libraries/keychain-api-library/src/main/aidl/org/openintents/openpgp/OpenPgpData.aidl diff --git a/OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/OpenPgpError.aidl b/libraries/keychain-api-library/src/main/aidl/org/openintents/openpgp/OpenPgpError.aidl similarity index 100% rename from OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/OpenPgpError.aidl rename to libraries/keychain-api-library/src/main/aidl/org/openintents/openpgp/OpenPgpError.aidl diff --git a/OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/OpenPgpSignatureResult.aidl b/libraries/keychain-api-library/src/main/aidl/org/openintents/openpgp/OpenPgpSignatureResult.aidl similarity index 100% rename from OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/OpenPgpSignatureResult.aidl rename to libraries/keychain-api-library/src/main/aidl/org/openintents/openpgp/OpenPgpSignatureResult.aidl diff --git a/OpenPGP-Keychain/src/main/aidl/org/openintents/openpgp/OpenPgpSignatureResult.aidl b/libraries/keychain-api-library/src/main/aidl/org/sufficientlysecure/keychain/service/remote/IExtendedApiCallback.aidl similarity index 77% rename from OpenPGP-Keychain/src/main/aidl/org/openintents/openpgp/OpenPgpSignatureResult.aidl rename to libraries/keychain-api-library/src/main/aidl/org/sufficientlysecure/keychain/service/remote/IExtendedApiCallback.aidl index e246792d0..f69f66fd7 100644 --- a/OpenPGP-Keychain/src/main/aidl/org/openintents/openpgp/OpenPgpSignatureResult.aidl +++ b/libraries/keychain-api-library/src/main/aidl/org/sufficientlysecure/keychain/service/remote/IExtendedApiCallback.aidl @@ -13,8 +13,12 @@ * 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 +package org.sufficientlysecure.keychain.service.remote; + +interface IExtendedApiCallback { + + oneway void onSuccess(in byte[] outputBytes); + + oneway void onError(in String error); +} \ No newline at end of file diff --git a/libraries/keychain-api-library/src/main/aidl/org/sufficientlysecure/keychain/service/remote/IExtendedApiService.aidl b/libraries/keychain-api-library/src/main/aidl/org/sufficientlysecure/keychain/service/remote/IExtendedApiService.aidl new file mode 100644 index 000000000..669bd31b5 --- /dev/null +++ b/libraries/keychain-api-library/src/main/aidl/org/sufficientlysecure/keychain/service/remote/IExtendedApiService.aidl @@ -0,0 +1,48 @@ +/* + * 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.service.remote; + +import org.sufficientlysecure.keychain.service.remote.IExtendedApiCallback; + +/** + * 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 IExtendedApiService { + + /** + * Symmetric Encrypt + * + * @param inputBytes + * Byte array you want to encrypt + * @param passphrase + * symmetric passhprase + * @param callback + * Callback where to return results + */ + oneway void encrypt(in byte[] inputBytes, in String passphrase, in IExtendedApiCallback callback); + + /** + * Generates self signed X509 certificate signed by OpenPGP private key (from app settings) + * + * @param subjAltNameURI + * @param callback + * Callback where to return results + */ + oneway void selfSignedX509Cert(in String subjAltNameURI, in IExtendedApiCallback callback); + +} \ No newline at end of file diff --git a/OpenPGP-Keychain/src/main/java/org/openintents/openpgp/OpenPgpConstants.java b/libraries/keychain-api-library/src/main/java/org/openintents/openpgp/OpenPgpConstants.java similarity index 100% rename from OpenPGP-Keychain/src/main/java/org/openintents/openpgp/OpenPgpConstants.java rename to libraries/keychain-api-library/src/main/java/org/openintents/openpgp/OpenPgpConstants.java diff --git a/OpenPGP-Keychain/src/main/java/org/openintents/openpgp/OpenPgpData.java b/libraries/keychain-api-library/src/main/java/org/openintents/openpgp/OpenPgpData.java similarity index 100% rename from OpenPGP-Keychain/src/main/java/org/openintents/openpgp/OpenPgpData.java rename to libraries/keychain-api-library/src/main/java/org/openintents/openpgp/OpenPgpData.java diff --git a/OpenPGP-Keychain/src/main/java/org/openintents/openpgp/OpenPgpError.java b/libraries/keychain-api-library/src/main/java/org/openintents/openpgp/OpenPgpError.java similarity index 100% rename from OpenPGP-Keychain/src/main/java/org/openintents/openpgp/OpenPgpError.java rename to libraries/keychain-api-library/src/main/java/org/openintents/openpgp/OpenPgpError.java diff --git a/OpenPGP-Keychain/src/main/java/org/openintents/openpgp/OpenPgpHelper.java b/libraries/keychain-api-library/src/main/java/org/openintents/openpgp/OpenPgpHelper.java similarity index 100% rename from OpenPGP-Keychain/src/main/java/org/openintents/openpgp/OpenPgpHelper.java rename to libraries/keychain-api-library/src/main/java/org/openintents/openpgp/OpenPgpHelper.java diff --git a/OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/OpenPgpListPreference.java b/libraries/keychain-api-library/src/main/java/org/openintents/openpgp/OpenPgpListPreference.java similarity index 98% rename from OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/OpenPgpListPreference.java rename to libraries/keychain-api-library/src/main/java/org/openintents/openpgp/OpenPgpListPreference.java index c8e709df9..4ddd97485 100644 --- a/OpenPGP-Keychain-API-Demo/src/main/java/org/openintents/openpgp/OpenPgpListPreference.java +++ b/libraries/keychain-api-library/src/main/java/org/openintents/openpgp/OpenPgpListPreference.java @@ -26,8 +26,6 @@ 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; diff --git a/OpenPGP-Keychain/src/main/java/org/openintents/openpgp/OpenPgpServiceConnection.java b/libraries/keychain-api-library/src/main/java/org/openintents/openpgp/OpenPgpServiceConnection.java similarity index 100% rename from OpenPGP-Keychain/src/main/java/org/openintents/openpgp/OpenPgpServiceConnection.java rename to libraries/keychain-api-library/src/main/java/org/openintents/openpgp/OpenPgpServiceConnection.java diff --git a/OpenPGP-Keychain/src/main/java/org/openintents/openpgp/OpenPgpSignatureResult.java b/libraries/keychain-api-library/src/main/java/org/openintents/openpgp/OpenPgpSignatureResult.java similarity index 100% rename from OpenPGP-Keychain/src/main/java/org/openintents/openpgp/OpenPgpSignatureResult.java rename to libraries/keychain-api-library/src/main/java/org/openintents/openpgp/OpenPgpSignatureResult.java diff --git a/settings.gradle b/settings.gradle index 9f4d801a6..344278063 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,4 +1,5 @@ include ':OpenPGP-Keychain' +include ':libraries:keychain-api-library' include ':libraries:HtmlTextView' include ':libraries:StickyListHeaders:library' include ':libraries:AndroidBootstrap'