mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-23 17:22:16 -05:00
Fix keybase import
This commit is contained in:
parent
f0b8261ad3
commit
6b7aa2767a
@ -29,6 +29,7 @@ import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Locale;
|
||||
|
||||
public class KeybaseKeyserver extends Keyserver {
|
||||
public static final String ORIGIN = "keybase:keybase.io";
|
||||
@ -94,7 +95,7 @@ public class KeybaseKeyserver extends Keyserver {
|
||||
String keybaseId = JWalk.getString(match, "components", "username", "val");
|
||||
String fullName = JWalk.getString(match, "components", "full_name", "val");
|
||||
String fingerprint = JWalk.getString(match, "components", "key_fingerprint", "val");
|
||||
fingerprint = fingerprint.replace(" ", "").toUpperCase(); // not strictly necessary but doesn't hurt
|
||||
fingerprint = fingerprint.replace(" ", "").toLowerCase(Locale.US); // not strictly necessary but doesn't hurt
|
||||
entry.setFingerprintHex(fingerprint);
|
||||
|
||||
entry.setKeyIdHex("0x" + fingerprint.substring(Math.max(0, fingerprint.length() - 16)));
|
||||
|
@ -139,6 +139,8 @@ public class PgpImportExport {
|
||||
String expectedFp = entry.getExpectedFingerprint();
|
||||
if(expectedFp != null) {
|
||||
if(!PgpKeyHelper.convertFingerprintToHex(key.getFingerprint()).equals(expectedFp)) {
|
||||
Log.d(Constants.TAG, "fingerprint: " + PgpKeyHelper.convertFingerprintToHex(key.getFingerprint()));
|
||||
Log.d(Constants.TAG, "expected fingerprint: " + expectedFp);
|
||||
Log.e(Constants.TAG, "Actual key fingerprint is not the same as expected!");
|
||||
badKeys += 1;
|
||||
continue;
|
||||
|
@ -104,7 +104,7 @@ public class PgpKeyHelper {
|
||||
* @return
|
||||
*/
|
||||
public static String convertFingerprintToHex(byte[] fingerprint) {
|
||||
String hexString = Hex.toHexString(fingerprint);
|
||||
String hexString = Hex.toHexString(fingerprint).toLowerCase(Locale.US);
|
||||
|
||||
return hexString;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user