Print out fingerprints when inserting|importing keys

This commit is contained in:
Paul Schaub 2022-09-01 11:29:47 +02:00
parent f109b598f6
commit 47e9f5f08a
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
3 changed files with 12 additions and 1 deletions

View file

@ -33,6 +33,9 @@ public class Import implements Runnable {
ByteArrayInputStream certIn = new ByteArrayInputStream(cert.getEncoded());
Certificate certificate = PGPCertDCli.getCertificateDirectory()
.insert(certIn, MergeCallbacks.mergeWithExisting());
// CHECKSTYLE:OFF
System.out.println(certificate.getFingerprint());
// CHECKSTYLE:ON
}
} catch (IOException e) {
LOGGER.error("IO-Error.", e);

View file

@ -25,6 +25,9 @@ public class Insert implements Runnable {
try {
Certificate certificate = PGPCertDCli.getCertificateDirectory()
.insert(System.in, MergeCallbacks.mergeWithExisting());
// CHECKSTYLE:OFF
System.out.println(certificate.getFingerprint());
// CHECKSTYLE:ON
} catch (IOException e) {
LOGGER.error("IO-Error.", e);
System.exit(-1);

View file

@ -17,6 +17,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.pgpainless.certificate_store.MergeCallbacks;
import pgp.cert_d.cli.PGPCertDCli;
import pgp.certificate_store.certificate.KeyMaterial;
import pgp.certificate_store.exception.BadDataException;
import picocli.CommandLine;
@ -61,7 +62,11 @@ public class Setup implements Runnable {
try {
InputStream inputStream = new ByteArrayInputStream(trustRoot.getEncoded());
PGPCertDCli.getCertificateDirectory().insertTrustRoot(inputStream, MergeCallbacks.overrideExisting());
KeyMaterial inserted = PGPCertDCli.getCertificateDirectory()
.insertTrustRoot(inputStream, MergeCallbacks.overrideExisting());
// CHECKSTYLE:OFF
System.out.println(inserted.getFingerprint());
// CHECKSTYLE:ON
} catch (BadDataException e) {
throw new RuntimeException(e);