mirror of
https://github.com/moparisthebest/open-keychain
synced 2025-01-12 05:58:07 -05:00
one more fix for getting the right subkey in api signing
This commit is contained in:
parent
1ed6083a24
commit
228e5653f9
@ -249,25 +249,6 @@ public class OpenPgpService extends RemoteService {
|
|||||||
try {
|
try {
|
||||||
boolean asciiArmor = data.getBooleanExtra(OpenPgpApi.EXTRA_REQUEST_ASCII_ARMOR, true);
|
boolean asciiArmor = data.getBooleanExtra(OpenPgpApi.EXTRA_REQUEST_ASCII_ARMOR, true);
|
||||||
|
|
||||||
// get passphrase from cache, if key has "no" passphrase, this returns an empty String
|
|
||||||
String passphrase;
|
|
||||||
if (data.hasExtra(OpenPgpApi.EXTRA_PASSPHRASE)) {
|
|
||||||
passphrase = data.getStringExtra(OpenPgpApi.EXTRA_PASSPHRASE);
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
passphrase = PassphraseCacheService.getCachedPassphrase(getContext(),
|
|
||||||
accSettings.getKeyId(), accSettings.getKeyId());
|
|
||||||
} catch (PassphraseCacheService.KeyNotFoundException e) {
|
|
||||||
// secret key that is set for this account is deleted?
|
|
||||||
// show account config again!
|
|
||||||
return getCreateAccountIntent(data, getAccountName(data));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (passphrase == null) {
|
|
||||||
// get PendingIntent for passphrase input, add it to given params and return to client
|
|
||||||
return getPassphraseIntent(data, accSettings.getKeyId());
|
|
||||||
}
|
|
||||||
|
|
||||||
byte[] nfcSignedHash = data.getByteArrayExtra(OpenPgpApi.EXTRA_NFC_SIGNED_HASH);
|
byte[] nfcSignedHash = data.getByteArrayExtra(OpenPgpApi.EXTRA_NFC_SIGNED_HASH);
|
||||||
if (nfcSignedHash != null) {
|
if (nfcSignedHash != null) {
|
||||||
Log.d(Constants.TAG, "nfcSignedHash:" + Hex.toHexString(nfcSignedHash));
|
Log.d(Constants.TAG, "nfcSignedHash:" + Hex.toHexString(nfcSignedHash));
|
||||||
@ -295,6 +276,25 @@ public class OpenPgpService extends RemoteService {
|
|||||||
new ProviderHelper(this).getCachedPublicKeyRing(accSettings.getKeyId());
|
new ProviderHelper(this).getCachedPublicKeyRing(accSettings.getKeyId());
|
||||||
final long sigSubKeyId = signingRing.getSecretSignId();
|
final long sigSubKeyId = signingRing.getSecretSignId();
|
||||||
|
|
||||||
|
// get passphrase from cache, if key has "no" passphrase, this returns an empty String
|
||||||
|
String passphrase;
|
||||||
|
if (data.hasExtra(OpenPgpApi.EXTRA_PASSPHRASE)) {
|
||||||
|
passphrase = data.getStringExtra(OpenPgpApi.EXTRA_PASSPHRASE);
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
passphrase = PassphraseCacheService.getCachedPassphrase(getContext(),
|
||||||
|
accSettings.getKeyId(), sigSubKeyId);
|
||||||
|
} catch (PassphraseCacheService.KeyNotFoundException e) {
|
||||||
|
// secret key that is set for this account is deleted?
|
||||||
|
// show account config again!
|
||||||
|
return getCreateAccountIntent(data, getAccountName(data));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (passphrase == null) {
|
||||||
|
// get PendingIntent for passphrase input, add it to given params and return to client
|
||||||
|
return getPassphraseIntent(data, sigSubKeyId);
|
||||||
|
}
|
||||||
|
|
||||||
// sign-only
|
// sign-only
|
||||||
PgpSignEncrypt.Builder builder = new PgpSignEncrypt.Builder(
|
PgpSignEncrypt.Builder builder = new PgpSignEncrypt.Builder(
|
||||||
new ProviderHelper(getContext()), passphraseCacheInterface,
|
new ProviderHelper(getContext()), passphraseCacheInterface,
|
||||||
|
Loading…
Reference in New Issue
Block a user