From 8fe3a7159dde0f029955d3b73aa7aa0036b65e60 Mon Sep 17 00:00:00 2001 From: Paul Schaub Date: Mon, 8 May 2023 16:01:59 +0200 Subject: [PATCH] Report PGPainless version in sop version --backend --- .../java/org/pgpainless/cli/commands/VersionCmdTest.java | 2 +- .../src/main/java/org/pgpainless/sop/VersionImpl.java | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/pgpainless-cli/src/test/java/org/pgpainless/cli/commands/VersionCmdTest.java b/pgpainless-cli/src/test/java/org/pgpainless/cli/commands/VersionCmdTest.java index 87f535a8..e0915920 100644 --- a/pgpainless-cli/src/test/java/org/pgpainless/cli/commands/VersionCmdTest.java +++ b/pgpainless-cli/src/test/java/org/pgpainless/cli/commands/VersionCmdTest.java @@ -29,7 +29,7 @@ public class VersionCmdTest extends CLITest { public void testGetBackendVersion() throws IOException { ByteArrayOutputStream out = pipeStdoutToStream(); assertSuccess(executeCommand("version", "--backend")); - assertTrue(out.toString().startsWith("Bouncy Castle ")); + assertTrue(out.toString().startsWith("PGPainless ")); } @Test diff --git a/pgpainless-sop/src/main/java/org/pgpainless/sop/VersionImpl.java b/pgpainless-sop/src/main/java/org/pgpainless/sop/VersionImpl.java index 0794c708..59837f3c 100644 --- a/pgpainless-sop/src/main/java/org/pgpainless/sop/VersionImpl.java +++ b/pgpainless-sop/src/main/java/org/pgpainless/sop/VersionImpl.java @@ -10,6 +10,9 @@ import java.util.Locale; import java.util.Properties; import org.bouncycastle.jce.provider.BouncyCastleProvider; +import org.pgpainless.PGPainless; +import org.pgpainless.implementation.ImplementationFactory; +import org.pgpainless.provider.ProviderFactory; import sop.operation.Version; /** @@ -45,12 +48,12 @@ public class VersionImpl implements Version { @Override public String getBackendVersion() { - double bcVersion = new BouncyCastleProvider().getVersion(); - return String.format(Locale.US, "Bouncy Castle %.2f", bcVersion); + return "PGPainless " + getVersion(); } @Override public String getExtendedVersion() { + double bcVersion = new BouncyCastleProvider().getVersion(); String FORMAT_VERSION = String.format("%02d", SOP_VERSION); return getName() + " " + getVersion() + "\n" + "https://codeberg.org/PGPainless/pgpainless/src/branch/master/pgpainless-sop\n" + @@ -61,7 +64,7 @@ public class VersionImpl implements Version { "Based on pgpainless-core " + getVersion() + "\n" + "https://pgpainless.org\n" + "\n" + - "Using " + getBackendVersion() + "\n" + + "Using " + String.format(Locale.US, "Bouncy Castle %.2f", bcVersion) + "\n" + "https://www.bouncycastle.org/java.html"; }