Merge "GpgKeyLocator: Return subkeys instead of the first key for subkeys"

This commit is contained in:
Gunnar Wagenknecht 2019-10-22 01:21:34 -04:00 committed by Gerrit Code Review @ Eclipse.org
commit 748db6a0d6
1 changed files with 7 additions and 1 deletions

View File

@ -202,7 +202,7 @@ private PGPPublicKey findPublicKeyByKeyId(KeyBlob keyBlob)
String fingerprint = Hex.toHexString(keyInfo.getFingerprint())
.toLowerCase(Locale.ROOT);
if (fingerprint.endsWith(keyId)) {
return getFirstPublicKey(keyBlob);
return getPublicKey(keyBlob, keyInfo.getFingerprint());
}
}
return null;
@ -522,6 +522,12 @@ private PGPPublicKey getFirstPublicKey(KeyBlob keyBlob) throws IOException {
.getPublicKey();
}
private PGPPublicKey getPublicKey(KeyBlob blob, byte[] fingerprint)
throws IOException {
return ((PublicKeyRingBlob) blob).getPGPPublicKeyRing()
.getPublicKey(fingerprint);
}
private KeyBox readKeyBoxFile(Path keyboxFile) throws IOException,
NoSuchAlgorithmException, NoSuchProviderException,
NoOpenPgpKeyException {