New gradle folder structure for API Demo
62
OpenPGP-Keychain-API-Demo/build.gradle
Normal file
@ -0,0 +1,62 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:0.7.3'
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'android'
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile 'com.android.support:support-v4:19.0.+'
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion 19
|
||||
buildToolsVersion "19"
|
||||
|
||||
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
|
||||
}
|
||||
}
|
@ -1,83 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project name="Keychain-API-Demo" default="help">
|
||||
|
||||
<!-- The local.properties file is created and updated by the 'android' tool.
|
||||
It contains the path to the SDK. It should *NOT* be checked into
|
||||
Version Control Systems. -->
|
||||
<property file="local.properties" />
|
||||
|
||||
<!-- The ant.properties file can be created by you. It is only edited by the
|
||||
'android' tool to add properties to it.
|
||||
This is the place to change some Ant specific build properties.
|
||||
Here are some properties you may want to change/update:
|
||||
|
||||
source.dir
|
||||
The name of the source directory. Default is 'src'.
|
||||
out.dir
|
||||
The name of the output directory. Default is 'bin'.
|
||||
|
||||
For other overridable properties, look at the beginning of the rules
|
||||
files in the SDK, at tools/ant/build.xml
|
||||
|
||||
Properties related to the SDK location or the project target should
|
||||
be updated using the 'android' tool with the 'update' action.
|
||||
|
||||
This file is an integral part of the build system for your
|
||||
application and should be checked into Version Control Systems.
|
||||
|
||||
-->
|
||||
<property file="ant.properties" />
|
||||
|
||||
<!-- The project.properties file is created and updated by the 'android'
|
||||
tool, as well as ADT.
|
||||
|
||||
This contains project specific properties such as project target, and library
|
||||
dependencies. Lower level build properties are stored in ant.properties
|
||||
(or in .classpath for Eclipse projects).
|
||||
|
||||
This file is an integral part of the build system for your
|
||||
application and should be checked into Version Control Systems. -->
|
||||
<loadproperties srcFile="project.properties" />
|
||||
|
||||
<!-- quick check on sdk.dir -->
|
||||
<fail
|
||||
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through an env var"
|
||||
unless="sdk.dir"
|
||||
/>
|
||||
|
||||
<!--
|
||||
Import per project custom build rules if present at the root of the project.
|
||||
This is the place to put custom intermediary targets such as:
|
||||
-pre-build
|
||||
-pre-compile
|
||||
-post-compile (This is typically used for code obfuscation.
|
||||
Compiled code location: ${out.classes.absolute.dir}
|
||||
If this is not done in place, override ${out.dex.input.absolute.dir})
|
||||
-post-package
|
||||
-post-build
|
||||
-pre-clean
|
||||
-->
|
||||
<import file="custom_rules.xml" optional="true" />
|
||||
|
||||
<!-- Import the actual build file.
|
||||
|
||||
To customize existing targets, there are two options:
|
||||
- Customize only one target:
|
||||
- copy/paste the target into this file, *before* the
|
||||
<import> task.
|
||||
- customize it to your needs.
|
||||
- Customize the whole content of build.xml
|
||||
- copy/paste the content of the rules files (minus the top node)
|
||||
into this file, replacing the <import> task.
|
||||
- customize to your needs.
|
||||
|
||||
***********************
|
||||
****** IMPORTANT ******
|
||||
***********************
|
||||
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
|
||||
in order to avoid having your file be overridden by tools such as "android update project"
|
||||
-->
|
||||
<!-- version-tag: 1 -->
|
||||
<import file="${sdk.dir}/tools/ant/build.xml" />
|
||||
|
||||
</project>
|
@ -1,20 +0,0 @@
|
||||
# To enable ProGuard in your project, edit project.properties
|
||||
# to define the proguard.config property as described in that file.
|
||||
#
|
||||
# Add project specific ProGuard rules here.
|
||||
# By default, the flags in this file are appended to flags specified
|
||||
# in ${sdk.dir}/tools/proguard/proguard-android.txt
|
||||
# You can edit the include path and order by changing the ProGuard
|
||||
# include property in project.properties.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# Add any project specific keep options here:
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
@ -1,11 +0,0 @@
|
||||
# This file is automatically generated by Android Tools.
|
||||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
||||
#
|
||||
# This file must be checked in Version Control Systems.
|
||||
#
|
||||
# To customize properties used by the Ant build system use,
|
||||
# "ant.properties", and override values to adapt the script to your
|
||||
# project structure.
|
||||
|
||||
# Project target.
|
||||
target=android-19
|
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright (C) 2013 Dominik Schürmann <dominik@dominikschuermann.de>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.openintents.openpgp;
|
||||
|
||||
import 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);
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright (C) 2013 Dominik Schürmann <dominik@dominikschuermann.de>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.openintents.openpgp;
|
||||
|
||||
import 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);
|
||||
}
|
@ -0,0 +1,143 @@
|
||||
/*
|
||||
* Copyright (C) 2013 Dominik Schürmann <dominik@dominikschuermann.de>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.openintents.openpgp;
|
||||
|
||||
import 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);
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright (C) 2013 Dominik Schürmann <dominik@dominikschuermann.de>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.openintents.openpgp;
|
||||
|
||||
// Declare OpenPgpData so AIDL can find it and knows that it implements the parcelable protocol.
|
||||
parcelable OpenPgpData;
|
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright (C) 2013 Dominik Schürmann <dominik@dominikschuermann.de>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.openintents.openpgp;
|
||||
|
||||
// Declare OpenPgpError so AIDL can find it and knows that it implements the parcelable protocol.
|
||||
parcelable OpenPgpError;
|
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright (C) 2013 Dominik Schürmann <dominik@dominikschuermann.de>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.openintents.openpgp;
|
||||
|
||||
// Declare OpenPgpSignatureResult so AIDL can find it and knows that it implements the parcelable protocol.
|
||||
parcelable OpenPgpSignatureResult;
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 5.6 KiB |