Dont try to parse key/fingerprint result from keyserver query

This commit is contained in:
Dominik Schürmann
2014-03-20 15:54:49 +01:00
parent 747a41a0be
commit 2b77489932
7 changed files with 91 additions and 88 deletions

View File

@@ -460,12 +460,16 @@ public class PgpKeyHelper {
public static String convertFingerprintToHex(byte[] fingerprint, boolean split) {
String hexString = Hex.toHexString(fingerprint);
if (split) {
hexString = hexString.replaceAll("(.{4})(?!$)", "$1 ");
hexString = splitFingerprintHex(hexString);
}
return hexString;
}
public static String splitFingerprintHex(String hexString) {
return hexString.replaceAll("(.{4})(?!$)", "$1 ");
}
/**
* Convert key id from long to 64 bit hex string
* <p/>
@@ -497,19 +501,6 @@ public class PgpKeyHelper {
return hexString;
}
/**
* Used in HkpKeyServer to convert hex encoded key ids back to long.
*
* @param hexString
* @return
*/
public static long convertHexToKeyId(String hexString) {
int len = hexString.length();
String s2 = hexString.substring(len - 8);
String s1 = hexString.substring(0, len - 8);
return ((!s1.isEmpty() ? Long.parseLong(s1, 16) << 32 : 0) | Long.parseLong(s2, 16));
}
/**
* Splits userId string into naming part, email part, and comment part
*