api: add micalg result extra to detached signature api call
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user