aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java
diff options
context:
space:
mode:
authorVincent Breitmoser <valodim@mugenguild.com>2015-03-20 14:22:07 +0100
committerVincent Breitmoser <valodim@mugenguild.com>2015-03-20 14:22:07 +0100
commit3fce6d8a12884519fa77e1500e8f8441b3aa43cd (patch)
tree1f5ae39a75f54f009f189d0b6537288c0f834d9f /OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java
parent879efc2c703d55cf3a50dc3c427129555ad58004 (diff)
downloadopen-keychain-3fce6d8a12884519fa77e1500e8f8441b3aa43cd.tar.gz
open-keychain-3fce6d8a12884519fa77e1500e8f8441b3aa43cd.tar.bz2
open-keychain-3fce6d8a12884519fa77e1500e8f8441b3aa43cd.zip
inline mNfcSignOps variable
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java')
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java33
1 files changed, 16 insertions, 17 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java
index 0bae93055..51f8460a4 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java
@@ -36,7 +36,6 @@ import org.spongycastle.openpgp.PGPUserAttributeSubpacketVector;
import org.spongycastle.openpgp.operator.PBESecretKeyDecryptor;
import org.spongycastle.openpgp.operator.PBESecretKeyEncryptor;
import org.spongycastle.openpgp.operator.PGPContentSignerBuilder;
-import org.spongycastle.openpgp.operator.PGPDataDecryptor;
import org.spongycastle.openpgp.operator.PGPDigestCalculator;
import org.spongycastle.openpgp.operator.jcajce.JcaKeyFingerprintCalculator;
import org.spongycastle.openpgp.operator.jcajce.JcaPGPContentSignerBuilder;
@@ -96,8 +95,6 @@ public class PgpKeyOperation {
private Stack<Progressable> mProgress;
private AtomicBoolean mCancelled;
- NfcSignOperationsBuilder mNfcSignOps;
-
public PgpKeyOperation(Progressable progress) {
super();
if (progress != null) {
@@ -106,10 +103,9 @@ public class PgpKeyOperation {
}
}
- public PgpKeyOperation(Progressable progress, AtomicBoolean cancelled, CryptoInputParcel cryptoInput) {
+ public PgpKeyOperation(Progressable progress, AtomicBoolean cancelled) {
this(progress);
mCancelled = cancelled;
- mNfcSignOps = new NfcSignOperationsBuilder(cryptoInput.getSignatureTime());
}
private boolean checkCancelled() {
@@ -428,6 +424,8 @@ public class PgpKeyOperation {
int indent = 1;
+ NfcSignOperationsBuilder nfcSignOps = new NfcSignOperationsBuilder(cryptoInput.getSignatureTime());
+
progress(R.string.progress_modify, 0);
PGPPublicKey masterPublicKey = masterSecretKey.getPublicKey();
@@ -474,7 +472,7 @@ public class PgpKeyOperation {
String userId = saveParcel.mAddUserIds.get(i);
log.add(LogType.MSG_MF_UID_ADD, indent, userId);
- if (userId.equals("")) {
+ if ("".equals(userId)) {
log.add(LogType.MSG_MF_UID_ERROR_EMPTY, indent + 1);
return new PgpEditKeyResult(PgpEditKeyResult.RESULT_ERROR, log, null);
}
@@ -513,7 +511,7 @@ public class PgpKeyOperation {
isPrimary, masterKeyFlags, masterKeyExpiry);
modifiedPublicKey = PGPPublicKey.addCertification(modifiedPublicKey, userId, cert);
} catch (NfcInteractionNeeded e) {
- mNfcSignOps.addHash(e.hashToSign, e.hashAlgo);
+ nfcSignOps.addHash(e.hashToSign, e.hashAlgo);
}
}
subProgressPop();
@@ -548,7 +546,7 @@ public class PgpKeyOperation {
masterPrivateKey, masterPublicKey, vector);
modifiedPublicKey = PGPPublicKey.addCertification(modifiedPublicKey, vector, cert);
} catch (NfcInteractionNeeded e) {
- mNfcSignOps.addHash(e.hashToSign, e.hashAlgo);
+ nfcSignOps.addHash(e.hashToSign, e.hashAlgo);
}
}
subProgressPop();
@@ -584,7 +582,7 @@ public class PgpKeyOperation {
masterPrivateKey, masterPublicKey, userId);
modifiedPublicKey = PGPPublicKey.addCertification(modifiedPublicKey, userId, cert);
} catch (NfcInteractionNeeded e) {
- mNfcSignOps.addHash(e.hashToSign, e.hashAlgo);
+ nfcSignOps.addHash(e.hashToSign, e.hashAlgo);
}
}
subProgressPop();
@@ -664,7 +662,7 @@ public class PgpKeyOperation {
modifiedPublicKey = PGPPublicKey.addCertification(
modifiedPublicKey, userId, newCert);
} catch (NfcInteractionNeeded e) {
- mNfcSignOps.addHash(e.hashToSign, e.hashAlgo);
+ nfcSignOps.addHash(e.hashToSign, e.hashAlgo);
}
continue;
@@ -687,7 +685,7 @@ public class PgpKeyOperation {
modifiedPublicKey = PGPPublicKey.addCertification(
modifiedPublicKey, userId, newCert);
} catch (NfcInteractionNeeded e) {
- mNfcSignOps.addHash(e.hashToSign, e.hashAlgo);
+ nfcSignOps.addHash(e.hashToSign, e.hashAlgo);
}
ok = true;
}
@@ -777,7 +775,7 @@ public class PgpKeyOperation {
PGPPublicKey pKey =
updateMasterCertificates(
masterSecretKey, masterPrivateKey, masterPublicKey,
- flags, expiry, cryptoInput, indent, log);
+ flags, expiry, cryptoInput, nfcSignOps, indent, log);
if (pKey == null) {
// error log entry has already been added by updateMasterCertificates itself
return new PgpEditKeyResult(PgpEditKeyResult.RESULT_ERROR, log, null);
@@ -856,7 +854,7 @@ public class PgpKeyOperation {
pKey = PGPPublicKey.addCertification(pKey, sig);
sKR = PGPSecretKeyRing.insertSecretKey(sKR, PGPSecretKey.replacePublicKey(sKey, pKey));
} catch (NfcInteractionNeeded e) {
- mNfcSignOps.addHash(e.hashToSign, e.hashAlgo);
+ nfcSignOps.addHash(e.hashToSign, e.hashAlgo);
}
}
subProgressPop();
@@ -908,7 +906,7 @@ public class PgpKeyOperation {
add.mFlags, add.mExpiry);
pKey = PGPPublicKey.addSubkeyBindingCertification(pKey, cert);
} catch (NfcInteractionNeeded e) {
- mNfcSignOps.addHash(e.hashToSign, e.hashAlgo);
+ nfcSignOps.addHash(e.hashToSign, e.hashAlgo);
}
PGPSecretKey sKey; {
@@ -972,9 +970,9 @@ public class PgpKeyOperation {
progress(R.string.progress_done, 100);
- if (!mNfcSignOps.isEmpty()) {
+ if (!nfcSignOps.isEmpty()) {
log.add(LogType.MSG_MF_INPUT_REQUIRED, indent);
- return new PgpEditKeyResult(log, mNfcSignOps.build());
+ return new PgpEditKeyResult(log, nfcSignOps.build());
}
log.add(LogType.MSG_MF_SUCCESS, indent);
@@ -1205,6 +1203,7 @@ public class PgpKeyOperation {
PGPPublicKey masterPublicKey,
int flags, long expiry,
CryptoInputParcel cryptoInput,
+ NfcSignOperationsBuilder nfcSignOps,
int indent, OperationLog log)
throws PGPException, IOException, SignatureException {
@@ -1268,7 +1267,7 @@ public class PgpKeyOperation {
modifiedPublicKey = PGPPublicKey.addCertification(
modifiedPublicKey, userId, newCert);
} catch (NfcInteractionNeeded e) {
- mNfcSignOps.addHash(e.hashToSign, e.hashAlgo);
+ nfcSignOps.addHash(e.hashToSign, e.hashAlgo);
}
ok = true;