minor changes, add convertFingerprintToKeyId method

This commit is contained in:
Vincent Breitmoser
2015-03-08 03:12:26 +01:00
parent 2b5023a75d
commit ea7068acdf
6 changed files with 59 additions and 18 deletions

View File

@@ -23,6 +23,7 @@ import android.os.Parcelable;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import org.sufficientlysecure.keychain.pgp.WrappedUserAttribute;
@@ -81,17 +82,11 @@ public class CertifyActionsParcel implements Parcelable {
final public ArrayList<String> mUserIds;
final public ArrayList<WrappedUserAttribute> mUserAttributes;
public CertifyAction(long masterKeyId, ArrayList<String> userIds) {
public CertifyAction(long masterKeyId, List<String> userIds,
List<WrappedUserAttribute> attributes) {
mMasterKeyId = masterKeyId;
mUserIds = userIds;
mUserAttributes = null;
}
public CertifyAction(long masterKeyId, ArrayList<String> userIds,
ArrayList<WrappedUserAttribute> attributes) {
mMasterKeyId = masterKeyId;
mUserIds = userIds;
mUserAttributes = attributes;
mUserIds = new ArrayList<>(userIds);
mUserAttributes = new ArrayList<>(attributes);
}
}

View File

@@ -164,7 +164,7 @@ public class MultiUserIdsAdapter extends CursorAdapter {
CertifyAction action = actions.get(keyId);
if (actions.get(keyId) == null) {
actions.put(keyId, new CertifyAction(keyId, uids));
actions.put(keyId, new CertifyAction(keyId, uids, null));
} else {
action.mUserIds.addAll(uids);
}

View File

@@ -38,6 +38,7 @@ import org.sufficientlysecure.keychain.service.SaveKeyringParcel.Algorithm;
import org.sufficientlysecure.keychain.service.SaveKeyringParcel.Curve;
import org.sufficientlysecure.keychain.util.Log;
import java.nio.ByteBuffer;
import java.security.DigestException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
@@ -249,6 +250,10 @@ public class KeyFormattingUtils {
return hexString;
}
public static long convertFingerprintToKeyId(byte[] fingerprint) {
return ByteBuffer.wrap(fingerprint, 12, 8).getLong();
}
/**
* Makes a human-readable version of a key ID, which is usually 64 bits: lower-case, no
* leading 0x, space-separated quartets (for keys whose length in hex is divisible by 4)