modifyKey: error out on integrity check fails
This commit is contained in:
@@ -188,14 +188,14 @@ public class PgpKeyOperation {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
PGPKeyPair keyPair = createKey(add.mAlgorithm, add.mKeysize, log, indent);
|
|
||||||
|
|
||||||
if (add.mAlgorithm == Constants.choice.algorithm.elgamal) {
|
if (add.mAlgorithm == Constants.choice.algorithm.elgamal) {
|
||||||
log.add(LogLevel.ERROR, LogType.MSG_CR_ERROR_MASTER_ELGAMAL, indent);
|
log.add(LogLevel.ERROR, LogType.MSG_CR_ERROR_MASTER_ELGAMAL, indent);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// return null if this failed (it will already have been logged by createKey)
|
PGPKeyPair keyPair = createKey(add.mAlgorithm, add.mKeysize, log, indent);
|
||||||
|
|
||||||
|
// return null if this failed (an error will already have been logged by createKey)
|
||||||
if (keyPair == null) {
|
if (keyPair == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -319,9 +319,10 @@ public class PgpKeyOperation {
|
|||||||
Iterator<PGPSignature> it = modifiedPublicKey.getSignaturesForID(userId);
|
Iterator<PGPSignature> it = modifiedPublicKey.getSignaturesForID(userId);
|
||||||
if (it != null) {
|
if (it != null) {
|
||||||
for (PGPSignature cert : new IterableIterator<PGPSignature>(it)) {
|
for (PGPSignature cert : new IterableIterator<PGPSignature>(it)) {
|
||||||
// if it's not a self cert, never mind
|
|
||||||
if (cert.getKeyID() != masterPublicKey.getKeyID()) {
|
if (cert.getKeyID() != masterPublicKey.getKeyID()) {
|
||||||
continue;
|
// foreign certificate?! error error error
|
||||||
|
log.add(LogLevel.ERROR, LogType.MSG_MF_ERROR_INTEGRITY, indent);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
if (cert.getSignatureType() == PGPSignature.CERTIFICATION_REVOCATION
|
if (cert.getSignatureType() == PGPSignature.CERTIFICATION_REVOCATION
|
||||||
|| cert.getSignatureType() == PGPSignature.NO_CERTIFICATION
|
|| cert.getSignatureType() == PGPSignature.NO_CERTIFICATION
|
||||||
@@ -369,9 +370,10 @@ public class PgpKeyOperation {
|
|||||||
// noinspection unchecked
|
// noinspection unchecked
|
||||||
for (PGPSignature cert : new IterableIterator<PGPSignature>(
|
for (PGPSignature cert : new IterableIterator<PGPSignature>(
|
||||||
modifiedPublicKey.getSignaturesForID(userId))) {
|
modifiedPublicKey.getSignaturesForID(userId))) {
|
||||||
// if it's not a self cert, never mind
|
|
||||||
if (cert.getKeyID() != masterPublicKey.getKeyID()) {
|
if (cert.getKeyID() != masterPublicKey.getKeyID()) {
|
||||||
continue;
|
// foreign certificate?! error error error
|
||||||
|
log.add(LogLevel.ERROR, LogType.MSG_MF_ERROR_INTEGRITY, indent);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
// we know from canonicalization that if there is any revocation here, it
|
// we know from canonicalization that if there is any revocation here, it
|
||||||
// is valid and not superseded by a newer certification.
|
// is valid and not superseded by a newer certification.
|
||||||
|
|||||||
@@ -39,15 +39,21 @@ public class ProgressScaler implements Progressable {
|
|||||||
* Set progress of ProgressDialog by sending message to handler on UI thread
|
* Set progress of ProgressDialog by sending message to handler on UI thread
|
||||||
*/
|
*/
|
||||||
public void setProgress(String message, int progress, int max) {
|
public void setProgress(String message, int progress, int max) {
|
||||||
mWrapped.setProgress(message, mFrom + progress * (mTo - mFrom) / max, mMax);
|
if (mWrapped != null) {
|
||||||
|
mWrapped.setProgress(message, mFrom + progress * (mTo - mFrom) / max, mMax);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setProgress(int resourceId, int progress, int max) {
|
public void setProgress(int resourceId, int progress, int max) {
|
||||||
mWrapped.setProgress(resourceId, progress, mMax);
|
if (mWrapped != null) {
|
||||||
|
mWrapped.setProgress(resourceId, progress, mMax);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setProgress(int progress, int max) {
|
public void setProgress(int progress, int max) {
|
||||||
mWrapped.setProgress(progress, max);
|
if (mWrapped != null) {
|
||||||
|
mWrapped.setProgress(progress, max);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user