From 754b2a6cb15a6af61150cd4b1ce472bebd4fec22 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= <dominik@dominikschuermann.de>
Date: Sun, 9 Feb 2014 19:22:14 +0100
Subject: Restructuring for new API library

---
 .../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 +++++++
 8 files changed, 359 insertions(+)
 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

(limited to 'OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/aidl')

diff --git a/OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/aidl/org/openintents/openpgp/IOpenPgpCallback.aidl b/OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/aidl/org/openintents/openpgp/IOpenPgpCallback.aidl
new file mode 100644
index 000000000..ba41de1ba
--- /dev/null
+++ b/OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/aidl/org/openintents/openpgp/IOpenPgpCallback.aidl
@@ -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);
+}
\ No newline at end of file
diff --git a/OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/aidl/org/openintents/openpgp/IOpenPgpKeyIdsCallback.aidl b/OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/aidl/org/openintents/openpgp/IOpenPgpKeyIdsCallback.aidl
new file mode 100644
index 000000000..4ca356fad
--- /dev/null
+++ b/OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/aidl/org/openintents/openpgp/IOpenPgpKeyIdsCallback.aidl
@@ -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);
+}
\ No newline at end of file
diff --git a/OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/aidl/org/openintents/openpgp/IOpenPgpService.aidl b/OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/aidl/org/openintents/openpgp/IOpenPgpService.aidl
new file mode 100644
index 000000000..8f9e8a0fd
--- /dev/null
+++ b/OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/aidl/org/openintents/openpgp/IOpenPgpService.aidl
@@ -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);
+    
+}
\ No newline at end of file
diff --git a/OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/aidl/org/openintents/openpgp/OpenPgpData.aidl b/OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/aidl/org/openintents/openpgp/OpenPgpData.aidl
new file mode 100644
index 000000000..3711e4fb4
--- /dev/null
+++ b/OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/aidl/org/openintents/openpgp/OpenPgpData.aidl
@@ -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;
\ No newline at end of file
diff --git a/OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/aidl/org/openintents/openpgp/OpenPgpError.aidl b/OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/aidl/org/openintents/openpgp/OpenPgpError.aidl
new file mode 100644
index 000000000..7a6bed1e6
--- /dev/null
+++ b/OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/aidl/org/openintents/openpgp/OpenPgpError.aidl
@@ -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;
\ No newline at end of file
diff --git a/OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/aidl/org/openintents/openpgp/OpenPgpSignatureResult.aidl b/OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/aidl/org/openintents/openpgp/OpenPgpSignatureResult.aidl
new file mode 100644
index 000000000..e246792d0
--- /dev/null
+++ b/OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/aidl/org/openintents/openpgp/OpenPgpSignatureResult.aidl
@@ -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;
\ No newline at end of file
diff --git a/OpenPGP-Keychain-API/libraries/keychain-api-library/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
new file mode 100644
index 000000000..f69f66fd7
--- /dev/null
+++ b/OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/aidl/org/sufficientlysecure/keychain/service/remote/IExtendedApiCallback.aidl
@@ -0,0 +1,24 @@
+/*
+ * 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.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/OpenPGP-Keychain-API/libraries/keychain-api-library/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
new file mode 100644
index 000000000..669bd31b5
--- /dev/null
+++ b/OpenPGP-Keychain-API/libraries/keychain-api-library/src/main/aidl/org/sufficientlysecure/keychain/service/remote/IExtendedApiService.aidl
@@ -0,0 +1,48 @@
+/*
+ * 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.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
-- 
cgit v1.2.3