mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-11 11:35:07 -05:00
API documentation
This commit is contained in:
parent
0e24a74bb8
commit
168432abab
@ -18,7 +18,7 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="org.sufficientlysecure.keychain"
|
package="org.sufficientlysecure.keychain"
|
||||||
android:installLocation="auto"
|
android:installLocation="auto"
|
||||||
android:versionCode="21100"
|
android:versionCode="21101"
|
||||||
android:versionName="2.1.1" >
|
android:versionName="2.1.1" >
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
|
@ -22,10 +22,22 @@ import org.openintents.openpgp.OpenPgpError;
|
|||||||
interface IOpenPgpCallback {
|
interface IOpenPgpCallback {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CryptoSignatureResult is only returned if the Callback was used from decryptAndVerify
|
* onSuccess returns on successful OpenPGP operations.
|
||||||
*
|
*
|
||||||
|
* @param outputBytes
|
||||||
|
* contains resulting output bytes (decrypted content/content without signature)
|
||||||
|
* @param signatureResult
|
||||||
|
* signatureResult is only non-null if decryptAndVerify() was called and the content
|
||||||
|
* was encrypted or signed-and-encrypted.
|
||||||
*/
|
*/
|
||||||
oneway void onSuccess(in byte[] outputBytes, in OpenPgpSignatureResult signatureResult);
|
oneway void onSuccess(in byte[] outputBytes, 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);
|
oneway void onError(in OpenPgpError error);
|
||||||
}
|
}
|
@ -27,6 +27,8 @@ interface IOpenPgpService {
|
|||||||
/**
|
/**
|
||||||
* Encrypt
|
* Encrypt
|
||||||
*
|
*
|
||||||
|
* After successful encryption, callback's onSuccess will contain the resulting output bytes.
|
||||||
|
*
|
||||||
* @param inputBytes
|
* @param inputBytes
|
||||||
* Byte array you want to encrypt
|
* Byte array you want to encrypt
|
||||||
* @param encryptionUserIds
|
* @param encryptionUserIds
|
||||||
@ -43,9 +45,11 @@ interface IOpenPgpService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sign
|
* Sign
|
||||||
|
*
|
||||||
|
* After successful signing, callback's onSuccess will contain the resulting output bytes.
|
||||||
*
|
*
|
||||||
* @param inputBytes
|
* @param inputBytes
|
||||||
* Byte array you want to encrypt
|
* Byte array you want to sign
|
||||||
* @param asciiArmor
|
* @param asciiArmor
|
||||||
* Encode for ASCII (Radix-64, 33 percent overhead compared to binary)
|
* Encode for ASCII (Radix-64, 33 percent overhead compared to binary)
|
||||||
* @param allowUserInteraction
|
* @param allowUserInteraction
|
||||||
@ -58,9 +62,11 @@ interface IOpenPgpService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sign then encrypt
|
* Sign then encrypt
|
||||||
|
*
|
||||||
|
* After successful signing and encryption, callback's onSuccess will contain the resulting output bytes.
|
||||||
*
|
*
|
||||||
* @param inputBytes
|
* @param inputBytes
|
||||||
* Byte array you want to encrypt
|
* Byte array you want to sign and encrypt
|
||||||
* @param encryptionUserIds
|
* @param encryptionUserIds
|
||||||
* User Ids (emails) of recipients
|
* User Ids (emails) of recipients
|
||||||
* @param signatureUserId
|
* @param signatureUserId
|
||||||
@ -76,8 +82,11 @@ interface IOpenPgpService {
|
|||||||
in boolean asciiArmor, in boolean allowUserInteraction, in IOpenPgpCallback callback);
|
in boolean asciiArmor, in boolean allowUserInteraction, in IOpenPgpCallback callback);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Decrypts and verifies given input bytes. If no signature is present this method
|
* Decrypts and verifies given input bytes. This methods handles the encrypted-only, signed-and-encrypted,
|
||||||
* will only decrypt.
|
* and also signed-only inputBytes.
|
||||||
|
*
|
||||||
|
* After successful decryption, callback's onSuccess will contain the resulting output bytes.
|
||||||
|
* callback's onSuccess will return the signatureResult for signed-and-encrypted and signed-only inputs.
|
||||||
*
|
*
|
||||||
* @param inputBytes
|
* @param inputBytes
|
||||||
* Byte array you want to decrypt and verify
|
* Byte array you want to decrypt and verify
|
||||||
|
@ -20,9 +20,13 @@ import android.os.Parcel;
|
|||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
|
|
||||||
public class OpenPgpSignatureResult implements Parcelable {
|
public class OpenPgpSignatureResult implements Parcelable {
|
||||||
|
// generic error on signature verification
|
||||||
public static final int SIGNATURE_ERROR = 0;
|
public static final int SIGNATURE_ERROR = 0;
|
||||||
|
// successfully verified signature, with trusted public key
|
||||||
public static final int SIGNATURE_SUCCESS_TRUSTED = 1;
|
public static final int SIGNATURE_SUCCESS_TRUSTED = 1;
|
||||||
|
// no public key was found for this signature verification
|
||||||
public static final int SIGNATURE_UNKNOWN = 2;
|
public static final int SIGNATURE_UNKNOWN = 2;
|
||||||
|
// successfully verified signature, but with untrusted public key
|
||||||
public static final int SIGNATURE_SUCCESS_UNTRUSTED = 3;
|
public static final int SIGNATURE_SUCCESS_UNTRUSTED = 3;
|
||||||
|
|
||||||
int signatureStatus;
|
int signatureStatus;
|
||||||
|
@ -62,7 +62,7 @@ public class OpenPgpService extends RemoteService {
|
|||||||
if (passphrase == null) {
|
if (passphrase == null) {
|
||||||
if (!allowUserInteraction) {
|
if (!allowUserInteraction) {
|
||||||
throw new UserInteractionRequiredException(
|
throw new UserInteractionRequiredException(
|
||||||
"Passphrase not found in cache! User interaction required!");
|
"Passphrase not found in cache, please enter your passphrase!");
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.d(Constants.TAG, "No passphrase! Activity required!");
|
Log.d(Constants.TAG, "No passphrase! Activity required!");
|
||||||
|
Loading…
Reference in New Issue
Block a user