summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGunnar Wagenknecht <gunnar@wagenknecht.org>2019-10-22 01:21:34 -0400
committerGerrit Code Review @ Eclipse.org <gerrit@eclipse.org>2019-10-22 01:21:34 -0400
commit748db6a0d660053f66e098b5aae2ffa2beb15e54 (patch)
treeb68983954b8e611d39c5416cc2153d28935c0307
parent385b503ae8635ddb4233c9ae1f2d472a51609162 (diff)
parent68b8317a09705aa90fc4a4ff1321b7cb4bd726e7 (diff)
downloadjgit-748db6a0d660053f66e098b5aae2ffa2beb15e54.tar.gz
jgit-748db6a0d660053f66e098b5aae2ffa2beb15e54.zip
Merge "GpgKeyLocator: Return subkeys instead of the first key for subkeys"
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/internal/BouncyCastleGpgKeyLocator.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/internal/BouncyCastleGpgKeyLocator.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/internal/BouncyCastleGpgKeyLocator.java
index 11db7c5998..c662ada7cc 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/internal/BouncyCastleGpgKeyLocator.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/internal/BouncyCastleGpgKeyLocator.java
@@ -202,7 +202,7 @@ class BouncyCastleGpgKeyLocator {
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 @@ class BouncyCastleGpgKeyLocator {
.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 {