mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-11-23 04:42:06 +01:00
Fix KeyRingUtils.keysPlusPublicKey()
This commit is contained in:
parent
361d2376f5
commit
d0544e690e
1 changed files with 1 additions and 10 deletions
|
@ -355,7 +355,6 @@ public final class KeyRingUtils {
|
||||||
* Inject a {@link PGPPublicKey} into the given key ring.
|
* Inject a {@link PGPPublicKey} into the given key ring.
|
||||||
*
|
*
|
||||||
* Note: Right now this method is broken and will throw a {@link NotYetImplementedException}.
|
* Note: Right now this method is broken and will throw a {@link NotYetImplementedException}.
|
||||||
* TODO: Fix with BC 171
|
|
||||||
*
|
*
|
||||||
* @param keyRing key ring
|
* @param keyRing key ring
|
||||||
* @param publicKey public key
|
* @param publicKey public key
|
||||||
|
@ -365,10 +364,6 @@ public final class KeyRingUtils {
|
||||||
@Nonnull
|
@Nonnull
|
||||||
public static <T extends PGPKeyRing> T keysPlusPublicKey(@Nonnull T keyRing,
|
public static <T extends PGPKeyRing> T keysPlusPublicKey(@Nonnull T keyRing,
|
||||||
@Nonnull PGPPublicKey publicKey) {
|
@Nonnull PGPPublicKey publicKey) {
|
||||||
if (true)
|
|
||||||
// Is currently broken beyond repair
|
|
||||||
throw new NotYetImplementedException();
|
|
||||||
|
|
||||||
PGPSecretKeyRing secretKeys = null;
|
PGPSecretKeyRing secretKeys = null;
|
||||||
PGPPublicKeyRing publicKeys;
|
PGPPublicKeyRing publicKeys;
|
||||||
if (keyRing instanceof PGPSecretKeyRing) {
|
if (keyRing instanceof PGPSecretKeyRing) {
|
||||||
|
@ -382,11 +377,7 @@ public final class KeyRingUtils {
|
||||||
if (secretKeys == null) {
|
if (secretKeys == null) {
|
||||||
return (T) publicKeys;
|
return (T) publicKeys;
|
||||||
} else {
|
} else {
|
||||||
// TODO: Replace with PGPSecretKeyRing.insertOrReplacePublicKey() once available
|
secretKeys = PGPSecretKeyRing.insertOrReplacePublicKey(secretKeys, publicKey);
|
||||||
// Right now replacePublicKeys looses extra public keys.
|
|
||||||
// See https://github.com/bcgit/bc-java/pull/1068 for a possible fix
|
|
||||||
// Fix once BC 171 gets released.
|
|
||||||
secretKeys = PGPSecretKeyRing.replacePublicKeys(secretKeys, publicKeys);
|
|
||||||
return (T) secretKeys;
|
return (T) secretKeys;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue