diff --git a/src/main/java/net/schmizz/sshj/Config.java b/src/main/java/net/schmizz/sshj/Config.java index 33e1c465..a06b8cfe 100644 --- a/src/main/java/net/schmizz/sshj/Config.java +++ b/src/main/java/net/schmizz/sshj/Config.java @@ -137,7 +137,7 @@ public interface Config { /** * Set the software version information for identification during SSH connection initialization. For example, {@code - * "NET_3_0"}. + * "SSHJ_0_1"}. * * @param version software version info */ diff --git a/src/main/java/net/schmizz/sshj/SSHClient.java b/src/main/java/net/schmizz/sshj/SSHClient.java index 4dc4fefa..8674229e 100644 --- a/src/main/java/net/schmizz/sshj/SSHClient.java +++ b/src/main/java/net/schmizz/sshj/SSHClient.java @@ -265,7 +265,7 @@ public class SSHClient } /** - * Authenticate {@code username} using the {@code "publickey"} authentication method, with keys from some commons + * Authenticate {@code username} using the {@code "publickey"} authentication method, with keys from some common * locations on the file system. This method relies on {@code ~/.ssh/id_rsa} and {@code ~/.ssh/id_dsa}. *

* This method does not provide a way to specify a passphrase. diff --git a/src/main/java/net/schmizz/sshj/common/Buffer.java b/src/main/java/net/schmizz/sshj/common/Buffer.java index e3b2d161..512aa8be 100644 --- a/src/main/java/net/schmizz/sshj/common/Buffer.java +++ b/src/main/java/net/schmizz/sshj/common/Buffer.java @@ -462,15 +462,13 @@ public class Buffer> { } public PublicKey readPublicKey() { - PublicKey key = null; try { switch (KeyType.fromString(readString())) { case RSA: { BigInteger e = readMPInt(); BigInteger n = readMPInt(); KeyFactory keyFactory = SecurityUtils.getKeyFactory("RSA"); - key = keyFactory.generatePublic(new RSAPublicKeySpec(n, e)); - break; + return keyFactory.generatePublic(new RSAPublicKeySpec(n, e)); } case DSA: { BigInteger p = readMPInt(); @@ -478,8 +476,7 @@ public class Buffer> { BigInteger g = readMPInt(); BigInteger y = readMPInt(); KeyFactory keyFactory = SecurityUtils.getKeyFactory("DSA"); - key = keyFactory.generatePublic(new DSAPublicKeySpec(y, p, q, g)); - break; + return keyFactory.generatePublic(new DSAPublicKeySpec(y, p, q, g)); } default: assert false; @@ -487,12 +484,12 @@ public class Buffer> { } catch (GeneralSecurityException e) { throw new SSHRuntimeException(e); } - return key; + return null; } @SuppressWarnings("unchecked") public T putPublicKey(PublicKey key) { - KeyType type = KeyType.fromKey(key); + final KeyType type = KeyType.fromKey(key); switch (type) { case RSA: { final RSAPublicKey rsaKey = (RSAPublicKey) key; diff --git a/src/main/java/net/schmizz/sshj/common/SSHRuntimeException.java b/src/main/java/net/schmizz/sshj/common/SSHRuntimeException.java index 295a1d73..2d9f2a6c 100644 --- a/src/main/java/net/schmizz/sshj/common/SSHRuntimeException.java +++ b/src/main/java/net/schmizz/sshj/common/SSHRuntimeException.java @@ -35,7 +35,7 @@ */ package net.schmizz.sshj.common; -/** Represents unrecoverable exceptions in the {@code org.apache.commons.net.ssh} package. */ +/** Represents unrecoverable exceptions in the {@code net.schmizz.sshj} package. */ public class SSHRuntimeException extends RuntimeException {