mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-23 17:22:16 -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;
|
||||
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)) {
|
||||
passphrase = data.getStringExtra(OpenPgpApi.EXTRA_PASSPHRASE);
|
||||
} else {
|
||||
passphrase = PassphraseCacheService.getCachedPassphrase(getContext(),
|
||||
accSettings.getKeyId(), accSettings.getKeyId());
|
||||
accSettings.getKeyId(), sigSubKeyId);
|
||||
}
|
||||
if (passphrase == null) {
|
||||
// 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);
|
||||
@ -419,11 +425,6 @@ public class OpenPgpService extends RemoteService {
|
||||
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
|
||||
builder.setSignatureHashAlgorithm(accSettings.getHashAlgorithm())
|
||||
.setSignatureMasterKeyId(accSettings.getKeyId())
|
||||
|
Loading…
Reference in New Issue
Block a user