You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by cs...@apache.org on 2017/08/03 08:26:11 UTC
karaf git commit: Switch to fixed FileKeyPairProvider
Repository: karaf
Updated Branches:
refs/heads/OPENSSH f521ec4de -> f7ec6fee5
Switch to fixed FileKeyPairProvider
Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/f7ec6fee
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/f7ec6fee
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/f7ec6fee
Branch: refs/heads/OPENSSH
Commit: f7ec6fee558566e70d91bf423b4435b1c83c87d4
Parents: f521ec4
Author: Christian Schneider <ch...@die-schneider.net>
Authored: Thu Aug 3 10:26:00 2017 +0200
Committer: Christian Schneider <ch...@die-schneider.net>
Committed: Thu Aug 3 10:26:00 2017 +0200
----------------------------------------------------------------------
shell/ssh/pom.xml | 6 +-----
.../src/main/java/org/apache/karaf/shell/ssh/Activator.java | 2 +-
.../ssh/keygenerator/OpenSSHGeneratorKeyFileProviderTest.java | 4 ++--
3 files changed, 4 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/karaf/blob/f7ec6fee/shell/ssh/pom.xml
----------------------------------------------------------------------
diff --git a/shell/ssh/pom.xml b/shell/ssh/pom.xml
index 9c359f6..5039b96 100644
--- a/shell/ssh/pom.xml
+++ b/shell/ssh/pom.xml
@@ -72,6 +72,7 @@
<dependency>
<groupId>org.apache.sshd</groupId>
<artifactId>sshd-core</artifactId>
+ <version>1.7.0-SNAPSHOT</version>
</dependency>
<dependency>
@@ -103,11 +104,6 @@
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
- <scope>test</scope>
- </dependency>
</dependencies>
<build>
http://git-wip-us.apache.org/repos/asf/karaf/blob/f7ec6fee/shell/ssh/src/main/java/org/apache/karaf/shell/ssh/Activator.java
----------------------------------------------------------------------
diff --git a/shell/ssh/src/main/java/org/apache/karaf/shell/ssh/Activator.java b/shell/ssh/src/main/java/org/apache/karaf/shell/ssh/Activator.java
index c07d500..a40eb9c 100644
--- a/shell/ssh/src/main/java/org/apache/karaf/shell/ssh/Activator.java
+++ b/shell/ssh/src/main/java/org/apache/karaf/shell/ssh/Activator.java
@@ -196,7 +196,7 @@ public class Activator extends BaseActivator implements ManagedService {
private void createServerKey(File keyFile, String algorithm, int keySize) {
try {
KeyPair kp = new OpenSSHKeyPairGenerator(algorithm, keySize).generate();
- new PemWriter(keyFile).writeKeyPair("", kp);
+ new PemWriter(keyFile).writeKeyPair(algorithm, kp);
} catch (Exception e) {
throw new RuntimeException("Key file generation failed", e);
}
http://git-wip-us.apache.org/repos/asf/karaf/blob/f7ec6fee/shell/ssh/src/test/java/org/apache/karaf/shell/ssh/keygenerator/OpenSSHGeneratorKeyFileProviderTest.java
----------------------------------------------------------------------
diff --git a/shell/ssh/src/test/java/org/apache/karaf/shell/ssh/keygenerator/OpenSSHGeneratorKeyFileProviderTest.java b/shell/ssh/src/test/java/org/apache/karaf/shell/ssh/keygenerator/OpenSSHGeneratorKeyFileProviderTest.java
index 891b042..946afda 100644
--- a/shell/ssh/src/test/java/org/apache/karaf/shell/ssh/keygenerator/OpenSSHGeneratorKeyFileProviderTest.java
+++ b/shell/ssh/src/test/java/org/apache/karaf/shell/ssh/keygenerator/OpenSSHGeneratorKeyFileProviderTest.java
@@ -23,6 +23,7 @@ import java.security.KeyPair;
import java.security.interfaces.RSAPrivateCrtKey;
import org.apache.sshd.common.config.keys.KeyUtils;
+import org.apache.sshd.common.keyprovider.FileKeyPairProvider;
import org.junit.Assert;
import org.junit.Test;
@@ -36,8 +37,7 @@ public class OpenSSHGeneratorKeyFileProviderTest {
KeyPair kp = new OpenSSHKeyPairGenerator(KeyUtils.RSA_ALGORITHM, 1024).generate();
new PemWriter(temp).writeKeyPair(KeyUtils.RSA_ALGORITHM, kp);
- //File path = new File("/home/cschneider/.ssh/id_rsa");
- OpenSSHKeyPairProvider prov = new OpenSSHKeyPairProvider(temp);
+ FileKeyPairProvider prov = new FileKeyPairProvider(temp.toPath());
KeyPair keys = prov.loadKeys().iterator().next();
Assert.assertNotNull(keys);
Assert.assertTrue("Loaded key is not RSA Key", keys.getPrivate() instanceof RSAPrivateCrtKey);