Import keys with adapter, loader, and new design

This commit is contained in:
Dominik Schürmann
2013-09-22 19:58:33 +02:00
parent 7b2de96d15
commit 917c86b524
30 changed files with 702 additions and 797 deletions

View File

@@ -137,7 +137,7 @@ public class PgpKeyHelper {
PGPPublicKey masterKey = null;
for (int i = 0; i < encryptKeys.size(); ++i) {
PGPPublicKey key = encryptKeys.get(i);
if (!isExpired(key) && !key.isRevoked()) {
if (!isExpired(key) && !key.isRevoked()) {
if (key.isMasterKey()) {
masterKey = key;
} else {
@@ -488,7 +488,7 @@ public class PgpKeyHelper {
return isSecretKeyPrivateEmpty(secretKey);
}
public static String getSmallFingerPrint(long keyId) {
public static String convertKeyIdToHex(long keyId) {
String fingerPrint = Long.toHexString(keyId & 0xffffffffL).toUpperCase(Locale.US);
while (fingerPrint.length() < 8) {
fingerPrint = "0" + fingerPrint;
@@ -496,11 +496,17 @@ public class PgpKeyHelper {
return fingerPrint;
}
public static String keyToHex(long keyId) {
return getSmallFingerPrint(keyId >> 32) + getSmallFingerPrint(keyId);
/**
* TODO: what is the difference to the other function?
*
* @param keyId
* @return
*/
public static String convertKeyToHex(long keyId) {
return convertKeyIdToHex(keyId >> 32) + convertKeyIdToHex(keyId);
}
public static long keyFromHex(String data) {
public static long convertHexToKeyId(String data) {
int len = data.length();
String s2 = data.substring(len - 8);
String s1 = data.substring(0, len - 8);