diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyHelper.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyHelper.java index 82136ac1b..d36dd8efe 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyHelper.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyHelper.java @@ -199,7 +199,7 @@ public class PgpKeyHelper { return getExpiryDate(key.getPublicKey()); } - public static PGPPublicKey getEncryptPublicKey(PGPPublicKeyRing keyRing) { + public static PGPPublicKey getFirstEncryptSubkey(PGPPublicKeyRing keyRing) { Vector encryptKeys = getUsableEncryptKeys(keyRing); if (encryptKeys.size() == 0) { Log.e(Constants.TAG, "encryptKeys is null!"); @@ -208,7 +208,7 @@ public class PgpKeyHelper { return encryptKeys.get(0); } - public static PGPSecretKey getCertificationKey(PGPSecretKeyRing keyRing) { + public static PGPSecretKey getFirstCertificationSubkey(PGPSecretKeyRing keyRing) { Vector signingKeys = getUsableCertificationKeys(keyRing); if (signingKeys.size() == 0) { return null; @@ -216,7 +216,7 @@ public class PgpKeyHelper { return signingKeys.get(0); } - public static PGPSecretKey getSigningKey(PGPSecretKeyRing keyRing) { + public static PGPSecretKey getFirstSigningSubkey(PGPSecretKeyRing keyRing) { Vector signingKeys = getUsableSigningKeys(keyRing); if (signingKeys.size() == 0) { return null; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSignEncrypt.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSignEncrypt.java index 418433427..16b060c10 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSignEncrypt.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSignEncrypt.java @@ -289,7 +289,7 @@ public class PgpSignEncrypt { throw new NoSigningKeyException(); // throw new PgpGeneralException(mContext.getString(R.string.error_signature_failed)); } - signingKey = PgpKeyHelper.getSigningKey(signingKeyRing); + signingKey = PgpKeyHelper.getFirstSigningSubkey(signingKeyRing); if (signingKey == null) { throw new NoSigningKeyException(); // throw new PgpGeneralException(mContext.getString(R.string.error_signature_failed)); @@ -337,7 +337,7 @@ public class PgpSignEncrypt { for (long id : mEncryptionMasterKeyIds) { try { PGPPublicKeyRing keyRing = mProviderHelper.getPGPPublicKeyRing(id); - PGPPublicKey key = PgpKeyHelper.getEncryptPublicKey(keyRing); + PGPPublicKey key = PgpKeyHelper.getFirstEncryptSubkey(keyRing); if (key != null) { JcePublicKeyKeyEncryptionMethodGenerator pubKeyEncryptionGenerator = new JcePublicKeyKeyEncryptionMethodGenerator(key); diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java index d54bc7de6..1ca143be0 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java @@ -833,7 +833,7 @@ public class KeychainIntentService extends IntentService Log.e(Constants.TAG, "key not found!", e); // TODO: throw exception here! } - PGPSecretKey certificationKey = PgpKeyHelper.getCertificationKey(secretKeyRing); + PGPSecretKey certificationKey = PgpKeyHelper.getFirstCertificationSubkey(secretKeyRing); publicKey = keyOperation.certifyKey(certificationKey, publicKey, userIds, signaturePassphrase); publicRing = PGPPublicKeyRing.insertPublicKey(publicRing, publicKey);