API update

This commit is contained in:
Dominik Schürmann
2013-10-02 19:08:33 +02:00
parent 224faa42ac
commit 2a0df5b75a
7 changed files with 92 additions and 64 deletions

View File

@@ -25,7 +25,8 @@ interface IOpenPgpCallback {
* onSuccess returns on successful OpenPGP operations.
*
* @param outputBytes
* contains resulting output bytes (decrypted content/content without signature)
* contains resulting output bytes (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.

View File

@@ -34,14 +34,14 @@ interface IOpenPgpService {
* @param encryptionUserIds
* User Ids (emails) of recipients
* @param asciiArmor
* Encode for ASCII (Radix-64, 33 percent overhead compared to binary)
* Encode result for ASCII (Radix-64, 33 percent overhead compared to binary)
* @param allowUserInteraction
* Allows the OpenPGP Provider to handle missing keys by showing activities
* @param callback
* Callback where to return results
*/
oneway void encrypt(in byte[] inputBytes, in String[] encryptionUserIds,
in boolean asciiArmor, in boolean allowUserInteraction, in IOpenPgpCallback callback);
oneway void encrypt(in byte[] inputBytes, in String[] encryptionUserIds, in boolean asciiArmor,
in IOpenPgpCallback callback);
/**
* Sign
@@ -51,14 +51,13 @@ interface IOpenPgpService {
* @param inputBytes
* Byte array you want to sign
* @param asciiArmor
* Encode for ASCII (Radix-64, 33 percent overhead compared to binary)
* Encode result for ASCII (Radix-64, 33 percent overhead compared to binary)
* @param allowUserInteraction
* Allows the OpenPGP Provider to handle missing keys by showing activities
* @param callback
* Callback where to return results
*/
oneway void sign(in byte[] inputBytes, in boolean asciiArmor, in boolean allowUserInteraction,
in IOpenPgpCallback callback);
oneway void sign(in byte[] inputBytes, in boolean asciiArmor, in IOpenPgpCallback callback);
/**
* Sign then encrypt
@@ -70,14 +69,14 @@ interface IOpenPgpService {
* @param encryptionUserIds
* User Ids (emails) of recipients
* @param asciiArmor
* Encode for ASCII (Radix-64, 33 percent overhead compared to binary)
* Encode result for ASCII (Radix-64, 33 percent overhead compared to binary)
* @param allowUserInteraction
* Allows the OpenPGP Provider to handle missing keys by showing activities
* @param callback
* Callback where to return results
*/
oneway void signAndEncrypt(in byte[] inputBytes, in String[] encryptionUserIds,
in boolean asciiArmor, in boolean allowUserInteraction, in IOpenPgpCallback callback);
oneway void signAndEncrypt(in byte[] inputBytes, in String[] encryptionUserIds, in boolean asciiArmor,
in IOpenPgpCallback callback);
/**
* Decrypts and verifies given input bytes. This methods handles encrypted-only, signed-and-encrypted,
@@ -93,7 +92,8 @@ interface IOpenPgpService {
* @param callback
* Callback where to return results
*/
oneway void decryptAndVerify(in byte[] inputBytes, in boolean allowUserInteraction,
in IOpenPgpCallback callback);
oneway void decryptAndVerify(in byte[] inputBytes, in IOpenPgpCallback callback);
boolean isKeyAvailable(in String[] userIds);
}

View File

@@ -456,15 +456,14 @@ public class OpenPgpService extends RemoteService {
@Override
public void encrypt(final byte[] inputBytes, final String[] encryptionUserIds,
final boolean asciiArmor, final boolean allowUserInteraction,
final IOpenPgpCallback callback) throws RemoteException {
final boolean asciiArmor, final IOpenPgpCallback callback) throws RemoteException {
final AppSettings settings = getAppSettings();
Runnable r = new Runnable() {
@Override
public void run() {
encryptAndSignSafe(inputBytes, encryptionUserIds, asciiArmor,
allowUserInteraction, callback, settings, false);
encryptAndSignSafe(inputBytes, encryptionUserIds, asciiArmor, true, callback,
settings, false);
}
};
@@ -473,15 +472,14 @@ public class OpenPgpService extends RemoteService {
@Override
public void signAndEncrypt(final byte[] inputBytes, final String[] encryptionUserIds,
final boolean asciiArmor, final boolean allowUserInteraction,
final IOpenPgpCallback callback) throws RemoteException {
final boolean asciiArmor, final IOpenPgpCallback callback) throws RemoteException {
final AppSettings settings = getAppSettings();
Runnable r = new Runnable() {
@Override
public void run() {
encryptAndSignSafe(inputBytes, encryptionUserIds, asciiArmor,
allowUserInteraction, callback, settings, true);
encryptAndSignSafe(inputBytes, encryptionUserIds, asciiArmor, true, callback,
settings, true);
}
};
@@ -490,14 +488,13 @@ public class OpenPgpService extends RemoteService {
@Override
public void sign(final byte[] inputBytes, boolean asciiArmor,
final boolean allowUserInteraction, final IOpenPgpCallback callback)
throws RemoteException {
final IOpenPgpCallback callback) throws RemoteException {
final AppSettings settings = getAppSettings();
Runnable r = new Runnable() {
@Override
public void run() {
signSafe(inputBytes, allowUserInteraction, callback, settings);
signSafe(inputBytes, true, callback, settings);
}
};
@@ -505,21 +502,27 @@ public class OpenPgpService extends RemoteService {
}
@Override
public void decryptAndVerify(final byte[] inputBytes, final boolean allowUserInteraction,
final IOpenPgpCallback callback) throws RemoteException {
public void decryptAndVerify(final byte[] inputBytes, final IOpenPgpCallback callback)
throws RemoteException {
final AppSettings settings = getAppSettings();
Runnable r = new Runnable() {
@Override
public void run() {
decryptAndVerifySafe(inputBytes, allowUserInteraction, callback, settings);
decryptAndVerifySafe(inputBytes, true, callback, settings);
}
};
checkAndEnqueue(r);
}
@Override
public boolean isKeyAvailable(String[] userIds) throws RemoteException {
// TODO
return false;
}
};
@Override