cleanup, NonNull annotation, never return null in PgpDecryptVerify
This commit is contained in:
@@ -19,6 +19,7 @@ package org.sufficientlysecure.keychain.operations;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Parcelable;
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
import org.sufficientlysecure.keychain.operations.results.OperationResult;
|
||||
import org.sufficientlysecure.keychain.pgp.PassphraseCacheInterface;
|
||||
@@ -76,9 +77,8 @@ public abstract class BaseOperation <T extends Parcelable> implements Passphrase
|
||||
mCancelled = cancelled;
|
||||
}
|
||||
|
||||
public OperationResult execute(T input, CryptoInputParcel cryptoInput) {
|
||||
return null;
|
||||
}
|
||||
@NonNull
|
||||
public abstract OperationResult execute(T input, CryptoInputParcel cryptoInput);
|
||||
|
||||
public void updateProgress(int message, int current, int total) {
|
||||
if (mProgressable != null) {
|
||||
|
||||
@@ -18,10 +18,9 @@
|
||||
package org.sufficientlysecure.keychain.operations;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.keyimport.HkpKeyserver;
|
||||
import org.sufficientlysecure.keychain.keyimport.Keyserver;
|
||||
import org.sufficientlysecure.keychain.operations.results.CertifyResult;
|
||||
import org.sufficientlysecure.keychain.operations.results.ExportResult;
|
||||
import org.sufficientlysecure.keychain.operations.results.OperationResult.LogType;
|
||||
@@ -44,7 +43,6 @@ import org.sufficientlysecure.keychain.service.input.CryptoInputParcel;
|
||||
import org.sufficientlysecure.keychain.service.input.RequiredInputParcel;
|
||||
import org.sufficientlysecure.keychain.service.input.RequiredInputParcel.NfcSignOperationsBuilder;
|
||||
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
|
||||
import org.sufficientlysecure.keychain.util.ParcelableProxy;
|
||||
import org.sufficientlysecure.keychain.util.Passphrase;
|
||||
import org.sufficientlysecure.keychain.util.Preferences;
|
||||
import org.sufficientlysecure.keychain.util.orbot.OrbotHelper;
|
||||
@@ -69,6 +67,7 @@ public class CertifyOperation extends BaseOperation<CertifyActionsParcel> {
|
||||
super(context, providerHelper, progressable, cancelled);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public CertifyResult execute(CertifyActionsParcel parcel, CryptoInputParcel cryptoInput) {
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
package org.sufficientlysecure.keychain.operations;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
import org.sufficientlysecure.keychain.operations.results.ConsolidateResult;
|
||||
import org.sufficientlysecure.keychain.pgp.Progressable;
|
||||
@@ -34,6 +35,7 @@ public class ConsolidateOperation extends BaseOperation<ConsolidateInputParcel>
|
||||
super(context, providerHelper, progressable);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ConsolidateResult execute(ConsolidateInputParcel consolidateInputParcel,
|
||||
CryptoInputParcel cryptoInputParcel) {
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
package org.sufficientlysecure.keychain.operations;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
import org.sufficientlysecure.keychain.operations.results.ConsolidateResult;
|
||||
import org.sufficientlysecure.keychain.operations.results.DeleteResult;
|
||||
@@ -45,6 +46,7 @@ public class DeleteOperation extends BaseOperation<DeleteKeyringParcel> {
|
||||
super(context, providerHelper, progressable);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public DeleteResult execute(DeleteKeyringParcel deleteKeyringParcel,
|
||||
CryptoInputParcel cryptoInputParcel) {
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
package org.sufficientlysecure.keychain.operations;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.operations.results.EditKeyResult;
|
||||
@@ -57,6 +58,7 @@ public class EditKeyOperation extends BaseOperation<SaveKeyringParcel> {
|
||||
super(context, providerHelper, progressable, cancelled);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public OperationResult execute(SaveKeyringParcel saveParcel, CryptoInputParcel cryptoInput) {
|
||||
|
||||
OperationLog log = new OperationLog();
|
||||
|
||||
@@ -21,6 +21,7 @@ package org.sufficientlysecure.keychain.operations;
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
import org.spongycastle.bcpg.ArmoredOutputStream;
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
@@ -329,6 +330,7 @@ public class ExportOperation extends BaseOperation<ExportKeyringParcel> {
|
||||
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public ExportResult execute(ExportKeyringParcel exportInput, CryptoInputParcel cryptoInput) {
|
||||
switch (exportInput.mExportType) {
|
||||
case UPLOAD_KEYSERVER: {
|
||||
@@ -364,8 +366,8 @@ public class ExportOperation extends BaseOperation<ExportKeyringParcel> {
|
||||
return exportToUri(exportInput.mMasterKeyIds, exportInput.mExportSecret,
|
||||
exportInput.mOutputUri);
|
||||
}
|
||||
default: { // can't happen
|
||||
return null;
|
||||
default: { // can never happen, all enum types must be handled above
|
||||
throw new AssertionError("must not happen, this is a bug!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,24 @@
|
||||
|
||||
package org.sufficientlysecure.keychain.operations;
|
||||
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.Proxy;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.ExecutorCompletionService;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.SynchronousQueue;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
@@ -28,7 +45,6 @@ import org.sufficientlysecure.keychain.keyimport.Keyserver;
|
||||
import org.sufficientlysecure.keychain.keyimport.ParcelableKeyRing;
|
||||
import org.sufficientlysecure.keychain.operations.results.ConsolidateResult;
|
||||
import org.sufficientlysecure.keychain.operations.results.ImportKeyResult;
|
||||
import org.sufficientlysecure.keychain.operations.results.InputPendingResult;
|
||||
import org.sufficientlysecure.keychain.operations.results.OperationResult;
|
||||
import org.sufficientlysecure.keychain.operations.results.OperationResult.LogType;
|
||||
import org.sufficientlysecure.keychain.operations.results.OperationResult.OperationLog;
|
||||
@@ -48,21 +64,6 @@ import org.sufficientlysecure.keychain.util.Preferences;
|
||||
import org.sufficientlysecure.keychain.util.ProgressScaler;
|
||||
import org.sufficientlysecure.keychain.util.orbot.OrbotHelper;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.Proxy;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.ExecutorCompletionService;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.SynchronousQueue;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
/**
|
||||
* An operation class which implements high level import
|
||||
* operations.
|
||||
@@ -118,6 +119,7 @@ public class ImportOperation extends BaseOperation<ImportKeyringParcel> {
|
||||
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public ImportKeyResult serialKeyRingImport(ParcelableFileCache<ParcelableKeyRing> cache,
|
||||
String keyServerUri, Proxy proxy) {
|
||||
|
||||
@@ -148,8 +150,8 @@ public class ImportOperation extends BaseOperation<ImportKeyringParcel> {
|
||||
* @param keyServerUri contains uri of keyserver to import from, if it is an import from cloud
|
||||
* @param progressable Allows multi-threaded import to supply a progressable that ignores the
|
||||
* progress of a single key being imported
|
||||
* @return
|
||||
*/
|
||||
@NonNull
|
||||
public ImportKeyResult serialKeyRingImport(Iterator<ParcelableKeyRing> entries, int num,
|
||||
String keyServerUri, Progressable progressable,
|
||||
Proxy proxy) {
|
||||
@@ -380,6 +382,7 @@ public class ImportOperation extends BaseOperation<ImportKeyringParcel> {
|
||||
importedMasterKeyIdsArray);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public OperationResult execute(ImportKeyringParcel importInput, CryptoInputParcel cryptoInput) {
|
||||
ArrayList<ParcelableKeyRing> keyList = importInput.mKeyList;
|
||||
@@ -426,6 +429,7 @@ public class ImportOperation extends BaseOperation<ImportKeyringParcel> {
|
||||
return result;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
private ImportKeyResult multiThreadedKeyImport(Iterator<ParcelableKeyRing> keyListIterator,
|
||||
int totKeys, final String keyServer,
|
||||
final Proxy proxy) {
|
||||
@@ -441,7 +445,7 @@ public class ImportOperation extends BaseOperation<ImportKeyringParcel> {
|
||||
new SynchronousQueue<Runnable>());
|
||||
|
||||
ExecutorCompletionService<ImportKeyResult> importCompletionService =
|
||||
new ExecutorCompletionService(importExecutor);
|
||||
new ExecutorCompletionService<>(importExecutor);
|
||||
|
||||
while (keyListIterator.hasNext()) { // submit all key rings to be imported
|
||||
|
||||
|
||||
@@ -19,7 +19,15 @@
|
||||
|
||||
package org.sufficientlysecure.keychain.operations;
|
||||
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.net.Proxy;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
import com.textuality.keybase.lib.Proof;
|
||||
import com.textuality.keybase.lib.prover.Prover;
|
||||
@@ -32,7 +40,6 @@ import de.measite.minidns.record.TXT;
|
||||
import org.json.JSONObject;
|
||||
import org.spongycastle.openpgp.PGPUtil;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.operations.results.CertifyResult;
|
||||
import org.sufficientlysecure.keychain.operations.results.DecryptVerifyResult;
|
||||
import org.sufficientlysecure.keychain.operations.results.KeybaseVerificationResult;
|
||||
import org.sufficientlysecure.keychain.operations.results.OperationResult;
|
||||
@@ -46,12 +53,6 @@ import org.sufficientlysecure.keychain.service.input.RequiredInputParcel;
|
||||
import org.sufficientlysecure.keychain.util.Preferences;
|
||||
import org.sufficientlysecure.keychain.util.orbot.OrbotHelper;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.net.Proxy;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class KeybaseVerificationOperation extends BaseOperation<KeybaseVerificationParcel> {
|
||||
|
||||
public KeybaseVerificationOperation(Context context, ProviderHelper providerHelper,
|
||||
@@ -59,6 +60,7 @@ public class KeybaseVerificationOperation extends BaseOperation<KeybaseVerificat
|
||||
super(context, providerHelper, progressable);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public KeybaseVerificationResult execute(KeybaseVerificationParcel keybaseInput,
|
||||
CryptoInputParcel cryptoInput) {
|
||||
@@ -113,7 +115,7 @@ public class KeybaseVerificationOperation extends BaseOperation<KeybaseVerificat
|
||||
return new KeybaseVerificationResult(OperationResult.RESULT_ERROR, log);
|
||||
}
|
||||
Record[] records = dnsQuery.getAnswers();
|
||||
List<List<byte[]>> extents = new ArrayList<List<byte[]>>();
|
||||
List<List<byte[]>> extents = new ArrayList<>();
|
||||
for (Record r : records) {
|
||||
Data d = r.getPayload();
|
||||
if (d instanceof TXT) {
|
||||
|
||||
@@ -17,7 +17,11 @@
|
||||
|
||||
package org.sufficientlysecure.keychain.operations;
|
||||
|
||||
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.operations.results.OperationResult.LogType;
|
||||
@@ -36,8 +40,6 @@ import org.sufficientlysecure.keychain.service.input.CryptoInputParcel;
|
||||
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
|
||||
import org.sufficientlysecure.keychain.util.ProgressScaler;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
/** An operation which promotes a public key ring to a secret one.
|
||||
*
|
||||
* This operation can only be applied to public key rings where no secret key
|
||||
@@ -52,18 +54,10 @@ public class PromoteKeyOperation extends BaseOperation<PromoteKeyringParcel> {
|
||||
super(context, providerHelper, progressable, cancelled);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public PromoteKeyResult execute(PromoteKeyringParcel promoteKeyringParcel,
|
||||
CryptoInputParcel cryptoInputParcel) {
|
||||
// Input
|
||||
long masterKeyId = promoteKeyringParcel.mKeyRingId;
|
||||
byte[] cardAid = promoteKeyringParcel.mCardAid;
|
||||
long[] subKeyIds = promoteKeyringParcel.mSubKeyIds;
|
||||
|
||||
return execute(masterKeyId, cardAid, subKeyIds);
|
||||
}
|
||||
|
||||
public PromoteKeyResult execute(long masterKeyId, byte[] cardAid, long[] subKeyIds) {
|
||||
|
||||
OperationLog log = new OperationLog();
|
||||
log.add(LogType.MSG_PR, 0);
|
||||
@@ -74,17 +68,17 @@ public class PromoteKeyOperation extends BaseOperation<PromoteKeyringParcel> {
|
||||
try {
|
||||
|
||||
log.add(LogType.MSG_PR_FETCHING, 1,
|
||||
KeyFormattingUtils.convertKeyIdToHex(masterKeyId));
|
||||
KeyFormattingUtils.convertKeyIdToHex(promoteKeyringParcel.mKeyRingId));
|
||||
CanonicalizedPublicKeyRing pubRing =
|
||||
mProviderHelper.getCanonicalizedPublicKeyRing(masterKeyId);
|
||||
mProviderHelper.getCanonicalizedPublicKeyRing(promoteKeyringParcel.mKeyRingId);
|
||||
|
||||
if (subKeyIds == null) {
|
||||
if (promoteKeyringParcel.mSubKeyIds == null) {
|
||||
log.add(LogType.MSG_PR_ALL, 1);
|
||||
} else {
|
||||
// sort for binary search
|
||||
for (CanonicalizedPublicKey key : pubRing.publicKeyIterator()) {
|
||||
long subKeyId = key.getKeyId();
|
||||
if (naiveIndexOf(subKeyIds, subKeyId) != null) {
|
||||
if (naiveIndexOf(promoteKeyringParcel.mSubKeyIds, subKeyId) != null) {
|
||||
log.add(LogType.MSG_PR_SUBKEY_MATCH, 1,
|
||||
KeyFormattingUtils.convertKeyIdToHex(subKeyId));
|
||||
} else {
|
||||
@@ -95,7 +89,8 @@ public class PromoteKeyOperation extends BaseOperation<PromoteKeyringParcel> {
|
||||
}
|
||||
|
||||
// create divert-to-card secret key from public key
|
||||
promotedRing = pubRing.createDivertSecretRing(cardAid, subKeyIds);
|
||||
promotedRing = pubRing.createDivertSecretRing(promoteKeyringParcel.mCardAid,
|
||||
promoteKeyringParcel.mSubKeyIds);
|
||||
|
||||
} catch (NotFoundException e) {
|
||||
log.add(LogType.MSG_PR_ERROR_KEY_NOT_FOUND, 2);
|
||||
|
||||
@@ -19,6 +19,7 @@ package org.sufficientlysecure.keychain.operations;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.operations.results.OperationResult.LogType;
|
||||
@@ -62,6 +63,7 @@ public class SignEncryptOperation extends BaseOperation<SignEncryptParcel> {
|
||||
super(context, providerHelper, progressable, cancelled);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public SignEncryptResult execute(SignEncryptParcel input, CryptoInputParcel cryptoInput) {
|
||||
|
||||
OperationLog log = new OperationLog();
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
package org.sufficientlysecure.keychain.pgp;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.webkit.MimeTypeMap;
|
||||
|
||||
import org.openintents.openpgp.OpenPgpMetadata;
|
||||
@@ -80,9 +81,8 @@ public class PgpDecryptVerify extends BaseOperation<PgpDecryptVerifyInputParcel>
|
||||
super(context, providerHelper, progressable);
|
||||
}
|
||||
|
||||
/**
|
||||
* Decrypts and/or verifies data based on parameters of class
|
||||
*/
|
||||
/** Decrypts and/or verifies data based on parameters of PgpDecryptVerifyInputParcel. */
|
||||
@NonNull
|
||||
public DecryptVerifyResult execute(PgpDecryptVerifyInputParcel input, CryptoInputParcel cryptoInput) {
|
||||
InputData inputData;
|
||||
OutputStream outputStream;
|
||||
@@ -96,8 +96,10 @@ public class PgpDecryptVerify extends BaseOperation<PgpDecryptVerifyInputParcel>
|
||||
long inputSize = FileHelper.getFileSize(mContext, input.getInputUri(), 0);
|
||||
inputData = new InputData(inputStream, inputSize);
|
||||
} catch (FileNotFoundException e) {
|
||||
Log.e(Constants.TAG, "File not found at " + input.getInputUri(), e);
|
||||
return null;
|
||||
Log.e(Constants.TAG, "URI could not be opened: " + input.getInputUri(), e);
|
||||
OperationLog log = new OperationLog();
|
||||
log.add(LogType.MSG_DC_ERROR_IO, 1);
|
||||
return new DecryptVerifyResult(DecryptVerifyResult.RESULT_ERROR, log);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,8 +109,10 @@ public class PgpDecryptVerify extends BaseOperation<PgpDecryptVerifyInputParcel>
|
||||
try {
|
||||
outputStream = mContext.getContentResolver().openOutputStream(input.getOutputUri());
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
Log.e(Constants.TAG, "URI could not be opened: " + input.getOutputUri(), e);
|
||||
OperationLog log = new OperationLog();
|
||||
log.add(LogType.MSG_DC_ERROR_IO, 1);
|
||||
return new DecryptVerifyResult(DecryptVerifyResult.RESULT_ERROR, log);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,11 +126,13 @@ public class PgpDecryptVerify extends BaseOperation<PgpDecryptVerifyInputParcel>
|
||||
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public DecryptVerifyResult execute(PgpDecryptVerifyInputParcel input, CryptoInputParcel cryptoInput,
|
||||
InputData inputData, OutputStream outputStream) {
|
||||
return executeInternal(input, cryptoInput, inputData, outputStream);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
private DecryptVerifyResult executeInternal(PgpDecryptVerifyInputParcel input, CryptoInputParcel cryptoInput,
|
||||
InputData inputData, OutputStream outputStream) {
|
||||
try {
|
||||
@@ -169,9 +175,8 @@ public class PgpDecryptVerify extends BaseOperation<PgpDecryptVerifyInputParcel>
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify Keybase.io style signed literal data
|
||||
*/
|
||||
/**Verify signed plaintext data (PGP/INLINE). */
|
||||
@NonNull
|
||||
private DecryptVerifyResult verifySignedLiteralData(
|
||||
PgpDecryptVerifyInputParcel input, InputStream in, OutputStream out, int indent)
|
||||
throws IOException, PGPException {
|
||||
@@ -301,9 +306,8 @@ public class PgpDecryptVerify extends BaseOperation<PgpDecryptVerifyInputParcel>
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Decrypt and/or verifies binary or ascii armored pgp
|
||||
*/
|
||||
/** Decrypt and/or verify binary or ascii armored pgp data. */
|
||||
@NonNull
|
||||
private DecryptVerifyResult decryptVerify(
|
||||
PgpDecryptVerifyInputParcel input, CryptoInputParcel cryptoInput,
|
||||
InputStream in, OutputStream out, int indent) throws IOException, PGPException {
|
||||
@@ -843,6 +847,7 @@ public class PgpDecryptVerify extends BaseOperation<PgpDecryptVerifyInputParcel>
|
||||
* The method is heavily based on
|
||||
* pg/src/main/java/org/spongycastle/openpgp/examples/ClearSignedFileProcessor.java
|
||||
*/
|
||||
@NonNull
|
||||
private DecryptVerifyResult verifyCleartextSignature(
|
||||
ArmoredInputStream aIn, OutputStream outputStream, int indent) throws IOException, PGPException {
|
||||
|
||||
@@ -950,6 +955,7 @@ public class PgpDecryptVerify extends BaseOperation<PgpDecryptVerifyInputParcel>
|
||||
return result;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
private DecryptVerifyResult verifyDetachedSignature(
|
||||
PgpDecryptVerifyInputParcel input, InputData inputData, OutputStream out, int indent)
|
||||
throws IOException, PGPException {
|
||||
@@ -1042,7 +1048,9 @@ public class PgpDecryptVerify extends BaseOperation<PgpDecryptVerifyInputParcel>
|
||||
return result;
|
||||
}
|
||||
|
||||
private PGPSignature processPGPSignatureList(PGPSignatureList sigList, OpenPgpSignatureResultBuilder signatureResultBuilder) throws PGPException {
|
||||
private PGPSignature processPGPSignatureList(
|
||||
PGPSignatureList sigList, OpenPgpSignatureResultBuilder signatureResultBuilder)
|
||||
throws PGPException {
|
||||
CanonicalizedPublicKeyRing signingRing = null;
|
||||
CanonicalizedPublicKey signingKey = null;
|
||||
int signatureIndex = -1;
|
||||
|
||||
@@ -1060,6 +1060,7 @@ public class ProviderHelper {
|
||||
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public ConsolidateResult consolidateDatabaseStep1(Progressable progress) {
|
||||
|
||||
OperationLog log = new OperationLog();
|
||||
@@ -1205,12 +1206,14 @@ public class ProviderHelper {
|
||||
return consolidateDatabaseStep2(log, indent, progress, false);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public ConsolidateResult consolidateDatabaseStep2(Progressable progress) {
|
||||
return consolidateDatabaseStep2(new OperationLog(), 0, progress, true);
|
||||
}
|
||||
|
||||
private static boolean mConsolidateCritical = false;
|
||||
|
||||
@NonNull
|
||||
private ConsolidateResult consolidateDatabaseStep2(
|
||||
OperationLog log, int indent, Progressable progress, boolean recovery) {
|
||||
|
||||
|
||||
@@ -314,14 +314,6 @@ public class CryptoOperationHelper<T extends Parcelable, S extends OperationResu
|
||||
cryptoOperation(new CryptoInputParcel());
|
||||
}
|
||||
|
||||
protected void onCryptoOperationResult(S result) {
|
||||
if (result.success()) {
|
||||
mCallback.onCryptoOperationSuccess(result);
|
||||
} else {
|
||||
mCallback.onCryptoOperationError(result);
|
||||
}
|
||||
}
|
||||
|
||||
public void onHandleResult(OperationResult result, CryptoInputParcel oldCryptoInput) {
|
||||
Log.d(Constants.TAG, "Handling result in OperationHelper success: " + result.success());
|
||||
|
||||
@@ -338,8 +330,13 @@ public class CryptoOperationHelper<T extends Parcelable, S extends OperationResu
|
||||
dismissProgress();
|
||||
|
||||
try {
|
||||
// noinspection unchecked, because type erasure :(
|
||||
onCryptoOperationResult((S) result);
|
||||
if (result.success()) {
|
||||
// noinspection unchecked, because type erasure :(
|
||||
mCallback.onCryptoOperationSuccess((S) result);
|
||||
} else {
|
||||
// noinspection unchecked, because type erasure :(
|
||||
mCallback.onCryptoOperationError((S) result);
|
||||
}
|
||||
} catch (ClassCastException e) {
|
||||
throw new AssertionError("bad return class ("
|
||||
+ result.getClass().getSimpleName() + "), this is a programming error!");
|
||||
|
||||
Reference in New Issue
Block a user