aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominik Schürmann <dominik@dominikschuermann.de>2015-01-08 14:40:58 +0100
committerDominik Schürmann <dominik@dominikschuermann.de>2015-01-08 14:40:58 +0100
commitf712a26ab68eb0f978722cfa69a7e9b5d05c80ca (patch)
treef180561e0a2ae024e616abc7935d7027c001a189
parent89b0a3bd140dd178595c031beaa27747575d7ac8 (diff)
downloadopenpgp-api-f712a26ab68eb0f978722cfa69a7e9b5d05c80ca.tar.gz
openpgp-api-f712a26ab68eb0f978722cfa69a7e9b5d05c80ca.tar.bz2
openpgp-api-f712a26ab68eb0f978722cfa69a7e9b5d05c80ca.zip
API for detached signatures
-rw-r--r--src/org/openintents/openpgp/util/OpenPgpApi.java40
1 files changed, 37 insertions, 3 deletions
diff --git a/src/org/openintents/openpgp/util/OpenPgpApi.java b/src/org/openintents/openpgp/util/OpenPgpApi.java
index 3e18ab0..f140af1 100644
--- a/src/org/openintents/openpgp/util/OpenPgpApi.java
+++ b/src/org/openintents/openpgp/util/OpenPgpApi.java
@@ -67,15 +67,43 @@ public class OpenPgpApi {
*/
/**
- * Sign only
+ * DEPRECATED
+ * Same as ACTION_CLEARTEXT_SIGN
* <p/>
* optional extras:
- * boolean EXTRA_REQUEST_ASCII_ARMOR (request ascii armor for output)
+ * boolean EXTRA_REQUEST_ASCII_ARMOR (DEPRECATED: this makes no sense here)
* String EXTRA_PASSPHRASE (key passphrase)
*/
public static final String ACTION_SIGN = "org.openintents.openpgp.action.SIGN";
/**
+ * Sign text resulting in a cleartext signature
+ * Some magic pre-processing of the text is done to convert it to a format usable for
+ * cleartext signatures per RFC 4880 before the text is actually signed:
+ * - end cleartext with newline
+ * - remove whitespaces on line endings
+ * <p/>
+ * optional extras:
+ * String EXTRA_PASSPHRASE (key passphrase)
+ */
+ public static final String ACTION_CLEARTEXT_SIGN = "org.openintents.openpgp.action.CLEARTEXT_SIGN";
+
+ /**
+ * Sign text or binary data resulting in a detached signature.
+ * OutputStream returns exactly the InputStream.
+ * No magic pre-processing is done like in ACTION_CLEARTEXT_SIGN.
+ * The detached signature is returned separately in RESULT_DETACHED_SIGNATURE.
+ * <p/>
+ * optional extras:
+ * boolean EXTRA_REQUEST_ASCII_ARMOR (request ascii armor for detached signature)
+ * String EXTRA_PASSPHRASE (key passphrase)
+ * <p/>
+ * returned extras:
+ * byte[] RESULT_DETACHED_SIGNATURE
+ */
+ public static final String ACTION_DETACHED_SIGN = "org.openintents.openpgp.action.DETACHED_SIGN";
+
+ /**
* Encrypt
* <p/>
* required extras:
@@ -114,6 +142,7 @@ public class OpenPgpApi {
* <p/>
* optional extras:
* boolean EXTRA_REQUEST_ASCII_ARMOR (request ascii armor for output)
+ * byte[] EXTRA_DETACHED_SIGNATURE (detached signature)
* <p/>
* returned extras:
* OpenPgpSignatureResult RESULT_SIGNATURE
@@ -159,11 +188,14 @@ public class OpenPgpApi {
public static final String EXTRA_ACCOUNT_NAME = "account_name";
- // SIGN, ENCRYPT, SIGN_AND_ENCRYPT, DECRYPT_VERIFY
+ // ACTION_DETACHED_SIGN, ENCRYPT, SIGN_AND_ENCRYPT, DECRYPT_VERIFY
// request ASCII Armor for output
// OpenPGP Radix-64, 33 percent overhead compared to binary, see http://tools.ietf.org/html/rfc4880#page-53)
public static final String EXTRA_REQUEST_ASCII_ARMOR = "ascii_armor";
+ // ACTION_DETACHED_SIGN
+ public static final String RESULT_DETACHED_SIGNATURE = "detached_signature";
+
// ENCRYPT, SIGN_AND_ENCRYPT
public static final String EXTRA_USER_IDS = "user_ids";
public static final String EXTRA_KEY_IDS = "key_ids";
@@ -195,6 +227,8 @@ public class OpenPgpApi {
public static final String RESULT_INTENT = "intent";
// DECRYPT_VERIFY
+ public static final String EXTRA_DETACHED_SIGNATURE = "detached_signature";
+
public static final String RESULT_SIGNATURE = "signature";
public static final String RESULT_METADATA = "metadata";