1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2024-11-17 18:02:05 +01:00

Report PGPainless version in sop version --backend

This commit is contained in:
Paul Schaub 2023-05-08 16:01:59 +02:00
parent 1523497da4
commit 8fe3a7159d
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
2 changed files with 7 additions and 4 deletions

View file

@ -29,7 +29,7 @@ public class VersionCmdTest extends CLITest {
public void testGetBackendVersion() throws IOException { public void testGetBackendVersion() throws IOException {
ByteArrayOutputStream out = pipeStdoutToStream(); ByteArrayOutputStream out = pipeStdoutToStream();
assertSuccess(executeCommand("version", "--backend")); assertSuccess(executeCommand("version", "--backend"));
assertTrue(out.toString().startsWith("Bouncy Castle ")); assertTrue(out.toString().startsWith("PGPainless "));
} }
@Test @Test

View file

@ -10,6 +10,9 @@ import java.util.Locale;
import java.util.Properties; import java.util.Properties;
import org.bouncycastle.jce.provider.BouncyCastleProvider; import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.pgpainless.PGPainless;
import org.pgpainless.implementation.ImplementationFactory;
import org.pgpainless.provider.ProviderFactory;
import sop.operation.Version; import sop.operation.Version;
/** /**
@ -45,12 +48,12 @@ public class VersionImpl implements Version {
@Override @Override
public String getBackendVersion() { public String getBackendVersion() {
double bcVersion = new BouncyCastleProvider().getVersion(); return "PGPainless " + getVersion();
return String.format(Locale.US, "Bouncy Castle %.2f", bcVersion);
} }
@Override @Override
public String getExtendedVersion() { public String getExtendedVersion() {
double bcVersion = new BouncyCastleProvider().getVersion();
String FORMAT_VERSION = String.format("%02d", SOP_VERSION); String FORMAT_VERSION = String.format("%02d", SOP_VERSION);
return getName() + " " + getVersion() + "\n" + return getName() + " " + getVersion() + "\n" +
"https://codeberg.org/PGPainless/pgpainless/src/branch/master/pgpainless-sop\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" + "Based on pgpainless-core " + getVersion() + "\n" +
"https://pgpainless.org\n" + "https://pgpainless.org\n" +
"\n" + "\n" +
"Using " + getBackendVersion() + "\n" + "Using " + String.format(Locale.US, "Bouncy Castle %.2f", bcVersion) + "\n" +
"https://www.bouncycastle.org/java.html"; "https://www.bouncycastle.org/java.html";
} }