mirror of
https://github.com/pgpainless/pgpainless.git
synced 2025-01-09 11:48:00 +01:00
Add KeyRingUtils.publicKeyRingCollectionFrom(PGPSecretKeyRingCollection)
This commit is contained in:
parent
2ad67a85fb
commit
32e1f1234b
1 changed files with 19 additions and 0 deletions
|
@ -161,6 +161,25 @@ public final class KeyRingUtils {
|
||||||
return publicKeyRing;
|
return publicKeyRing;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extract {@link PGPPublicKeyRing PGPPublicKeyRings} from all {@link PGPSecretKeyRing PGPSecretKeyRings} in
|
||||||
|
* the given {@link PGPSecretKeyRingCollection} and return them as a {@link PGPPublicKeyRingCollection}.
|
||||||
|
*
|
||||||
|
* @param secretKeyRings secret key ring collection
|
||||||
|
* @return public key ring collection
|
||||||
|
* @throws PGPException TODO: remove
|
||||||
|
* @throws IOException TODO: remove
|
||||||
|
*/
|
||||||
|
@Nonnull
|
||||||
|
public static PGPPublicKeyRingCollection publicKeyRingCollectionFrom(@Nonnull PGPSecretKeyRingCollection secretKeyRings)
|
||||||
|
throws PGPException, IOException {
|
||||||
|
List<PGPPublicKeyRing> certificates = new ArrayList<>();
|
||||||
|
for (PGPSecretKeyRing secretKey : secretKeyRings) {
|
||||||
|
certificates.add(PGPainless.extractCertificate(secretKey));
|
||||||
|
}
|
||||||
|
return new PGPPublicKeyRingCollection(certificates);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unlock a {@link PGPSecretKey} and return the resulting {@link PGPPrivateKey}.
|
* Unlock a {@link PGPSecretKey} and return the resulting {@link PGPPrivateKey}.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue