From 4aa4fd1421f27f623cf5fa3596594efe87468ee7 Mon Sep 17 00:00:00 2001 From: Marc Nuri Date: Wed, 3 Jan 2024 09:39:11 +0100 Subject: [PATCH] review: EC private key support Signed-off-by: Marc Nuri --- .../fabric8/kubernetes/client/internal/CertUtils.java | 1 - .../kubernetes/client/internal/CertUtilsTest.java | 10 ++++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/internal/CertUtils.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/internal/CertUtils.java index c57f59e4450..d6fb0a52690 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/internal/CertUtils.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/internal/CertUtils.java @@ -202,7 +202,6 @@ public PrivateKey call() throws IOException { throw new KubernetesClientException( "JcaPEMKeyConverter is provided by BouncyCastle, an optional dependency. To use support for EC Keys you must explicitly add this dependency to classpath."); } catch (IOException e) { - e.printStackTrace(); throw new KubernetesClientException(e.getMessage()); } } diff --git a/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/internal/CertUtilsTest.java b/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/internal/CertUtilsTest.java index 788c57d95a8..efe680301d4 100644 --- a/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/internal/CertUtilsTest.java +++ b/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/internal/CertUtilsTest.java @@ -43,7 +43,6 @@ import static org.junit.Assert.assertNotSame; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; class CertUtilsTest { @@ -211,14 +210,13 @@ void loadECPrivateOnlyKey() } @Test - void loadNothingError() - throws InvalidKeySpecException, CertificateException, NoSuchAlgorithmException, KeyStoreException, IOException { + void loadNothingError() { String privateKeyPath = Utils.filePath(getClass().getResource("/ssl-test/empty")); String certPath = Utils.filePath(getClass().getResource("/ssl-test/empty")); - Exception exception = assertThrows(KubernetesClientException.class, - () -> CertUtils.createKeyStore(null, certPath, null, privateKeyPath, "EC", "foo", null, null)); - assertTrue(exception.getMessage().equals("Got null PEM object from EC key's input stream.")); + assertThatExceptionOfType(KubernetesClientException.class) + .isThrownBy(() -> CertUtils.createKeyStore(null, certPath, null, privateKeyPath, "EC", "foo", null, null)) + .withMessage("Got null PEM object from EC key's input stream."); } @Test