mirror of
https://github.com/pgpainless/pgpainless.git
synced 2025-01-08 19:27:57 +01:00
Remove unused BCUtil.publicKeyRingFromSecretKeyRing method
Use KeyRingUtils.publicKeyRingFrom(secertKeys) instead
This commit is contained in:
parent
74c0c8a32e
commit
bd9a580600
2 changed files with 5 additions and 19 deletions
|
@ -64,20 +64,6 @@ public class BCUtil {
|
|||
return new PGPSecretKeyRingCollection(Arrays.asList(rings));
|
||||
}
|
||||
|
||||
public static PGPPublicKeyRing publicKeyRingFromSecretKeyRing(@Nonnull PGPSecretKeyRing secretKeys)
|
||||
throws PGPException, IOException {
|
||||
ByteArrayOutputStream buffer = new ByteArrayOutputStream(512);
|
||||
for (PGPSecretKey secretKey : secretKeys) {
|
||||
PGPPublicKey publicKey = secretKey.getPublicKey();
|
||||
if (publicKey != null) {
|
||||
publicKey.encode(buffer, false);
|
||||
}
|
||||
}
|
||||
KeyFingerPrintCalculator fingerprintCalculator = ImplementationFactory.getInstance().getKeyFingerprintCalculator();
|
||||
|
||||
return new PGPPublicKeyRing(buffer.toByteArray(), fingerprintCalculator);
|
||||
}
|
||||
|
||||
/*
|
||||
PGPXxxKeyRingCollection -> PGPXxxKeyRing
|
||||
*/
|
||||
|
|
|
@ -15,19 +15,19 @@
|
|||
*/
|
||||
package org.pgpainless.sop.commands;
|
||||
|
||||
import static org.pgpainless.sop.Print.err_ln;
|
||||
import static org.pgpainless.sop.Print.print_ln;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.bouncycastle.openpgp.PGPException;
|
||||
import org.bouncycastle.openpgp.PGPPublicKeyRing;
|
||||
import org.bouncycastle.openpgp.PGPSecretKeyRing;
|
||||
import org.pgpainless.PGPainless;
|
||||
import org.pgpainless.key.util.KeyRingUtils;
|
||||
import org.pgpainless.sop.Print;
|
||||
import org.pgpainless.util.BCUtil;
|
||||
import picocli.CommandLine;
|
||||
|
||||
import static org.pgpainless.sop.Print.err_ln;
|
||||
import static org.pgpainless.sop.Print.print_ln;
|
||||
|
||||
@CommandLine.Command(name = "extract-cert",
|
||||
description = "Extract a public key certificate from a secret key from standard input")
|
||||
public class ExtractCert implements Runnable {
|
||||
|
@ -41,7 +41,7 @@ public class ExtractCert implements Runnable {
|
|||
public void run() {
|
||||
try {
|
||||
PGPSecretKeyRing secretKeys = PGPainless.readKeyRing().secretKeyRing(System.in);
|
||||
PGPPublicKeyRing publicKeys = BCUtil.publicKeyRingFromSecretKeyRing(secretKeys);
|
||||
PGPPublicKeyRing publicKeys = KeyRingUtils.publicKeyRingFrom(secretKeys);
|
||||
|
||||
print_ln(Print.toString(publicKeys.getEncoded(), armor));
|
||||
} catch (IOException | PGPException e) {
|
||||
|
|
Loading…
Reference in a new issue