public static String getFingerPrint(Context context, long keyId) { PGPPublicKey key = ProviderHelper.getPGPPublicKeyByKeyId(context, keyId); // if it is no public key get it from your own keys... if (key == null) { PGPSecretKey secretKey = ProviderHelper.getPGPSecretKeyByKeyId(context, keyId); if (secretKey == null) { Log.e(Constants.TAG, "Key could not be found!"); return null; } key = secretKey.getPublicKey(); } return convertFingerprintToHex(key.getFingerprint(), true); }