certification is always done with the master key
This commit is contained in:
@@ -110,20 +110,6 @@ public class PgpKeyHelper {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Deprecated
|
|
||||||
private static Vector<PGPPublicKey> getEncryptKeys(PGPPublicKeyRing keyRing) {
|
|
||||||
Vector<PGPPublicKey> encryptKeys = new Vector<PGPPublicKey>();
|
|
||||||
|
|
||||||
for (PGPPublicKey key : new IterableIterator<PGPPublicKey>(keyRing.getPublicKeys())) {
|
|
||||||
if (isEncryptionKey(key)) {
|
|
||||||
encryptKeys.add(key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return encryptKeys;
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Deprecated
|
@Deprecated
|
||||||
private static Vector<PGPSecretKey> getSigningKeys(PGPSecretKeyRing keyRing) {
|
private static Vector<PGPSecretKey> getSigningKeys(PGPSecretKeyRing keyRing) {
|
||||||
@@ -138,39 +124,6 @@ public class PgpKeyHelper {
|
|||||||
return signingKeys;
|
return signingKeys;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Deprecated
|
|
||||||
private static Vector<PGPSecretKey> getCertificationKeys(PGPSecretKeyRing keyRing) {
|
|
||||||
Vector<PGPSecretKey> signingKeys = new Vector<PGPSecretKey>();
|
|
||||||
|
|
||||||
for (PGPSecretKey key : new IterableIterator<PGPSecretKey>(keyRing.getSecretKeys())) {
|
|
||||||
if (isCertificationKey(key)) {
|
|
||||||
signingKeys.add(key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return signingKeys;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
private static Vector<PGPSecretKey> getUsableCertificationKeys(PGPSecretKeyRing keyRing) {
|
|
||||||
Vector<PGPSecretKey> usableKeys = new Vector<PGPSecretKey>();
|
|
||||||
Vector<PGPSecretKey> signingKeys = getCertificationKeys(keyRing);
|
|
||||||
PGPSecretKey masterKey = null;
|
|
||||||
for (int i = 0; i < signingKeys.size(); ++i) {
|
|
||||||
PGPSecretKey key = signingKeys.get(i);
|
|
||||||
if (key.isMasterKey()) {
|
|
||||||
masterKey = key;
|
|
||||||
} else {
|
|
||||||
usableKeys.add(key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (masterKey != null) {
|
|
||||||
usableKeys.add(masterKey);
|
|
||||||
}
|
|
||||||
return usableKeys;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
private static Vector<PGPSecretKey> getUsableSigningKeys(PGPSecretKeyRing keyRing) {
|
private static Vector<PGPSecretKey> getUsableSigningKeys(PGPSecretKeyRing keyRing) {
|
||||||
Vector<PGPSecretKey> usableKeys = new Vector<PGPSecretKey>();
|
Vector<PGPSecretKey> usableKeys = new Vector<PGPSecretKey>();
|
||||||
@@ -190,14 +143,6 @@ public class PgpKeyHelper {
|
|||||||
return usableKeys;
|
return usableKeys;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PGPSecretKey getFirstCertificationSubkey(PGPSecretKeyRing keyRing) {
|
|
||||||
Vector<PGPSecretKey> signingKeys = getUsableCertificationKeys(keyRing);
|
|
||||||
if (signingKeys.size() == 0) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return signingKeys.get(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static PGPSecretKey getFirstSigningSubkey(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) {
|
||||||
|
|||||||
@@ -836,7 +836,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.getFirstCertificationSubkey(secretKeyRing);
|
PGPSecretKey certificationKey = secretKeyRing.getSecretKey();
|
||||||
publicKey = keyOperation.certifyKey(certificationKey, publicKey,
|
publicKey = keyOperation.certifyKey(certificationKey, publicKey,
|
||||||
userIds, signaturePassphrase);
|
userIds, signaturePassphrase);
|
||||||
publicRing = PGPPublicKeyRing.insertPublicKey(publicRing, publicKey);
|
publicRing = PGPPublicKeyRing.insertPublicKey(publicRing, publicKey);
|
||||||
|
|||||||
Reference in New Issue
Block a user