From 3e8f8785814fa1637b16ba9485877236103cf797 Mon Sep 17 00:00:00 2001 From: George Gastaldi Date: Mon, 31 Jul 2023 12:03:33 -0300 Subject: [PATCH] Add test using OpenSSH key --- .../java/io/quarkus/it/jsch/JSchTest.java | 12 ++++++ .../src/test/resources/openssh_private_key | 39 +++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 integration-tests/src/test/resources/openssh_private_key diff --git a/integration-tests/src/test/java/io/quarkus/it/jsch/JSchTest.java b/integration-tests/src/test/java/io/quarkus/it/jsch/JSchTest.java index d1ebc95..dd34d91 100644 --- a/integration-tests/src/test/java/io/quarkus/it/jsch/JSchTest.java +++ b/integration-tests/src/test/java/io/quarkus/it/jsch/JSchTest.java @@ -75,6 +75,18 @@ void shouldDecryptUsingKeyPair(@TempDir Path keypairDir) throws Exception { .body(is("true")); } + @Test + void shouldDecryptOpenSSLKeyUsingKeyPair() throws Exception { + String passphrase = "PrettyPlease"; + String privateKeyPath = getClass().getClassLoader().getResource("openssh_private_key").getFile(); + given().queryParam("privateKey", privateKeyPath) + .queryParam("passphrase", passphrase) + .get("/jsch/keypair/decrypt") + .then() + .statusCode(is(200)) + .body(is("true")); + } + @AfterEach void stopServer() throws Exception { if (sshd != null) { diff --git a/integration-tests/src/test/resources/openssh_private_key b/integration-tests/src/test/resources/openssh_private_key new file mode 100644 index 0000000..4b4683f --- /dev/null +++ b/integration-tests/src/test/resources/openssh_private_key @@ -0,0 +1,39 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +b3BlbnNzaC1rZXktdjEAAAAACmFlczI1Ni1jdHIAAAAGYmNyeXB0AAAAGAAAABB8KarbgH +gP3XEK+fsZmlP5AAAAEAAAAAEAAAGXAAAAB3NzaC1yc2EAAAADAQABAAABgQDWavxs+pOy +y/66A+id4U94005jFHk4+mtqsZcPY3x5xuXviqWjzhyEa1vL+gKe9DywinxBWVl51R8OSE +BZ1H/mz77u4qaVkUlu0a/r3eYFlELIjDFGzODkEGdvptYt2FPPAdso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