This commit is contained in:
Shikhar Bhushan
2010-03-06 14:12:28 +01:00
parent fae9f78a74
commit df3387d26a
4 changed files with 7 additions and 10 deletions

View File

@@ -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
*/

View File

@@ -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}.
* <p/>
* This method does not provide a way to specify a passphrase.

View File

@@ -462,15 +462,13 @@ public class Buffer<T extends Buffer<T>> {
}
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<T extends Buffer<T>> {
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<T extends Buffer<T>> {
} 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;

View File

@@ -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 {