aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp
diff options
context:
space:
mode:
authorVincent Breitmoser <valodim@mugenguild.com>2015-12-17 01:08:23 +0100
committerVincent Breitmoser <valodim@mugenguild.com>2015-12-17 01:08:23 +0100
commite32c1a9ced4c3409d4cf581dc1206968b6c86ef4 (patch)
tree089d3daf005057bfd3179799d27654ed429d852a /OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp
parent5344307e2278e948d21356486dd020334f7c4519 (diff)
downloadopen-keychain-e32c1a9ced4c3409d4cf581dc1206968b6c86ef4.tar.gz
open-keychain-e32c1a9ced4c3409d4cf581dc1206968b6c86ef4.tar.bz2
open-keychain-e32c1a9ced4c3409d4cf581dc1206968b6c86ef4.zip
api: add micalg result extra to detached signature api call
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp')
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSignEncryptOperation.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSignEncryptOperation.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSignEncryptOperation.java
index 45641b33a..40d6a710b 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSignEncryptOperation.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSignEncryptOperation.java
@@ -32,6 +32,7 @@ import org.spongycastle.openpgp.PGPException;
import org.spongycastle.openpgp.PGPLiteralData;
import org.spongycastle.openpgp.PGPLiteralDataGenerator;
import org.spongycastle.openpgp.PGPSignatureGenerator;
+import org.spongycastle.openpgp.PGPUtil;
import org.spongycastle.openpgp.operator.jcajce.JcePBEKeyEncryptionMethodGenerator;
import org.spongycastle.openpgp.operator.jcajce.JcePGPDataEncryptorBuilder;
import org.spongycastle.openpgp.operator.jcajce.NfcSyncPGPContentSignerBuilder;
@@ -574,6 +575,13 @@ public class PgpSignEncryptOperation extends BaseOperation {
// silently catch
}
result.setDetachedSignature(detachedByteOut.toByteArray());
+ try {
+ String digestName = PGPUtil.getDigestName(input.getSignatureHashAlgorithm());
+ // construct micalg parameter according to https://tools.ietf.org/html/rfc3156#section-5
+ result.setMicAlgDigestName("pgp-" + digestName.toLowerCase());
+ } catch (PGPException e) {
+ Log.e(Constants.TAG, "error setting micalg parameter!", e);
+ }
}
return result;
}