mirror of
https://github.com/moparisthebest/open-keychain
synced 2025-02-17 07:30:14 -05:00
request passphrase for correct subkey in OpenPgpService
fixes #811, hopefully
This commit is contained in:
parent
0b16a4edfd
commit
384724f9b5
@ -400,15 +400,21 @@ public class OpenPgpService extends RemoteService {
|
|||||||
|
|
||||||
String passphrase = null;
|
String passphrase = null;
|
||||||
if (sign) {
|
if (sign) {
|
||||||
|
|
||||||
|
// Find the appropriate subkey to sign with
|
||||||
|
CachedPublicKeyRing signingRing =
|
||||||
|
new ProviderHelper(this).getCachedPublicKeyRing(accSettings.getKeyId());
|
||||||
|
final long sigSubKeyId = signingRing.getSignId();
|
||||||
|
|
||||||
if (data.hasExtra(OpenPgpApi.EXTRA_PASSPHRASE)) {
|
if (data.hasExtra(OpenPgpApi.EXTRA_PASSPHRASE)) {
|
||||||
passphrase = data.getStringExtra(OpenPgpApi.EXTRA_PASSPHRASE);
|
passphrase = data.getStringExtra(OpenPgpApi.EXTRA_PASSPHRASE);
|
||||||
} else {
|
} else {
|
||||||
passphrase = PassphraseCacheService.getCachedPassphrase(getContext(),
|
passphrase = PassphraseCacheService.getCachedPassphrase(getContext(),
|
||||||
accSettings.getKeyId(), accSettings.getKeyId());
|
accSettings.getKeyId(), sigSubKeyId);
|
||||||
}
|
}
|
||||||
if (passphrase == null) {
|
if (passphrase == null) {
|
||||||
// get PendingIntent for passphrase input, add it to given params and return to client
|
// get PendingIntent for passphrase input, add it to given params and return to client
|
||||||
return getPassphraseIntent(data, accSettings.getKeyId());
|
return getPassphraseIntent(data, sigSubKeyId);
|
||||||
}
|
}
|
||||||
|
|
||||||
byte[] nfcSignedHash = data.getByteArrayExtra(OpenPgpApi.EXTRA_NFC_SIGNED_HASH);
|
byte[] nfcSignedHash = data.getByteArrayExtra(OpenPgpApi.EXTRA_NFC_SIGNED_HASH);
|
||||||
@ -419,11 +425,6 @@ public class OpenPgpService extends RemoteService {
|
|||||||
nfcCreationDate = new Date(nfcCreationTimestamp);
|
nfcCreationDate = new Date(nfcCreationTimestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find the appropriate subkey to sign with
|
|
||||||
CachedPublicKeyRing signingRing =
|
|
||||||
new ProviderHelper(this).getCachedPublicKeyRing(accSettings.getKeyId());
|
|
||||||
long sigSubKeyId = signingRing.getSignId();
|
|
||||||
|
|
||||||
// sign and encrypt
|
// sign and encrypt
|
||||||
builder.setSignatureHashAlgorithm(accSettings.getHashAlgorithm())
|
builder.setSignatureHashAlgorithm(accSettings.getHashAlgorithm())
|
||||||
.setSignatureMasterKeyId(accSettings.getKeyId())
|
.setSignatureMasterKeyId(accSettings.getKeyId())
|
||||||
|
Loading…
Reference in New Issue
Block a user