use autovalue for PgpDecryptVerifyInputParcel

This commit is contained in:
Vincent Breitmoser
2017-05-23 21:47:21 +02:00
parent 76e9f6b229
commit 79af393847
9 changed files with 119 additions and 184 deletions

View File

@@ -103,9 +103,10 @@ public class BenchmarkOperation extends BaseOperation<BenchmarkInputParcel> {
PgpDecryptVerifyOperation op =
new PgpDecryptVerifyOperation(mContext, mKeyRepository,
new ProgressScaler(mProgressable, 50 +i*(50/numRepeats), 50 +(i+1)*(50/numRepeats), 100));
PgpDecryptVerifyInputParcel input = new PgpDecryptVerifyInputParcel(encryptResult.getResultBytes());
input.setAllowSymmetricDecryption(true);
decryptResult = op.execute(input, CryptoInputParcel.createCryptoInputParcel(passphrase));
PgpDecryptVerifyInputParcel.Builder builder = PgpDecryptVerifyInputParcel.builder()
.setInputBytes(encryptResult.getResultBytes())
.setAllowSymmetricDecryption(true);
decryptResult = op.execute(builder.build(), CryptoInputParcel.createCryptoInputParcel(passphrase));
log.add(decryptResult, 1);
log.add(LogType.MSG_BENCH_DEC_TIME, 2, String.format("%.2f", decryptResult.mOperationTime / 1000.0));
totalTime += decryptResult.mOperationTime;

View File

@@ -103,10 +103,12 @@ public class InputDataOperation extends BaseOperation<InputDataParcel> {
PgpDecryptVerifyOperation op =
new PgpDecryptVerifyOperation(mContext, mKeyRepository, mProgressable);
decryptInput.setInputUri(input.getInputUri());
currentInputUri = TemporaryFileProvider.createFile(mContext);
decryptInput.setOutputUri(currentInputUri);
decryptInput = decryptInput.toBuilder()
.setInputUri(input.getInputUri())
.setOutputUri(currentInputUri)
.build();
decryptResult = op.execute(decryptInput, cryptoInput);
if (decryptResult.isPending()) {
@@ -264,9 +266,10 @@ public class InputDataOperation extends BaseOperation<InputDataParcel> {
}
detachedSig.close();
PgpDecryptVerifyInputParcel decryptInput = new PgpDecryptVerifyInputParcel();
decryptInput.setInputUri(uncheckedSignedDataUri);
decryptInput.setDetachedSignature(detachedSig.toByteArray());
PgpDecryptVerifyInputParcel decryptInput = PgpDecryptVerifyInputParcel.builder()
.setInputUri(uncheckedSignedDataUri)
.setDetachedSignature(detachedSig.toByteArray())
.build();
PgpDecryptVerifyOperation op =
new PgpDecryptVerifyOperation(mContext, mKeyRepository, mProgressable);

View File

@@ -152,7 +152,9 @@ public class KeybaseVerificationOperation extends BaseOperation<KeybaseVerificat
PgpDecryptVerifyOperation op = new PgpDecryptVerifyOperation(mContext, mKeyRepository, mProgressable);
PgpDecryptVerifyInputParcel input = new PgpDecryptVerifyInputParcel(messageBytes);
PgpDecryptVerifyInputParcel input = PgpDecryptVerifyInputParcel.builder()
.setInputBytes(messageBytes)
.build();
DecryptVerifyResult decryptVerifyResult = op.execute(input, CryptoInputParcel.createCryptoInputParcel());