From ce1cab24d84ffaa5229ac248918a1703d824bbf6 Mon Sep 17 00:00:00 2001 From: Vladimir Lagunov <vladimir.lagunov@jetbrains.com> Date: Tue, 9 Apr 2024 17:11:56 +0200 Subject: [PATCH] squash! Wrap IllegalArgumentException thrown by Base64 decoder Better error messages in OpenSSHKeyFileUtil and PuTTYKeyFile --- .../sshj/userauth/keyprovider/OpenSSHKeyFileUtil.java | 2 +- .../net/schmizz/sshj/userauth/keyprovider/PuTTYKeyFile.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/hierynomus/sshj/userauth/keyprovider/OpenSSHKeyFileUtil.java b/src/main/java/com/hierynomus/sshj/userauth/keyprovider/OpenSSHKeyFileUtil.java index 6dd6d19f..94802c41 100644 --- a/src/main/java/com/hierynomus/sshj/userauth/keyprovider/OpenSSHKeyFileUtil.java +++ b/src/main/java/com/hierynomus/sshj/userauth/keyprovider/OpenSSHKeyFileUtil.java @@ -67,7 +67,7 @@ public static ParsedPubKey initPubKey(Reader publicKey) throws IOException { } throw new IOException("Public key file is blank"); } catch (Base64DecodingException err) { - throw new IOException("Public Key decoding failed: " + err.getMessage(), err); + throw new IOException("Public key decoding failed", err); } finally { br.close(); } diff --git a/src/main/java/net/schmizz/sshj/userauth/keyprovider/PuTTYKeyFile.java b/src/main/java/net/schmizz/sshj/userauth/keyprovider/PuTTYKeyFile.java index 36b3d08d..444c222a 100644 --- a/src/main/java/net/schmizz/sshj/userauth/keyprovider/PuTTYKeyFile.java +++ b/src/main/java/net/schmizz/sshj/userauth/keyprovider/PuTTYKeyFile.java @@ -264,7 +264,7 @@ protected void parseKeyPair() throws IOException { } } catch (Base64DecodingException e) { - throw new IOException("Corrupted PuTTY key: " + e.getMessage(), e); + throw new IOException("PuTTY key decoding failed", e); } }