You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by ff...@apache.org on 2015/12/03 07:42:40 UTC
karaf git commit: [KARAF-4062]Karaf client does now work after
installing BouncyCastle
Repository: karaf
Updated Branches:
refs/heads/karaf-2.x 3a5e5bd94 -> 9f2281a67
[KARAF-4062]Karaf client does now work after installing BouncyCastle
Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/9f2281a6
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/9f2281a6
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/9f2281a6
Branch: refs/heads/karaf-2.x
Commit: 9f2281a67ec4b7fe999937cbdd18fe3d3c5fa70b
Parents: 3a5e5bd
Author: Freeman Fang <fr...@gmail.com>
Authored: Thu Dec 3 14:41:57 2015 +0800
Committer: Freeman Fang <fr...@gmail.com>
Committed: Thu Dec 3 14:41:57 2015 +0800
----------------------------------------------------------------------
.../main/java/org/apache/karaf/client/Main.java | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/karaf/blob/9f2281a6/client/src/main/java/org/apache/karaf/client/Main.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/karaf/client/Main.java b/client/src/main/java/org/apache/karaf/client/Main.java
index 2b4d2b4..131fb37 100644
--- a/client/src/main/java/org/apache/karaf/client/Main.java
+++ b/client/src/main/java/org/apache/karaf/client/Main.java
@@ -20,6 +20,7 @@ import java.io.*;
import java.net.URL;
import java.nio.charset.Charset;
import java.security.KeyPair;
+import java.util.Arrays;
import java.util.Iterator;
import java.util.Locale;
import java.util.Properties;
@@ -31,6 +32,7 @@ import jline.Terminal;
import org.apache.karaf.shell.console.jline.TerminalFactory;
import org.apache.sshd.ClientChannel;
import org.apache.sshd.ClientSession;
+import org.apache.sshd.SshBuilder;
import org.apache.sshd.SshClient;
import org.apache.sshd.agent.SshAgent;
import org.apache.sshd.agent.local.AgentImpl;
@@ -38,6 +40,11 @@ import org.apache.sshd.agent.local.LocalAgentFactory;
import org.apache.sshd.client.UserInteraction;
import org.apache.sshd.client.channel.ChannelShell;
import org.apache.sshd.client.future.ConnectFuture;
+import org.apache.sshd.client.kex.ECDHP256;
+import org.apache.sshd.client.kex.ECDHP384;
+import org.apache.sshd.client.kex.ECDHP521;
+import org.apache.sshd.common.KeyExchange;
+import org.apache.sshd.common.NamedFactory;
import org.apache.sshd.common.RuntimeSshException;
import org.apache.sshd.common.keyprovider.FileKeyPairProvider;
import org.fusesource.jansi.AnsiConsole;
@@ -221,7 +228,18 @@ public class Main {
SshAgent agent = null;
int exitStatus = 0;
try {
- client = SshClient.setUpDefaultClient();
+ SshBuilder.ClientBuilder clientBuilder = SshBuilder.client();
+ clientBuilder.keyExchangeFactories(Arrays.<NamedFactory<KeyExchange>>asList(
+ new ECDHP256.Factory(),
+ new ECDHP256.Factory(),
+ new ECDHP384.Factory(),
+ new ECDHP384.Factory(),
+ new ECDHP521.Factory(),
+ new ECDHP521.Factory()
+ )
+ );
+
+ client = (SshClient)clientBuilder.build();
setupAgent(user, client, keyFile);
final Console console = System.console();
if (console != null) {