2013-05-28 09:10:36 -04:00
|
|
|
/*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2013-09-10 17:19:34 -04:00
|
|
|
package org.openintents.openpgp;
|
2013-05-28 09:10:36 -04:00
|
|
|
|
2013-10-05 12:35:16 -04:00
|
|
|
import org.openintents.openpgp.OpenPgpData;
|
2013-09-10 17:19:34 -04:00
|
|
|
import org.openintents.openpgp.IOpenPgpCallback;
|
2013-10-05 12:35:16 -04:00
|
|
|
import org.openintents.openpgp.IOpenPgpKeyIdsCallback;
|
2013-05-28 09:10:36 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
2013-09-10 17:19:34 -04:00
|
|
|
interface IOpenPgpService {
|
2013-10-02 13:08:33 -04:00
|
|
|
|
2013-05-28 09:10:36 -04:00
|
|
|
/**
|
|
|
|
* Encrypt
|
|
|
|
*
|
2013-10-02 13:08:33 -04:00
|
|
|
* After successful encryption, callback's onSuccess will contain the resulting output bytes.
|
|
|
|
*
|
2013-10-05 12:35:16 -04:00
|
|
|
* @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()
|
2013-05-28 17:42:45 -04:00
|
|
|
* @param callback
|
|
|
|
* Callback where to return results
|
2013-05-28 09:10:36 -04:00
|
|
|
*/
|
2013-10-05 12:35:16 -04:00
|
|
|
oneway void encrypt(in OpenPgpData input, in OpenPgpData output, in long[] keyIds, in IOpenPgpCallback callback);
|
2013-05-28 09:10:36 -04:00
|
|
|
|
|
|
|
/**
|
2013-06-17 13:51:41 -04:00
|
|
|
* Sign
|
2013-10-02 13:08:33 -04:00
|
|
|
*
|
|
|
|
* After successful signing, callback's onSuccess will contain the resulting output bytes.
|
2013-05-28 09:10:36 -04:00
|
|
|
*
|
2013-10-05 12:35:16 -04:00
|
|
|
* @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
|
2013-05-28 17:42:45 -04:00
|
|
|
* @param callback
|
|
|
|
* Callback where to return results
|
2013-05-28 09:10:36 -04:00
|
|
|
*/
|
2013-10-05 12:35:16 -04:00
|
|
|
oneway void sign(in OpenPgpData input, in OpenPgpData output, in IOpenPgpCallback callback);
|
2013-05-28 09:10:36 -04:00
|
|
|
|
|
|
|
/**
|
2013-09-13 20:08:06 -04:00
|
|
|
* Sign then encrypt
|
2013-10-02 13:08:33 -04:00
|
|
|
*
|
|
|
|
* After successful signing and encryption, callback's onSuccess will contain the resulting output bytes.
|
2013-05-28 09:10:36 -04:00
|
|
|
*
|
2013-10-05 12:35:16 -04:00
|
|
|
* @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()
|
2013-05-28 17:42:45 -04:00
|
|
|
* @param callback
|
|
|
|
* Callback where to return results
|
2013-05-28 09:10:36 -04:00
|
|
|
*/
|
2013-10-05 12:35:16 -04:00
|
|
|
oneway void signAndEncrypt(in OpenPgpData input, in OpenPgpData output, in long[] keyIds, in IOpenPgpCallback callback);
|
2013-05-28 09:10:36 -04:00
|
|
|
|
|
|
|
/**
|
2013-10-02 13:08:33 -04:00
|
|
|
* Decrypts and verifies given input bytes. This methods handles encrypted-only, signed-and-encrypted,
|
|
|
|
* and also signed-only inputBytes.
|
|
|
|
*
|
|
|
|
* After successful decryption/verification, callback's onSuccess will contain the resulting output bytes.
|
|
|
|
* The signatureResult in onSuccess is only non-null if signed-and-encrypted or signed-only inputBytes were given.
|
2013-05-28 09:10:36 -04:00
|
|
|
*
|
2013-10-05 12:35:16 -04:00
|
|
|
* @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
|
2013-05-28 17:42:45 -04:00
|
|
|
* @param callback
|
|
|
|
* Callback where to return results
|
2013-05-28 09:10:36 -04:00
|
|
|
*/
|
2013-10-05 12:35:16 -04:00
|
|
|
oneway void decryptAndVerify(in OpenPgpData input, in OpenPgpData output, in IOpenPgpCallback callback);
|
2013-10-02 13:08:33 -04:00
|
|
|
|
2013-10-05 12:35:16 -04:00
|
|
|
/**
|
|
|
|
* 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);
|
2013-07-01 17:19:53 -04:00
|
|
|
|
2013-05-28 09:10:36 -04:00
|
|
|
}
|