Browse Source

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

next
Gunnar Wagenknecht 5 years ago committed by Gerrit Code Review @ Eclipse.org
parent
commit
748db6a0d6
  1. 8
      org.eclipse.jgit/src/org/eclipse/jgit/lib/internal/BouncyCastleGpgKeyLocator.java

8
org.eclipse.jgit/src/org/eclipse/jgit/lib/internal/BouncyCastleGpgKeyLocator.java

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

Loading…
Cancel
Save