mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-12-24 07:58:50 -05:00
inline mNfcSignOps variable
This commit is contained in:
parent
879efc2c70
commit
3fce6d8a12
@ -36,7 +36,6 @@ import org.spongycastle.openpgp.PGPUserAttributeSubpacketVector;
|
|||||||
import org.spongycastle.openpgp.operator.PBESecretKeyDecryptor;
|
import org.spongycastle.openpgp.operator.PBESecretKeyDecryptor;
|
||||||
import org.spongycastle.openpgp.operator.PBESecretKeyEncryptor;
|
import org.spongycastle.openpgp.operator.PBESecretKeyEncryptor;
|
||||||
import org.spongycastle.openpgp.operator.PGPContentSignerBuilder;
|
import org.spongycastle.openpgp.operator.PGPContentSignerBuilder;
|
||||||
import org.spongycastle.openpgp.operator.PGPDataDecryptor;
|
|
||||||
import org.spongycastle.openpgp.operator.PGPDigestCalculator;
|
import org.spongycastle.openpgp.operator.PGPDigestCalculator;
|
||||||
import org.spongycastle.openpgp.operator.jcajce.JcaKeyFingerprintCalculator;
|
import org.spongycastle.openpgp.operator.jcajce.JcaKeyFingerprintCalculator;
|
||||||
import org.spongycastle.openpgp.operator.jcajce.JcaPGPContentSignerBuilder;
|
import org.spongycastle.openpgp.operator.jcajce.JcaPGPContentSignerBuilder;
|
||||||
@ -96,8 +95,6 @@ public class PgpKeyOperation {
|
|||||||
private Stack<Progressable> mProgress;
|
private Stack<Progressable> mProgress;
|
||||||
private AtomicBoolean mCancelled;
|
private AtomicBoolean mCancelled;
|
||||||
|
|
||||||
NfcSignOperationsBuilder mNfcSignOps;
|
|
||||||
|
|
||||||
public PgpKeyOperation(Progressable progress) {
|
public PgpKeyOperation(Progressable progress) {
|
||||||
super();
|
super();
|
||||||
if (progress != null) {
|
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);
|
this(progress);
|
||||||
mCancelled = cancelled;
|
mCancelled = cancelled;
|
||||||
mNfcSignOps = new NfcSignOperationsBuilder(cryptoInput.getSignatureTime());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean checkCancelled() {
|
private boolean checkCancelled() {
|
||||||
@ -428,6 +424,8 @@ public class PgpKeyOperation {
|
|||||||
|
|
||||||
int indent = 1;
|
int indent = 1;
|
||||||
|
|
||||||
|
NfcSignOperationsBuilder nfcSignOps = new NfcSignOperationsBuilder(cryptoInput.getSignatureTime());
|
||||||
|
|
||||||
progress(R.string.progress_modify, 0);
|
progress(R.string.progress_modify, 0);
|
||||||
|
|
||||||
PGPPublicKey masterPublicKey = masterSecretKey.getPublicKey();
|
PGPPublicKey masterPublicKey = masterSecretKey.getPublicKey();
|
||||||
@ -474,7 +472,7 @@ public class PgpKeyOperation {
|
|||||||
String userId = saveParcel.mAddUserIds.get(i);
|
String userId = saveParcel.mAddUserIds.get(i);
|
||||||
log.add(LogType.MSG_MF_UID_ADD, indent, userId);
|
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);
|
log.add(LogType.MSG_MF_UID_ERROR_EMPTY, indent + 1);
|
||||||
return new PgpEditKeyResult(PgpEditKeyResult.RESULT_ERROR, log, null);
|
return new PgpEditKeyResult(PgpEditKeyResult.RESULT_ERROR, log, null);
|
||||||
}
|
}
|
||||||
@ -513,7 +511,7 @@ public class PgpKeyOperation {
|
|||||||
isPrimary, masterKeyFlags, masterKeyExpiry);
|
isPrimary, masterKeyFlags, masterKeyExpiry);
|
||||||
modifiedPublicKey = PGPPublicKey.addCertification(modifiedPublicKey, userId, cert);
|
modifiedPublicKey = PGPPublicKey.addCertification(modifiedPublicKey, userId, cert);
|
||||||
} catch (NfcInteractionNeeded e) {
|
} catch (NfcInteractionNeeded e) {
|
||||||
mNfcSignOps.addHash(e.hashToSign, e.hashAlgo);
|
nfcSignOps.addHash(e.hashToSign, e.hashAlgo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
subProgressPop();
|
subProgressPop();
|
||||||
@ -548,7 +546,7 @@ public class PgpKeyOperation {
|
|||||||
masterPrivateKey, masterPublicKey, vector);
|
masterPrivateKey, masterPublicKey, vector);
|
||||||
modifiedPublicKey = PGPPublicKey.addCertification(modifiedPublicKey, vector, cert);
|
modifiedPublicKey = PGPPublicKey.addCertification(modifiedPublicKey, vector, cert);
|
||||||
} catch (NfcInteractionNeeded e) {
|
} catch (NfcInteractionNeeded e) {
|
||||||
mNfcSignOps.addHash(e.hashToSign, e.hashAlgo);
|
nfcSignOps.addHash(e.hashToSign, e.hashAlgo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
subProgressPop();
|
subProgressPop();
|
||||||
@ -584,7 +582,7 @@ public class PgpKeyOperation {
|
|||||||
masterPrivateKey, masterPublicKey, userId);
|
masterPrivateKey, masterPublicKey, userId);
|
||||||
modifiedPublicKey = PGPPublicKey.addCertification(modifiedPublicKey, userId, cert);
|
modifiedPublicKey = PGPPublicKey.addCertification(modifiedPublicKey, userId, cert);
|
||||||
} catch (NfcInteractionNeeded e) {
|
} catch (NfcInteractionNeeded e) {
|
||||||
mNfcSignOps.addHash(e.hashToSign, e.hashAlgo);
|
nfcSignOps.addHash(e.hashToSign, e.hashAlgo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
subProgressPop();
|
subProgressPop();
|
||||||
@ -664,7 +662,7 @@ public class PgpKeyOperation {
|
|||||||
modifiedPublicKey = PGPPublicKey.addCertification(
|
modifiedPublicKey = PGPPublicKey.addCertification(
|
||||||
modifiedPublicKey, userId, newCert);
|
modifiedPublicKey, userId, newCert);
|
||||||
} catch (NfcInteractionNeeded e) {
|
} catch (NfcInteractionNeeded e) {
|
||||||
mNfcSignOps.addHash(e.hashToSign, e.hashAlgo);
|
nfcSignOps.addHash(e.hashToSign, e.hashAlgo);
|
||||||
}
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
@ -687,7 +685,7 @@ public class PgpKeyOperation {
|
|||||||
modifiedPublicKey = PGPPublicKey.addCertification(
|
modifiedPublicKey = PGPPublicKey.addCertification(
|
||||||
modifiedPublicKey, userId, newCert);
|
modifiedPublicKey, userId, newCert);
|
||||||
} catch (NfcInteractionNeeded e) {
|
} catch (NfcInteractionNeeded e) {
|
||||||
mNfcSignOps.addHash(e.hashToSign, e.hashAlgo);
|
nfcSignOps.addHash(e.hashToSign, e.hashAlgo);
|
||||||
}
|
}
|
||||||
ok = true;
|
ok = true;
|
||||||
}
|
}
|
||||||
@ -777,7 +775,7 @@ public class PgpKeyOperation {
|
|||||||
PGPPublicKey pKey =
|
PGPPublicKey pKey =
|
||||||
updateMasterCertificates(
|
updateMasterCertificates(
|
||||||
masterSecretKey, masterPrivateKey, masterPublicKey,
|
masterSecretKey, masterPrivateKey, masterPublicKey,
|
||||||
flags, expiry, cryptoInput, indent, log);
|
flags, expiry, cryptoInput, nfcSignOps, indent, log);
|
||||||
if (pKey == null) {
|
if (pKey == null) {
|
||||||
// error log entry has already been added by updateMasterCertificates itself
|
// error log entry has already been added by updateMasterCertificates itself
|
||||||
return new PgpEditKeyResult(PgpEditKeyResult.RESULT_ERROR, log, null);
|
return new PgpEditKeyResult(PgpEditKeyResult.RESULT_ERROR, log, null);
|
||||||
@ -856,7 +854,7 @@ public class PgpKeyOperation {
|
|||||||
pKey = PGPPublicKey.addCertification(pKey, sig);
|
pKey = PGPPublicKey.addCertification(pKey, sig);
|
||||||
sKR = PGPSecretKeyRing.insertSecretKey(sKR, PGPSecretKey.replacePublicKey(sKey, pKey));
|
sKR = PGPSecretKeyRing.insertSecretKey(sKR, PGPSecretKey.replacePublicKey(sKey, pKey));
|
||||||
} catch (NfcInteractionNeeded e) {
|
} catch (NfcInteractionNeeded e) {
|
||||||
mNfcSignOps.addHash(e.hashToSign, e.hashAlgo);
|
nfcSignOps.addHash(e.hashToSign, e.hashAlgo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
subProgressPop();
|
subProgressPop();
|
||||||
@ -908,7 +906,7 @@ public class PgpKeyOperation {
|
|||||||
add.mFlags, add.mExpiry);
|
add.mFlags, add.mExpiry);
|
||||||
pKey = PGPPublicKey.addSubkeyBindingCertification(pKey, cert);
|
pKey = PGPPublicKey.addSubkeyBindingCertification(pKey, cert);
|
||||||
} catch (NfcInteractionNeeded e) {
|
} catch (NfcInteractionNeeded e) {
|
||||||
mNfcSignOps.addHash(e.hashToSign, e.hashAlgo);
|
nfcSignOps.addHash(e.hashToSign, e.hashAlgo);
|
||||||
}
|
}
|
||||||
|
|
||||||
PGPSecretKey sKey; {
|
PGPSecretKey sKey; {
|
||||||
@ -972,9 +970,9 @@ public class PgpKeyOperation {
|
|||||||
|
|
||||||
progress(R.string.progress_done, 100);
|
progress(R.string.progress_done, 100);
|
||||||
|
|
||||||
if (!mNfcSignOps.isEmpty()) {
|
if (!nfcSignOps.isEmpty()) {
|
||||||
log.add(LogType.MSG_MF_INPUT_REQUIRED, indent);
|
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);
|
log.add(LogType.MSG_MF_SUCCESS, indent);
|
||||||
@ -1205,6 +1203,7 @@ public class PgpKeyOperation {
|
|||||||
PGPPublicKey masterPublicKey,
|
PGPPublicKey masterPublicKey,
|
||||||
int flags, long expiry,
|
int flags, long expiry,
|
||||||
CryptoInputParcel cryptoInput,
|
CryptoInputParcel cryptoInput,
|
||||||
|
NfcSignOperationsBuilder nfcSignOps,
|
||||||
int indent, OperationLog log)
|
int indent, OperationLog log)
|
||||||
throws PGPException, IOException, SignatureException {
|
throws PGPException, IOException, SignatureException {
|
||||||
|
|
||||||
@ -1268,7 +1267,7 @@ public class PgpKeyOperation {
|
|||||||
modifiedPublicKey = PGPPublicKey.addCertification(
|
modifiedPublicKey = PGPPublicKey.addCertification(
|
||||||
modifiedPublicKey, userId, newCert);
|
modifiedPublicKey, userId, newCert);
|
||||||
} catch (NfcInteractionNeeded e) {
|
} catch (NfcInteractionNeeded e) {
|
||||||
mNfcSignOps.addHash(e.hashToSign, e.hashAlgo);
|
nfcSignOps.addHash(e.hashToSign, e.hashAlgo);
|
||||||
}
|
}
|
||||||
ok = true;
|
ok = true;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user