From cd0b9603e7b80e84cb94c91644ebe86094cfed0b Mon Sep 17 00:00:00 2001 From: Paul Schaub Date: Mon, 5 Sep 2022 15:15:58 +0200 Subject: [PATCH] Add KeyRingUtils.injectCertification(keys, certification) --- .../org/pgpainless/key/util/KeyRingUtils.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/pgpainless-core/src/main/java/org/pgpainless/key/util/KeyRingUtils.java b/pgpainless-core/src/main/java/org/pgpainless/key/util/KeyRingUtils.java index 66536b88..0bcdf8d1 100644 --- a/pgpainless-core/src/main/java/org/pgpainless/key/util/KeyRingUtils.java +++ b/pgpainless-core/src/main/java/org/pgpainless/key/util/KeyRingUtils.java @@ -238,7 +238,21 @@ public final class KeyRingUtils { } /** - * Inject a key certification into the given key ring. + * Inject a key certification for the primary key into the given key ring. + * + * @param keyRing key ring + * @param certification key signature + * @return key ring with injected signature + * @param either {@link PGPPublicKeyRing} or {@link PGPSecretKeyRing} + */ + @Nonnull + public static T injectCertification(@Nonnull T keyRing, + @Nonnull PGPSignature certification) { + return injectCertification(keyRing, keyRing.getPublicKey(), certification); + } + + /** + * Inject a key certification for the given key into the given key ring. * * @param keyRing key ring * @param certifiedKey signed public key