Builder pattern for PgpOperationIncoming
This commit is contained in:
@@ -481,13 +481,16 @@ public class KeychainIntentService extends IntentService implements ProgressDial
|
||||
|
||||
// verifyText and decrypt returning additional resultData values for the
|
||||
// verification of signatures
|
||||
PgpOperationIncoming operation = new PgpOperationIncoming(this, this, inputData, outStream);
|
||||
PgpOperationIncoming.Builder builder = new PgpOperationIncoming.Builder(this, inputData, outStream);
|
||||
builder.progress(this);
|
||||
|
||||
if (signedOnly) {
|
||||
resultData = operation.verifyText();
|
||||
resultData = builder.build().verifyText();
|
||||
} else {
|
||||
resultData = operation.decryptAndVerify(
|
||||
PassphraseCacheService.getCachedPassphrase(this, secretKeyId),
|
||||
assumeSymmetricEncryption);
|
||||
builder.assumeSymmetric(assumeSymmetricEncryption)
|
||||
.passphrase(PassphraseCacheService.getCachedPassphrase(this, secretKeyId));
|
||||
|
||||
resultData = builder.build().decryptAndVerify();
|
||||
}
|
||||
|
||||
outStream.close();
|
||||
|
||||
@@ -384,15 +384,19 @@ public class OpenPgpService extends RemoteService {
|
||||
|
||||
|
||||
Bundle outputBundle;
|
||||
PgpOperationIncoming operation = new PgpOperationIncoming(getContext(), null, inputData, os);
|
||||
PgpOperationIncoming.Builder builder = new PgpOperationIncoming.Builder(this, inputData, os);
|
||||
|
||||
if (signedOnly) {
|
||||
outputBundle = operation.verifyText();
|
||||
outputBundle = builder.build().verifyText();
|
||||
} else {
|
||||
builder.assumeSymmetric(false)
|
||||
.passphrase(passphrase);
|
||||
|
||||
// Do we want to do this: instead of trying to get the passphrase before
|
||||
// pause stream when passphrase is missing and then resume???
|
||||
|
||||
// TODO: this also decrypts with other secret keys without passphrase!!!
|
||||
outputBundle = operation.decryptAndVerify(passphrase, false);
|
||||
outputBundle = builder.build().decryptAndVerify();
|
||||
}
|
||||
|
||||
// outputStream.close();
|
||||
|
||||
Reference in New Issue
Block a user