This is an automated email from the ASF dual-hosted git repository. amagyar pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/knox.git
The following commit(s) were added to refs/heads/master by this push: new 3b0c1bbcc KNOX-2799 - When exporting certificate using Knox CLI, the certificate is coming with wrong name when type=PEM (#629) 3b0c1bbcc is described below commit 3b0c1bbcc1456b872dc32eadb556085d4dbb5b97 Author: Attila Magyar <m.magy...@gmail.com> AuthorDate: Wed Sep 7 10:07:42 2022 +0200 KNOX-2799 - When exporting certificate using Knox CLI, the certificate is coming with wrong name when type=PEM (#629) --- .../src/main/java/org/apache/knox/gateway/util/KnoxCLI.java | 4 ++-- .../src/test/java/org/apache/knox/gateway/util/KnoxCLITest.java | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/util/KnoxCLI.java b/gateway-server/src/main/java/org/apache/knox/gateway/util/KnoxCLI.java index c49127a2d..71c4062a2 100644 --- a/gateway-server/src/main/java/org/apache/knox/gateway/util/KnoxCLI.java +++ b/gateway-server/src/main/java/org/apache/knox/gateway/util/KnoxCLI.java @@ -723,8 +723,8 @@ public class KnoxCLI extends Configured implements Tool { } if ("PEM".equalsIgnoreCase(type) || type == null) { - X509CertificateUtil.writeCertificateToFile(cert, new File(keyStoreDir + "gateway-identity.pem")); - out.println("Certificate gateway-identity has been successfully exported to: " + keyStoreDir + "gateway-identity.pem"); + X509CertificateUtil.writeCertificateToFile(cert, new File(keyStoreDir + "gateway-client-trust.pem")); + out.println("Certificate gateway-identity has been successfully exported to: " + keyStoreDir + "gateway-client-trust.pem"); } else if ("JKS".equalsIgnoreCase(type)) { X509CertificateUtil.writeCertificateToJks(cert, new File(keyStoreDir + "gateway-client-trust.jks")); out.println("Certificate gateway-identity has been successfully exported to: " + keyStoreDir + "gateway-client-trust.jks"); diff --git a/gateway-server/src/test/java/org/apache/knox/gateway/util/KnoxCLITest.java b/gateway-server/src/test/java/org/apache/knox/gateway/util/KnoxCLITest.java index 9c488f6e3..d16a8e686 100644 --- a/gateway-server/src/test/java/org/apache/knox/gateway/util/KnoxCLITest.java +++ b/gateway-server/src/test/java/org/apache/knox/gateway/util/KnoxCLITest.java @@ -719,7 +719,7 @@ public class KnoxCLITest { rc = cli.run(gwCreateArgs2); assertEquals(0, rc); assertTrue(outContent.toString(StandardCharsets.UTF_8.name()), outContent.toString(StandardCharsets.UTF_8.name()).contains("Certificate gateway-identity has been successfully exported to")); - assertTrue(outContent.toString(StandardCharsets.UTF_8.name()), outContent.toString(StandardCharsets.UTF_8.name()).contains("gateway-identity.pem")); + assertTrue(outContent.toString(StandardCharsets.UTF_8.name()), outContent.toString(StandardCharsets.UTF_8.name()).contains("gateway-client-trust.pem")); // case insensitive outContent.reset(); @@ -727,14 +727,14 @@ public class KnoxCLITest { rc = cli.run(gwCreateArgs2_6); assertEquals(0, rc); assertTrue(outContent.toString(StandardCharsets.UTF_8.name()), outContent.toString(StandardCharsets.UTF_8.name()).contains("Certificate gateway-identity has been successfully exported to")); - assertTrue(outContent.toString(StandardCharsets.UTF_8.name()), outContent.toString(StandardCharsets.UTF_8.name()).contains("gateway-identity.pem")); + assertTrue(outContent.toString(StandardCharsets.UTF_8.name()), outContent.toString(StandardCharsets.UTF_8.name()).contains("gateway-client-trust.pem")); outContent.reset(); String[] gwCreateArgs2_5 = {"export-cert"}; rc = cli.run(gwCreateArgs2_5); assertEquals(0, rc); assertTrue(outContent.toString(StandardCharsets.UTF_8.name()), outContent.toString(StandardCharsets.UTF_8.name()).contains("Certificate gateway-identity has been successfully exported to")); - assertTrue(outContent.toString(StandardCharsets.UTF_8.name()), outContent.toString(StandardCharsets.UTF_8.name()).contains("gateway-identity.pem")); + assertTrue(outContent.toString(StandardCharsets.UTF_8.name()), outContent.toString(StandardCharsets.UTF_8.name()).contains("gateway-client-trust.pem")); outContent.reset(); String[] gwCreateArgs3 = {"export-cert", "--type", "JKS"};