Clarify use of methods in PgpKeyHelper

This commit is contained in:
Dominik Schürmann 2014-04-11 21:40:12 +02:00
parent 12b8282d9b
commit 2069f20f50
3 changed files with 6 additions and 6 deletions

View File

@ -199,7 +199,7 @@ public class PgpKeyHelper {
return getExpiryDate(key.getPublicKey());
}
public static PGPPublicKey getEncryptPublicKey(PGPPublicKeyRing keyRing) {
public static PGPPublicKey getFirstEncryptSubkey(PGPPublicKeyRing keyRing) {
Vector<PGPPublicKey> 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<PGPSecretKey> 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<PGPSecretKey> signingKeys = getUsableSigningKeys(keyRing);
if (signingKeys.size() == 0) {
return null;

View File

@ -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);

View File

@ -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);