certify: get rid of fingerprint check

Master key ids are unambiguous by database design, and only keys which
are in the database are signed. There is no reason to check the
fingerprint again during the certify operation.
This commit is contained in:
Vincent Breitmoser 2014-10-04 18:28:07 +02:00
parent 7e5918efa3
commit 0ffa1b94de
5 changed files with 6 additions and 16 deletions

View File

@ -86,11 +86,6 @@ public class PgpCertifyOperation {
CanonicalizedPublicKeyRing publicRing =
mProviderHelper.getCanonicalizedPublicKeyRing(action.mMasterKeyId);
if ( ! Arrays.equals(publicRing.getFingerprint(), action.mFingerprint)) {
log.add(LogType.MSG_CRT_FP_MISMATCH, 3);
certifyError += 1;
continue;
}
UncachedKeyRing certifiedKey = certificationKey.certifyUserIds(publicRing, action.mUserIds, null, null);
certifiedKeys.add(certifiedKey);

View File

@ -74,17 +74,15 @@ public class CertifyActionsParcel implements Parcelable {
// TODO make this parcelable
public static class CertifyAction implements Serializable {
final public long mMasterKeyId;
final public byte[] mFingerprint;
final public ArrayList<String> mUserIds;
public CertifyAction(long masterKeyId, byte[] fingerprint) {
this(masterKeyId, fingerprint, null);
public CertifyAction(long masterKeyId) {
this(masterKeyId, null);
}
public CertifyAction(long masterKeyId, byte[] fingerprint, ArrayList<String> userIds) {
public CertifyAction(long masterKeyId, ArrayList<String> userIds) {
mMasterKeyId = masterKeyId;
mFingerprint = fingerprint;
mUserIds = userIds;
}
}

View File

@ -523,7 +523,6 @@ public abstract class OperationResult implements Parcelable {
MSG_CRT_ERROR_MASTER_NOT_FOUND (LogLevel.ERROR, R.string.msg_crt_error_master_not_found),
MSG_CRT_ERROR_NOTHING (LogLevel.ERROR, R.string.msg_crt_error_nothing),
MSG_CRT_ERROR_UNLOCK (LogLevel.ERROR, R.string.msg_crt_error_unlock),
MSG_CRT_FP_MISMATCH (LogLevel.WARN, R.string.msg_crt_fp_mismatch),
MSG_CRT (LogLevel.START, R.string.msg_crt),
MSG_CRT_MASTER_FETCH (LogLevel.DEBUG, R.string.msg_crt_master_fetch),
MSG_CRT_SAVE (LogLevel.DEBUG, R.string.msg_crt_save),

View File

@ -85,7 +85,6 @@ public class CertifyKeyFragment extends LoaderFragment
private Uri mDataUri;
private long mPubKeyId = Constants.key.none;
private byte[] mPubFingerprint;
private long mMasterKeyId = Constants.key.none;
private UserIdsAdapter mUserIdsAdapter;
@ -246,8 +245,8 @@ public class CertifyKeyFragment extends LoaderFragment
String mainUserId = data.getString(INDEX_USER_ID);
mInfoPrimaryUserId.setText(mainUserId);
mPubFingerprint = data.getBlob(INDEX_FINGERPRINT);
String fingerprint = KeyFormattingUtils.convertFingerprintToHex(mPubFingerprint);
byte[] fp = data.getBlob(INDEX_FINGERPRINT);
String fingerprint = KeyFormattingUtils.convertFingerprintToHex(fp);
mInfoFingerprint.setText(KeyFormattingUtils.colorizeFingerprint(fingerprint));
}
break;
@ -316,7 +315,7 @@ public class CertifyKeyFragment extends LoaderFragment
// fill values for this action
CertifyActionsParcel parcel = new CertifyActionsParcel(mMasterKeyId);
parcel.add(new CertifyAction(mPubKeyId, mPubFingerprint, userIds));
parcel.add(new CertifyAction(mPubKeyId, userIds));
Bundle data = new Bundle();
data.putParcelable(KeychainIntentService.CERTIFY_PARCEL, parcel);

View File

@ -902,7 +902,6 @@
<string name="msg_crt_error_master_not_found">"Master key not found!"</string>
<string name="msg_crt_error_nothing">"No keys certified!"</string>
<string name="msg_crt_error_unlock">"Error unlocking master key!"</string>
<string name="msg_crt_fp_mismatch">"Fingerprint mismatch, not certifying!"</string>
<string name="msg_crt">"Certifying keyrings"</string>
<string name="msg_crt_master_fetch">"Fetching certifying master key"</string>
<string name="msg_crt_save">"Saving certified key %s"</string>