mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-27 19:22:14 -05:00
Clarify use of methods in PgpKeyHelper
This commit is contained in:
parent
12b8282d9b
commit
2069f20f50
@ -199,7 +199,7 @@ public class PgpKeyHelper {
|
|||||||
return getExpiryDate(key.getPublicKey());
|
return getExpiryDate(key.getPublicKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PGPPublicKey getEncryptPublicKey(PGPPublicKeyRing keyRing) {
|
public static PGPPublicKey getFirstEncryptSubkey(PGPPublicKeyRing keyRing) {
|
||||||
Vector<PGPPublicKey> encryptKeys = getUsableEncryptKeys(keyRing);
|
Vector<PGPPublicKey> encryptKeys = getUsableEncryptKeys(keyRing);
|
||||||
if (encryptKeys.size() == 0) {
|
if (encryptKeys.size() == 0) {
|
||||||
Log.e(Constants.TAG, "encryptKeys is null!");
|
Log.e(Constants.TAG, "encryptKeys is null!");
|
||||||
@ -208,7 +208,7 @@ public class PgpKeyHelper {
|
|||||||
return encryptKeys.get(0);
|
return encryptKeys.get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PGPSecretKey getCertificationKey(PGPSecretKeyRing keyRing) {
|
public static PGPSecretKey getFirstCertificationSubkey(PGPSecretKeyRing keyRing) {
|
||||||
Vector<PGPSecretKey> signingKeys = getUsableCertificationKeys(keyRing);
|
Vector<PGPSecretKey> signingKeys = getUsableCertificationKeys(keyRing);
|
||||||
if (signingKeys.size() == 0) {
|
if (signingKeys.size() == 0) {
|
||||||
return null;
|
return null;
|
||||||
@ -216,7 +216,7 @@ public class PgpKeyHelper {
|
|||||||
return signingKeys.get(0);
|
return signingKeys.get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PGPSecretKey getSigningKey(PGPSecretKeyRing keyRing) {
|
public static PGPSecretKey getFirstSigningSubkey(PGPSecretKeyRing keyRing) {
|
||||||
Vector<PGPSecretKey> signingKeys = getUsableSigningKeys(keyRing);
|
Vector<PGPSecretKey> signingKeys = getUsableSigningKeys(keyRing);
|
||||||
if (signingKeys.size() == 0) {
|
if (signingKeys.size() == 0) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -289,7 +289,7 @@ public class PgpSignEncrypt {
|
|||||||
throw new NoSigningKeyException();
|
throw new NoSigningKeyException();
|
||||||
// throw new PgpGeneralException(mContext.getString(R.string.error_signature_failed));
|
// throw new PgpGeneralException(mContext.getString(R.string.error_signature_failed));
|
||||||
}
|
}
|
||||||
signingKey = PgpKeyHelper.getSigningKey(signingKeyRing);
|
signingKey = PgpKeyHelper.getFirstSigningSubkey(signingKeyRing);
|
||||||
if (signingKey == null) {
|
if (signingKey == null) {
|
||||||
throw new NoSigningKeyException();
|
throw new NoSigningKeyException();
|
||||||
// throw new PgpGeneralException(mContext.getString(R.string.error_signature_failed));
|
// throw new PgpGeneralException(mContext.getString(R.string.error_signature_failed));
|
||||||
@ -337,7 +337,7 @@ public class PgpSignEncrypt {
|
|||||||
for (long id : mEncryptionMasterKeyIds) {
|
for (long id : mEncryptionMasterKeyIds) {
|
||||||
try {
|
try {
|
||||||
PGPPublicKeyRing keyRing = mProviderHelper.getPGPPublicKeyRing(id);
|
PGPPublicKeyRing keyRing = mProviderHelper.getPGPPublicKeyRing(id);
|
||||||
PGPPublicKey key = PgpKeyHelper.getEncryptPublicKey(keyRing);
|
PGPPublicKey key = PgpKeyHelper.getFirstEncryptSubkey(keyRing);
|
||||||
if (key != null) {
|
if (key != null) {
|
||||||
JcePublicKeyKeyEncryptionMethodGenerator pubKeyEncryptionGenerator =
|
JcePublicKeyKeyEncryptionMethodGenerator pubKeyEncryptionGenerator =
|
||||||
new JcePublicKeyKeyEncryptionMethodGenerator(key);
|
new JcePublicKeyKeyEncryptionMethodGenerator(key);
|
||||||
|
@ -833,7 +833,7 @@ public class KeychainIntentService extends IntentService
|
|||||||
Log.e(Constants.TAG, "key not found!", e);
|
Log.e(Constants.TAG, "key not found!", e);
|
||||||
// TODO: throw exception here!
|
// TODO: throw exception here!
|
||||||
}
|
}
|
||||||
PGPSecretKey certificationKey = PgpKeyHelper.getCertificationKey(secretKeyRing);
|
PGPSecretKey certificationKey = PgpKeyHelper.getFirstCertificationSubkey(secretKeyRing);
|
||||||
publicKey = keyOperation.certifyKey(certificationKey, publicKey,
|
publicKey = keyOperation.certifyKey(certificationKey, publicKey,
|
||||||
userIds, signaturePassphrase);
|
userIds, signaturePassphrase);
|
||||||
publicRing = PGPPublicKeyRing.insertPublicKey(publicRing, publicKey);
|
publicRing = PGPPublicKeyRing.insertPublicKey(publicRing, publicKey);
|
||||||
|
Loading…
Reference in New Issue
Block a user