mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-16 22:05:05 -05:00
allow passphrase as parameter
This commit is contained in:
parent
e0111c2ec4
commit
3b0f76bf60
@ -141,7 +141,12 @@ public class OpenPgpService extends RemoteService {
|
||||
private Bundle signImpl(Bundle params, ParcelFileDescriptor input, ParcelFileDescriptor output, AppSettings appSettings) {
|
||||
try {
|
||||
// get passphrase from cache, if key has "no" passphrase, this returns an empty String
|
||||
String passphrase = PassphraseCacheService.getCachedPassphrase(getContext(), appSettings.getKeyId());
|
||||
String passphrase;
|
||||
if (params.containsKey(OpenPgpConstants.PARAMS_PASSPHRASE)) {
|
||||
passphrase = params.getString(OpenPgpConstants.PARAMS_PASSPHRASE);
|
||||
} else {
|
||||
passphrase = PassphraseCacheService.getCachedPassphrase(getContext(), appSettings.getKeyId());
|
||||
}
|
||||
if (passphrase == null) {
|
||||
// get PendingIntent for passphrase input, add it to given params and return to client
|
||||
Bundle passphraseBundle = getPassphraseBundleIntent(params, appSettings.getKeyId());
|
||||
@ -212,8 +217,13 @@ public class OpenPgpService extends RemoteService {
|
||||
|
||||
PgpOperation operation = new PgpOperation(getContext(), null, inputData, os);
|
||||
if (sign) {
|
||||
String passphrase = PassphraseCacheService.getCachedPassphrase(getContext(),
|
||||
String passphrase;
|
||||
if (params.containsKey(OpenPgpConstants.PARAMS_PASSPHRASE)) {
|
||||
passphrase = params.getString(OpenPgpConstants.PARAMS_PASSPHRASE);
|
||||
} else {
|
||||
passphrase = PassphraseCacheService.getCachedPassphrase(getContext(),
|
||||
appSettings.getKeyId());
|
||||
}
|
||||
if (passphrase == null) {
|
||||
// get PendingIntent for passphrase input, add it to given params and return to client
|
||||
Bundle passphraseBundle = getPassphraseBundleIntent(params, appSettings.getKeyId());
|
||||
@ -335,7 +345,12 @@ public class OpenPgpService extends RemoteService {
|
||||
// Log.d(Constants.TAG, "secretKeyId " + secretKeyId);
|
||||
|
||||
// NOTE: currently this only gets the passphrase for the saved key
|
||||
String passphrase = PassphraseCacheService.getCachedPassphrase(getContext(), appSettings.getKeyId());
|
||||
String passphrase;
|
||||
if (params.containsKey(OpenPgpConstants.PARAMS_PASSPHRASE)) {
|
||||
passphrase = params.getString(OpenPgpConstants.PARAMS_PASSPHRASE);
|
||||
} else {
|
||||
passphrase = PassphraseCacheService.getCachedPassphrase(getContext(), appSettings.getKeyId());
|
||||
}
|
||||
if (passphrase == null) {
|
||||
// get PendingIntent for passphrase input, add it to given params and return to client
|
||||
Bundle passphraseBundle = getPassphraseBundleIntent(params, appSettings.getKeyId());
|
||||
|
@ -32,6 +32,8 @@ public class OpenPgpConstants {
|
||||
// (for encrypt method)
|
||||
public static final String PARAMS_USER_IDS = "user_ids";
|
||||
public static final String PARAMS_KEY_IDS = "key_ids";
|
||||
// optional parameter:
|
||||
public static final String PARAMS_PASSPHRASE = "passphrase";
|
||||
|
||||
/* Service Bundle returns */
|
||||
public static final String RESULT_CODE = "result_code";
|
||||
|
Loading…
Reference in New Issue
Block a user