You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by lg...@apache.org on 2017/03/02 20:00:19 UTC

[1/2] mina-sshd git commit: [SSHD-727] Upgrade used EdDSA artifact version to 1.1

Repository: mina-sshd
Updated Branches:
  refs/heads/master 8e255459a -> cbb92d2a8


[SSHD-727] Upgrade used EdDSA artifact version to 1.1


Project: http://git-wip-us.apache.org/repos/asf/mina-sshd/repo
Commit: http://git-wip-us.apache.org/repos/asf/mina-sshd/commit/cbb92d2a
Tree: http://git-wip-us.apache.org/repos/asf/mina-sshd/tree/cbb92d2a
Diff: http://git-wip-us.apache.org/repos/asf/mina-sshd/diff/cbb92d2a

Branch: refs/heads/master
Commit: cbb92d2a89600ee8a34abdf7d84cdc08291dcbf5
Parents: 22dc7c3
Author: Lyor Goldstein <ly...@gmail.com>
Authored: Thu Mar 2 21:47:51 2017 +0200
Committer: Lyor Goldstein <ly...@gmail.com>
Committed: Thu Mar 2 22:01:14 2017 +0200

----------------------------------------------------------------------
 pom.xml                                         |   6 +-
 .../common/util/security/SecurityUtils.java     |  31 +--
 .../security/eddsa/EdDSASecurityProvider.java   | 205 -------------------
 .../eddsa/EdDSASecurityProviderRegistrar.java   |   2 +-
 .../eddsa/EdDSASecurityProviderUtils.java       | 197 ++++++++++++++++++
 .../OpenSSHEd25519PrivateKeyEntryDecoder.java   |   2 +-
 .../common/signature/SignaturesDevelopment.java |   6 +-
 .../util/security/eddsa/Ed25519VectorsTest.java |  12 +-
 .../EdDSASecurityProviderRegistrarTest.java     |   2 +
 9 files changed, 229 insertions(+), 234 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/cbb92d2a/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 806f7fb..06ec711 100644
--- a/pom.xml
+++ b/pom.xml
@@ -104,7 +104,7 @@
         <gmaven.plugin.version>2.0</gmaven.plugin.version>
         <groovy.major.version>2</groovy.major.version>
         <groovy.minor.version>4</groovy.minor.version>
-        <groovy.release.version>8</groovy.release.version>
+        <groovy.release.version>9</groovy.release.version>
         <groovy.compliance.level>2.0</groovy.compliance.level>
         <groovy.version>${groovy.major.version}.${groovy.minor.version}.${groovy.release.version}</groovy.version>        
 
@@ -202,7 +202,7 @@
             <dependency>
                 <groupId>net.i2p.crypto</groupId>
                 <artifactId>eddsa</artifactId>
-                <version>0.1.0</version>
+                <version>0.1.1</version>
             </dependency>
 
             <dependency>
@@ -594,7 +594,7 @@
                         <dependency>
                             <groupId>com.puppycrawl.tools</groupId>
                             <artifactId>checkstyle</artifactId>
-                            <version>7.5.1</version>
+                            <version>7.6</version>
                             <exclusions>
                                 <!-- MCHECKSTYLE-156 -->
                                 <exclusion>

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/cbb92d2a/sshd-core/src/main/java/org/apache/sshd/common/util/security/SecurityUtils.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/security/SecurityUtils.java b/sshd-core/src/main/java/org/apache/sshd/common/util/security/SecurityUtils.java
index 6aff088..b86bcc3 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/security/SecurityUtils.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/security/SecurityUtils.java
@@ -73,7 +73,7 @@ import org.apache.sshd.common.util.buffer.Buffer;
 import org.apache.sshd.common.util.security.bouncycastle.BouncyCastleGeneratorHostKeyProvider;
 import org.apache.sshd.common.util.security.bouncycastle.BouncyCastleKeyPairResourceParser;
 import org.apache.sshd.common.util.security.bouncycastle.BouncyCastleRandomFactory;
-import org.apache.sshd.common.util.security.eddsa.EdDSASecurityProvider;
+import org.apache.sshd.common.util.security.eddsa.EdDSASecurityProviderUtils;
 import org.apache.sshd.common.util.threads.ThreadUtils;
 import org.apache.sshd.server.keyprovider.AbstractGeneratorHostKeyProvider;
 import org.slf4j.Logger;
@@ -91,12 +91,13 @@ public final class SecurityUtils {
     public static final String BOUNCY_CASTLE = "BC";
 
     /**
-     * EDDSA support
+     * EDDSA support - should match {@code EdDSAKey.KEY_ALGORITHM}
      */
     public static final String EDDSA = "EdDSA";
 
     // A copy-paste from the original, but we don't want to drag the classes into the classpath
-    public static final String CURVE_ED25519_SHA512 = "ed25519-sha-512";
+    // See EdDSANamedCurveTable.CURVE_ED25519_SHA512
+    public static final String CURVE_ED25519_SHA512 = "SHA512withEd25519";
 
     /**
      * System property used to configure the value for the maximum supported Diffie-Hellman
@@ -538,7 +539,7 @@ public final class SecurityUtils {
             throw new UnsupportedOperationException(EDDSA + " provider N/A");
         }
 
-        return EdDSASecurityProvider.getEDDSAPublicKeyEntryDecoder();
+        return EdDSASecurityProviderUtils.getEDDSAPublicKeyEntryDecoder();
     }
 
     public static PrivateKeyEntryDecoder<? extends PublicKey, ? extends PrivateKey> getOpenSSHEDDSAPrivateKeyEntryDecoder() {
@@ -546,35 +547,35 @@ public final class SecurityUtils {
             throw new UnsupportedOperationException(EDDSA + " provider N/A");
         }
 
-        return EdDSASecurityProvider.getOpenSSHEDDSAPrivateKeyEntryDecoder();
+        return EdDSASecurityProviderUtils.getOpenSSHEDDSAPrivateKeyEntryDecoder();
     }
 
     public static org.apache.sshd.common.signature.Signature getEDDSASigner() {
         if (isEDDSACurveSupported()) {
-            return EdDSASecurityProvider.getEDDSASignature();
+            return EdDSASecurityProviderUtils.getEDDSASignature();
         }
 
         throw new UnsupportedOperationException(EDDSA + " Signer not available");
     }
 
     public static int getEDDSAKeySize(Key key) {
-        return EdDSASecurityProvider.getEDDSAKeySize(key);
+        return EdDSASecurityProviderUtils.getEDDSAKeySize(key);
     }
 
     public static Class<? extends PublicKey> getEDDSAPublicKeyType() {
-        return isEDDSACurveSupported() ? EdDSASecurityProvider.getEDDSAPublicKeyType() : PublicKey.class;
+        return isEDDSACurveSupported() ? EdDSASecurityProviderUtils.getEDDSAPublicKeyType() : PublicKey.class;
     }
 
     public static Class<? extends PrivateKey> getEDDSAPrivateKeyType() {
-        return isEDDSACurveSupported() ? EdDSASecurityProvider.getEDDSAPrivateKeyType() : PrivateKey.class;
+        return isEDDSACurveSupported() ? EdDSASecurityProviderUtils.getEDDSAPrivateKeyType() : PrivateKey.class;
     }
 
     public static boolean compareEDDSAPPublicKeys(PublicKey k1, PublicKey k2) {
-        return isEDDSACurveSupported() ? EdDSASecurityProvider.compareEDDSAPPublicKeys(k1, k2) : false;
+        return isEDDSACurveSupported() ? EdDSASecurityProviderUtils.compareEDDSAPPublicKeys(k1, k2) : false;
     }
 
     public static boolean compareEDDSAPrivateKeys(PrivateKey k1, PrivateKey k2) {
-        return isEDDSACurveSupported() ? EdDSASecurityProvider.compareEDDSAPrivateKeys(k1, k2) : false;
+        return isEDDSACurveSupported() ? EdDSASecurityProviderUtils.compareEDDSAPrivateKeys(k1, k2) : false;
     }
 
     public static PublicKey recoverEDDSAPublicKey(PrivateKey key) throws GeneralSecurityException {
@@ -582,7 +583,7 @@ public final class SecurityUtils {
             throw new NoSuchAlgorithmException(EDDSA + " provider not supported");
         }
 
-        return EdDSASecurityProvider.recoverEDDSAPublicKey(key);
+        return EdDSASecurityProviderUtils.recoverEDDSAPublicKey(key);
     }
 
     public static PublicKey generateEDDSAPublicKey(String keyType, byte[] seed) throws GeneralSecurityException {
@@ -594,7 +595,7 @@ public final class SecurityUtils {
             throw new NoSuchAlgorithmException(EDDSA + " provider not supported");
         }
 
-        return EdDSASecurityProvider.generateEDDSAPublicKey(seed);
+        return EdDSASecurityProviderUtils.generateEDDSAPublicKey(seed);
     }
 
     public static <B extends Buffer> B putRawEDDSAPublicKey(B buffer, PublicKey key) {
@@ -602,7 +603,7 @@ public final class SecurityUtils {
             throw new UnsupportedOperationException(EDDSA + " provider not supported");
         }
 
-        return EdDSASecurityProvider.putRawEDDSAPublicKey(buffer, key);
+        return EdDSASecurityProviderUtils.putRawEDDSAPublicKey(buffer, key);
     }
 
     public static <B extends Buffer> B putEDDSAKeyPair(B buffer, KeyPair kp) {
@@ -614,7 +615,7 @@ public final class SecurityUtils {
             throw new UnsupportedOperationException(EDDSA + " provider not supported");
         }
 
-        return EdDSASecurityProvider.putEDDSAKeyPair(buffer, pubKey, prvKey);
+        return EdDSASecurityProviderUtils.putEDDSAKeyPair(buffer, pubKey, prvKey);
     }
 
     public static KeyPair extractEDDSAKeyPair(Buffer buffer, String keyType) throws GeneralSecurityException {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/cbb92d2a/sshd-core/src/main/java/org/apache/sshd/common/util/security/eddsa/EdDSASecurityProvider.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/security/eddsa/EdDSASecurityProvider.java b/sshd-core/src/main/java/org/apache/sshd/common/util/security/eddsa/EdDSASecurityProvider.java
deleted file mode 100644
index e039547..0000000
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/security/eddsa/EdDSASecurityProvider.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.sshd.common.util.security.eddsa;
-
-import java.security.GeneralSecurityException;
-import java.security.InvalidKeyException;
-import java.security.Key;
-import java.security.KeyFactory;
-import java.security.NoSuchAlgorithmException;
-import java.security.PrivateKey;
-import java.security.Provider;
-import java.security.PublicKey;
-import java.util.Arrays;
-import java.util.Objects;
-
-import net.i2p.crypto.eddsa.EdDSAKey;
-import net.i2p.crypto.eddsa.EdDSAPrivateKey;
-import net.i2p.crypto.eddsa.EdDSAPublicKey;
-import net.i2p.crypto.eddsa.spec.EdDSANamedCurveTable;
-import net.i2p.crypto.eddsa.spec.EdDSAParameterSpec;
-import net.i2p.crypto.eddsa.spec.EdDSAPrivateKeySpec;
-import net.i2p.crypto.eddsa.spec.EdDSAPublicKeySpec;
-
-import org.apache.sshd.common.config.keys.PrivateKeyEntryDecoder;
-import org.apache.sshd.common.config.keys.PublicKeyEntryDecoder;
-import org.apache.sshd.common.keyprovider.KeyPairProvider;
-import org.apache.sshd.common.util.ValidateUtils;
-import org.apache.sshd.common.util.buffer.Buffer;
-import org.apache.sshd.common.util.security.SecurityUtils;
-
-/**
- * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
- */
-public class EdDSASecurityProvider extends Provider {
-    private static final long serialVersionUID = -6183277432144104981L;
-
-    public EdDSASecurityProvider() {
-        super(SecurityUtils.EDDSA, 0.1, "net.i2p security provider wrapper");
-
-        // see https://docs.oracle.com/javase/8/docs/technotes/guides/security/crypto/HowToImplAProvider.html
-        put("KeyPairGenerator." + SecurityUtils.EDDSA, "net.i2p.crypto.eddsa.KeyPairGenerator");
-        put("KeyFactory." + SecurityUtils.EDDSA, "net.i2p.crypto.eddsa.KeyFactory");
-        put("Signature." + EdDSANamedCurveTable.CURVE_ED25519_SHA512, "net.i2p.crypto.eddsa.EdDSAEngine");
-    }
-
-    public static Class<? extends PublicKey> getEDDSAPublicKeyType() {
-        return EdDSAPublicKey.class;
-    }
-
-    public static Class<? extends PrivateKey> getEDDSAPrivateKeyType() {
-        return EdDSAPrivateKey.class;
-    }
-
-    public static int getEDDSAKeySize(Key key) {
-        return (SecurityUtils.isEDDSACurveSupported() && (key instanceof EdDSAKey)) ? 256 : -1;
-    }
-
-    public static boolean compareEDDSAPPublicKeys(PublicKey k1, PublicKey k2) {
-        if (!SecurityUtils.isEDDSACurveSupported()) {
-            return false;
-        }
-
-        if ((k1 instanceof EdDSAPublicKey) && (k2 instanceof EdDSAPublicKey)) {
-            if (Objects.equals(k1, k2)) {
-                return true;
-            } else if (k1 == null || k2 == null) {
-                return false;   // both null is covered by Objects#equals
-            }
-
-            EdDSAPublicKey ed1 = (EdDSAPublicKey) k1;
-            EdDSAPublicKey ed2 = (EdDSAPublicKey) k2;
-            return Arrays.equals(ed1.getAbyte(), ed2.getAbyte())
-                && compareEDDSAKeyParams(ed1.getParams(), ed2.getParams());
-        }
-
-        return false;
-    }
-
-    public static boolean isEDDSASignatureAlgorithm(String algorithm) {
-        return EdDSANamedCurveTable.CURVE_ED25519_SHA512.equalsIgnoreCase(algorithm);
-    }
-
-    public static EdDSAPublicKey recoverEDDSAPublicKey(PrivateKey key) throws GeneralSecurityException {
-        ValidateUtils.checkTrue(SecurityUtils.isEDDSACurveSupported(), SecurityUtils.EDDSA + " not supported");
-        if (!(key instanceof EdDSAPrivateKey)) {
-            throw new InvalidKeyException("Private key is not " + SecurityUtils.EDDSA);
-        }
-
-        EdDSAPrivateKey prvKey = (EdDSAPrivateKey) key;
-        EdDSAPublicKeySpec keySpec = new EdDSAPublicKeySpec(prvKey.getSeed(), prvKey.getParams());
-        KeyFactory factory = SecurityUtils.getKeyFactory(SecurityUtils.EDDSA);
-        return EdDSAPublicKey.class.cast(factory.generatePublic(keySpec));
-    }
-
-    public static org.apache.sshd.common.signature.Signature getEDDSASignature() {
-        ValidateUtils.checkTrue(SecurityUtils.isEDDSACurveSupported(), SecurityUtils.EDDSA + " not supported");
-        return new SignatureEd25519();
-    }
-
-    public static boolean isEDDSAKeyFactoryAlgorithm(String algorithm) {
-        return SecurityUtils.EDDSA.equalsIgnoreCase(algorithm);
-    }
-
-    public static boolean isEDDSAKeyPairGeneratorAlgorithm(String algorithm) {
-        return SecurityUtils.EDDSA.equalsIgnoreCase(algorithm);
-    }
-
-    public static PublicKeyEntryDecoder<? extends PublicKey, ? extends PrivateKey> getEDDSAPublicKeyEntryDecoder() {
-        ValidateUtils.checkTrue(SecurityUtils.isEDDSACurveSupported(), SecurityUtils.EDDSA + " not supported");
-        return Ed25519PublicKeyDecoder.INSTANCE;
-    }
-
-    public static PrivateKeyEntryDecoder<? extends PublicKey, ? extends PrivateKey> getOpenSSHEDDSAPrivateKeyEntryDecoder() {
-        ValidateUtils.checkTrue(SecurityUtils.isEDDSACurveSupported(), SecurityUtils.EDDSA + " not supported");
-        return OpenSSHEd25519PrivateKeyEntryDecoder.INSTANCE;
-    }
-
-    public static boolean compareEDDSAPrivateKeys(PrivateKey k1, PrivateKey k2) {
-        if (!SecurityUtils.isEDDSACurveSupported()) {
-            return false;
-        }
-
-        if ((k1 instanceof EdDSAPrivateKey) && (k2 instanceof EdDSAPrivateKey)) {
-            if (Objects.equals(k1, k2)) {
-                return true;
-            } else if (k1 == null || k2 == null) {
-                return false;   // both null is covered by Objects#equals
-            }
-
-            EdDSAPrivateKey ed1 = (EdDSAPrivateKey) k1;
-            EdDSAPrivateKey ed2 = (EdDSAPrivateKey) k2;
-            return Arrays.equals(ed1.getSeed(), ed2.getSeed())
-                && compareEDDSAKeyParams(ed1.getParams(), ed2.getParams());
-        }
-
-        return false;
-    }
-
-    public static boolean compareEDDSAKeyParams(EdDSAParameterSpec s1, EdDSAParameterSpec s2) {
-        if (Objects.equals(s1, s2)) {
-            return true;
-        } else if (s1 == null || s2 == null) {
-            return false;   // both null is covered by Objects#equals
-        } else {
-            return Objects.equals(s1.getHashAlgorithm(), s2.getHashAlgorithm())
-                && Objects.equals(s1.getCurve(), s2.getCurve())
-                && Objects.equals(s1.getB(), s2.getB());
-        }
-    }
-
-    public static PublicKey generateEDDSAPublicKey(byte[] seed) throws GeneralSecurityException {
-        if (!SecurityUtils.isEDDSACurveSupported()) {
-            throw new NoSuchAlgorithmException(SecurityUtils.EDDSA + " not supported");
-        }
-
-        EdDSAParameterSpec params = EdDSANamedCurveTable.getByName(EdDSANamedCurveTable.CURVE_ED25519_SHA512);
-        EdDSAPublicKeySpec keySpec = new EdDSAPublicKeySpec(seed, params);
-        KeyFactory factory = SecurityUtils.getKeyFactory(SecurityUtils.EDDSA);
-        return factory.generatePublic(keySpec);
-    }
-
-    public static PrivateKey generateEDDSAPrivateKey(byte[] seed) throws GeneralSecurityException {
-        if (!SecurityUtils.isEDDSACurveSupported()) {
-            throw new NoSuchAlgorithmException(SecurityUtils.EDDSA + " not supported");
-        }
-
-        EdDSAParameterSpec params = EdDSANamedCurveTable.getByName(EdDSANamedCurveTable.CURVE_ED25519_SHA512);
-        EdDSAPrivateKeySpec keySpec = new EdDSAPrivateKeySpec(seed, params);
-        KeyFactory factory = SecurityUtils.getKeyFactory(SecurityUtils.EDDSA);
-        return factory.generatePrivate(keySpec);
-    }
-
-    public static <B extends Buffer> B putRawEDDSAPublicKey(B buffer, PublicKey key) {
-        ValidateUtils.checkTrue(SecurityUtils.isEDDSACurveSupported(), SecurityUtils.EDDSA + " not supported");
-        EdDSAPublicKey edKey = ValidateUtils.checkInstanceOf(key, EdDSAPublicKey.class, "Not an EDDSA public key: %s", key);
-        byte[] seed = Ed25519PublicKeyDecoder.getSeedValue(edKey);
-        ValidateUtils.checkNotNull(seed, "No seed extracted from key: %s", edKey.getA());
-        buffer.putString(KeyPairProvider.SSH_ED25519);
-        buffer.putBytes(seed);
-        return buffer;
-    }
-
-    public static <B extends Buffer> B putEDDSAKeyPair(B buffer, PublicKey pubKey, PrivateKey prvKey) {
-        ValidateUtils.checkTrue(SecurityUtils.isEDDSACurveSupported(), SecurityUtils.EDDSA + " not supported");
-        ValidateUtils.checkInstanceOf(pubKey, EdDSAPublicKey.class, "Not an EDDSA public key: %s", pubKey);
-        ValidateUtils.checkInstanceOf(prvKey, EdDSAPrivateKey.class, "Not an EDDSA private key: %s", prvKey);
-        throw new UnsupportedOperationException("Full SSHD-440 implementation N/A");
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/cbb92d2a/sshd-core/src/main/java/org/apache/sshd/common/util/security/eddsa/EdDSASecurityProviderRegistrar.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/security/eddsa/EdDSASecurityProviderRegistrar.java b/sshd-core/src/main/java/org/apache/sshd/common/util/security/eddsa/EdDSASecurityProviderRegistrar.java
index b463d27..2bb3f95 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/security/eddsa/EdDSASecurityProviderRegistrar.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/security/eddsa/EdDSASecurityProviderRegistrar.java
@@ -36,7 +36,7 @@ import org.apache.sshd.common.util.threads.ThreadUtils;
  * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
  */
 public class EdDSASecurityProviderRegistrar extends AbstractSecurityProviderRegistrar {
-    public static final String PROVIDER_CLASS = "org.apache.sshd.common.util.security.eddsa.EdDSASecurityProvider";
+    public static final String PROVIDER_CLASS = "net.i2p.crypto.eddsa.EdDSASecurityProvider";
     // Do not define a static registrar instance to minimize class loading issues
     private final AtomicReference<Boolean> supportHolder = new AtomicReference<>(null);
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/cbb92d2a/sshd-core/src/main/java/org/apache/sshd/common/util/security/eddsa/EdDSASecurityProviderUtils.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/security/eddsa/EdDSASecurityProviderUtils.java b/sshd-core/src/main/java/org/apache/sshd/common/util/security/eddsa/EdDSASecurityProviderUtils.java
new file mode 100644
index 0000000..b5d79f0
--- /dev/null
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/security/eddsa/EdDSASecurityProviderUtils.java
@@ -0,0 +1,197 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sshd.common.util.security.eddsa;
+
+import java.security.GeneralSecurityException;
+import java.security.InvalidKeyException;
+import java.security.Key;
+import java.security.KeyFactory;
+import java.security.NoSuchAlgorithmException;
+import java.security.PrivateKey;
+import java.security.PublicKey;
+import java.util.Arrays;
+import java.util.Objects;
+
+import net.i2p.crypto.eddsa.EdDSAKey;
+import net.i2p.crypto.eddsa.EdDSAPrivateKey;
+import net.i2p.crypto.eddsa.EdDSAPublicKey;
+import net.i2p.crypto.eddsa.spec.EdDSANamedCurveTable;
+import net.i2p.crypto.eddsa.spec.EdDSAParameterSpec;
+import net.i2p.crypto.eddsa.spec.EdDSAPrivateKeySpec;
+import net.i2p.crypto.eddsa.spec.EdDSAPublicKeySpec;
+
+import org.apache.sshd.common.config.keys.PrivateKeyEntryDecoder;
+import org.apache.sshd.common.config.keys.PublicKeyEntryDecoder;
+import org.apache.sshd.common.keyprovider.KeyPairProvider;
+import org.apache.sshd.common.util.ValidateUtils;
+import org.apache.sshd.common.util.buffer.Buffer;
+import org.apache.sshd.common.util.security.SecurityUtils;
+
+/**
+ * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
+ */
+public final class EdDSASecurityProviderUtils {
+    private EdDSASecurityProviderUtils() {
+        throw new UnsupportedOperationException("No instance");
+    }
+
+    public static Class<? extends PublicKey> getEDDSAPublicKeyType() {
+        return EdDSAPublicKey.class;
+    }
+
+    public static Class<? extends PrivateKey> getEDDSAPrivateKeyType() {
+        return EdDSAPrivateKey.class;
+    }
+
+    public static int getEDDSAKeySize(Key key) {
+        return (SecurityUtils.isEDDSACurveSupported() && (key instanceof EdDSAKey)) ? 256 : -1;
+    }
+
+    public static boolean compareEDDSAPPublicKeys(PublicKey k1, PublicKey k2) {
+        if (!SecurityUtils.isEDDSACurveSupported()) {
+            return false;
+        }
+
+        if ((k1 instanceof EdDSAPublicKey) && (k2 instanceof EdDSAPublicKey)) {
+            if (Objects.equals(k1, k2)) {
+                return true;
+            } else if (k1 == null || k2 == null) {
+                return false;   // both null is covered by Objects#equals
+            }
+
+            EdDSAPublicKey ed1 = (EdDSAPublicKey) k1;
+            EdDSAPublicKey ed2 = (EdDSAPublicKey) k2;
+            return Arrays.equals(ed1.getAbyte(), ed2.getAbyte())
+                && compareEDDSAKeyParams(ed1.getParams(), ed2.getParams());
+        }
+
+        return false;
+    }
+
+    public static boolean isEDDSASignatureAlgorithm(String algorithm) {
+        return EdDSANamedCurveTable.CURVE_ED25519_SHA512.equalsIgnoreCase(algorithm);
+    }
+
+    public static EdDSAPublicKey recoverEDDSAPublicKey(PrivateKey key) throws GeneralSecurityException {
+        ValidateUtils.checkTrue(SecurityUtils.isEDDSACurveSupported(), SecurityUtils.EDDSA + " not supported");
+        if (!(key instanceof EdDSAPrivateKey)) {
+            throw new InvalidKeyException("Private key is not " + SecurityUtils.EDDSA);
+        }
+
+        EdDSAPrivateKey prvKey = (EdDSAPrivateKey) key;
+        EdDSAPublicKeySpec keySpec = new EdDSAPublicKeySpec(prvKey.getSeed(), prvKey.getParams());
+        KeyFactory factory = SecurityUtils.getKeyFactory(SecurityUtils.EDDSA);
+        return EdDSAPublicKey.class.cast(factory.generatePublic(keySpec));
+    }
+
+    public static org.apache.sshd.common.signature.Signature getEDDSASignature() {
+        ValidateUtils.checkTrue(SecurityUtils.isEDDSACurveSupported(), SecurityUtils.EDDSA + " not supported");
+        return new SignatureEd25519();
+    }
+
+    public static boolean isEDDSAKeyFactoryAlgorithm(String algorithm) {
+        return SecurityUtils.EDDSA.equalsIgnoreCase(algorithm);
+    }
+
+    public static boolean isEDDSAKeyPairGeneratorAlgorithm(String algorithm) {
+        return SecurityUtils.EDDSA.equalsIgnoreCase(algorithm);
+    }
+
+    public static PublicKeyEntryDecoder<? extends PublicKey, ? extends PrivateKey> getEDDSAPublicKeyEntryDecoder() {
+        ValidateUtils.checkTrue(SecurityUtils.isEDDSACurveSupported(), SecurityUtils.EDDSA + " not supported");
+        return Ed25519PublicKeyDecoder.INSTANCE;
+    }
+
+    public static PrivateKeyEntryDecoder<? extends PublicKey, ? extends PrivateKey> getOpenSSHEDDSAPrivateKeyEntryDecoder() {
+        ValidateUtils.checkTrue(SecurityUtils.isEDDSACurveSupported(), SecurityUtils.EDDSA + " not supported");
+        return OpenSSHEd25519PrivateKeyEntryDecoder.INSTANCE;
+    }
+
+    public static boolean compareEDDSAPrivateKeys(PrivateKey k1, PrivateKey k2) {
+        if (!SecurityUtils.isEDDSACurveSupported()) {
+            return false;
+        }
+
+        if ((k1 instanceof EdDSAPrivateKey) && (k2 instanceof EdDSAPrivateKey)) {
+            if (Objects.equals(k1, k2)) {
+                return true;
+            } else if (k1 == null || k2 == null) {
+                return false;   // both null is covered by Objects#equals
+            }
+
+            EdDSAPrivateKey ed1 = (EdDSAPrivateKey) k1;
+            EdDSAPrivateKey ed2 = (EdDSAPrivateKey) k2;
+            return Arrays.equals(ed1.getSeed(), ed2.getSeed())
+                && compareEDDSAKeyParams(ed1.getParams(), ed2.getParams());
+        }
+
+        return false;
+    }
+
+    public static boolean compareEDDSAKeyParams(EdDSAParameterSpec s1, EdDSAParameterSpec s2) {
+        if (Objects.equals(s1, s2)) {
+            return true;
+        } else if (s1 == null || s2 == null) {
+            return false;   // both null is covered by Objects#equals
+        } else {
+            return Objects.equals(s1.getHashAlgorithm(), s2.getHashAlgorithm())
+                && Objects.equals(s1.getCurve(), s2.getCurve())
+                && Objects.equals(s1.getB(), s2.getB());
+        }
+    }
+
+    public static PublicKey generateEDDSAPublicKey(byte[] seed) throws GeneralSecurityException {
+        if (!SecurityUtils.isEDDSACurveSupported()) {
+            throw new NoSuchAlgorithmException(SecurityUtils.EDDSA + " not supported");
+        }
+
+        EdDSAParameterSpec params = EdDSANamedCurveTable.getByName(EdDSANamedCurveTable.CURVE_ED25519_SHA512);
+        EdDSAPublicKeySpec keySpec = new EdDSAPublicKeySpec(seed, params);
+        KeyFactory factory = SecurityUtils.getKeyFactory(SecurityUtils.EDDSA);
+        return factory.generatePublic(keySpec);
+    }
+
+    public static PrivateKey generateEDDSAPrivateKey(byte[] seed) throws GeneralSecurityException {
+        if (!SecurityUtils.isEDDSACurveSupported()) {
+            throw new NoSuchAlgorithmException(SecurityUtils.EDDSA + " not supported");
+        }
+
+        EdDSAParameterSpec params = EdDSANamedCurveTable.getByName(EdDSANamedCurveTable.CURVE_ED25519_SHA512);
+        EdDSAPrivateKeySpec keySpec = new EdDSAPrivateKeySpec(seed, params);
+        KeyFactory factory = SecurityUtils.getKeyFactory(SecurityUtils.EDDSA);
+        return factory.generatePrivate(keySpec);
+    }
+
+    public static <B extends Buffer> B putRawEDDSAPublicKey(B buffer, PublicKey key) {
+        ValidateUtils.checkTrue(SecurityUtils.isEDDSACurveSupported(), SecurityUtils.EDDSA + " not supported");
+        EdDSAPublicKey edKey = ValidateUtils.checkInstanceOf(key, EdDSAPublicKey.class, "Not an EDDSA public key: %s", key);
+        byte[] seed = Ed25519PublicKeyDecoder.getSeedValue(edKey);
+        ValidateUtils.checkNotNull(seed, "No seed extracted from key: %s", edKey.getA());
+        buffer.putString(KeyPairProvider.SSH_ED25519);
+        buffer.putBytes(seed);
+        return buffer;
+    }
+
+    public static <B extends Buffer> B putEDDSAKeyPair(B buffer, PublicKey pubKey, PrivateKey prvKey) {
+        ValidateUtils.checkTrue(SecurityUtils.isEDDSACurveSupported(), SecurityUtils.EDDSA + " not supported");
+        ValidateUtils.checkInstanceOf(pubKey, EdDSAPublicKey.class, "Not an EDDSA public key: %s", pubKey);
+        ValidateUtils.checkInstanceOf(prvKey, EdDSAPrivateKey.class, "Not an EDDSA private key: %s", prvKey);
+        throw new UnsupportedOperationException("Full SSHD-440 implementation N/A");
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/cbb92d2a/sshd-core/src/main/java/org/apache/sshd/common/util/security/eddsa/OpenSSHEd25519PrivateKeyEntryDecoder.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/security/eddsa/OpenSSHEd25519PrivateKeyEntryDecoder.java b/sshd-core/src/main/java/org/apache/sshd/common/util/security/eddsa/OpenSSHEd25519PrivateKeyEntryDecoder.java
index b05a4cc..e5ae0ac 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/security/eddsa/OpenSSHEd25519PrivateKeyEntryDecoder.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/security/eddsa/OpenSSHEd25519PrivateKeyEntryDecoder.java
@@ -98,7 +98,7 @@ public class OpenSSHEd25519PrivateKeyEntryDecoder extends AbstractPrivateKeyEntr
 
     @Override
     public EdDSAPublicKey recoverPublicKey(EdDSAPrivateKey prvKey) throws GeneralSecurityException {
-        return EdDSASecurityProvider.recoverEDDSAPublicKey(prvKey);
+        return EdDSASecurityProviderUtils.recoverEDDSAPublicKey(prvKey);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/cbb92d2a/sshd-core/src/test/java/org/apache/sshd/common/signature/SignaturesDevelopment.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/signature/SignaturesDevelopment.java b/sshd-core/src/test/java/org/apache/sshd/common/signature/SignaturesDevelopment.java
index 6c4929a..180e997 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/signature/SignaturesDevelopment.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/signature/SignaturesDevelopment.java
@@ -25,7 +25,7 @@ import java.security.PublicKey;
 
 import org.apache.sshd.common.util.GenericUtils;
 import org.apache.sshd.common.util.buffer.BufferUtils;
-import org.apache.sshd.common.util.security.eddsa.EdDSASecurityProvider;
+import org.apache.sshd.common.util.security.eddsa.EdDSASecurityProviderUtils;
 import org.apache.sshd.util.test.BaseTestSupport;
 
 /**
@@ -64,9 +64,9 @@ public class SignaturesDevelopment extends BaseTestSupport {
         SignatureFactory factory = BuiltinSignatures.resolveFactory(args[0]);
         // TODO recover public/private keys according to factory name
         byte[] publicKey = BufferUtils.decodeHex(':', args[1]);
-        PublicKey pubKey = EdDSASecurityProvider.generateEDDSAPublicKey(publicKey);
+        PublicKey pubKey = EdDSASecurityProviderUtils.generateEDDSAPublicKey(publicKey);
         byte[] privateKey = BufferUtils.decodeHex(':', args[2]);
-        PrivateKey prvKey = EdDSASecurityProvider.generateEDDSAPrivateKey(privateKey);
+        PrivateKey prvKey = EdDSASecurityProviderUtils.generateEDDSAPrivateKey(privateKey);
         String op = args[3];
         byte[] data = BufferUtils.decodeHex(':', args[4]);
         byte[] signature = GenericUtils.EMPTY_BYTE_ARRAY;

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/cbb92d2a/sshd-core/src/test/java/org/apache/sshd/common/util/security/eddsa/Ed25519VectorsTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/util/security/eddsa/Ed25519VectorsTest.java b/sshd-core/src/test/java/org/apache/sshd/common/util/security/eddsa/Ed25519VectorsTest.java
index fab3294..b58aad3 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/util/security/eddsa/Ed25519VectorsTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/util/security/eddsa/Ed25519VectorsTest.java
@@ -60,9 +60,9 @@ public class Ed25519VectorsTest extends BaseTestSupport {
     public Ed25519VectorsTest(String name, String prvKey, String pubKey, String msg, String signature)
             throws GeneralSecurityException {
         prvBytes = BufferUtils.decodeHex(BufferUtils.EMPTY_HEX_SEPARATOR, prvKey);
-        privateKey = EdDSASecurityProvider.generateEDDSAPrivateKey(prvBytes.clone());
+        privateKey = EdDSASecurityProviderUtils.generateEDDSAPrivateKey(prvBytes.clone());
         pubBytes = BufferUtils.decodeHex(BufferUtils.EMPTY_HEX_SEPARATOR, pubKey);
-        publicKey = EdDSASecurityProvider.generateEDDSAPublicKey(pubBytes.clone());
+        publicKey = EdDSASecurityProviderUtils.generateEDDSAPublicKey(pubBytes.clone());
         msgBytes = BufferUtils.decodeHex(BufferUtils.EMPTY_HEX_SEPARATOR, msg);
         expSignature = BufferUtils.decodeHex(BufferUtils.EMPTY_HEX_SEPARATOR, signature);
     }
@@ -200,14 +200,14 @@ public class Ed25519VectorsTest extends BaseTestSupport {
 
     @Test
     public void testSignature() throws Exception {
-        Signature signer = EdDSASecurityProvider.getEDDSASignature();
+        Signature signer = EdDSASecurityProviderUtils.getEDDSASignature();
         signer.initSigner(privateKey);
         signer.update(msgBytes.clone());
 
         byte[] actSignature = signer.sign();
         assertArrayEquals("Mismatched signature", expSignature, actSignature);
 
-        Signature verifier = EdDSASecurityProvider.getEDDSASignature();
+        Signature verifier = EdDSASecurityProviderUtils.getEDDSASignature();
         verifier.initVerifier(publicKey);
         verifier.update(msgBytes.clone());
         assertTrue("Verification failed", verifier.verify(expSignature));
@@ -222,14 +222,14 @@ public class Ed25519VectorsTest extends BaseTestSupport {
         System.arraycopy(msgBytes, 0, dataBuf, offset, msgBytes.length);
         System.arraycopy(extraData, offset, dataBuf, offset + msgBytes.length, extraData.length - offset);
 
-        Signature signer = EdDSASecurityProvider.getEDDSASignature();
+        Signature signer = EdDSASecurityProviderUtils.getEDDSASignature();
         signer.initSigner(privateKey);
         signer.update(dataBuf.clone(), offset, msgBytes.length);
 
         byte[] actSignature = signer.sign();
         assertArrayEquals("Mismatched signature", expSignature, actSignature);
 
-        Signature verifier = EdDSASecurityProvider.getEDDSASignature();
+        Signature verifier = EdDSASecurityProviderUtils.getEDDSASignature();
         verifier.initVerifier(publicKey);
         verifier.update(dataBuf.clone(), offset, msgBytes.length);
         assertTrue("Verification failed", verifier.verify(expSignature));

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/cbb92d2a/sshd-core/src/test/java/org/apache/sshd/common/util/security/eddsa/EdDSASecurityProviderRegistrarTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/util/security/eddsa/EdDSASecurityProviderRegistrarTest.java b/sshd-core/src/test/java/org/apache/sshd/common/util/security/eddsa/EdDSASecurityProviderRegistrarTest.java
index 9e12fab..f2c1f3f 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/util/security/eddsa/EdDSASecurityProviderRegistrarTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/util/security/eddsa/EdDSASecurityProviderRegistrarTest.java
@@ -26,6 +26,8 @@ import java.util.Arrays;
 import java.util.Collection;
 import java.util.HashSet;
 
+import net.i2p.crypto.eddsa.EdDSASecurityProvider;
+
 import org.apache.sshd.common.util.security.SecurityProviderRegistrar;
 import org.apache.sshd.common.util.security.SecurityProviderRegistrarTestSupport;
 import org.apache.sshd.common.util.security.SecurityUtils;


Re: [1/2] mina-sshd git commit: [SSHD-727] Upgrade used EdDSA artifact version to 1.1

Posted by Guillaume Nodet <gn...@apache.org>.
I think you're in touch with the guys writing this library, maybe you can
ask them ?
I don't mind waiting a bit if the artifact comes back, but we can't stay
this way forever.
Else, yes, maybe revert until the problem is fixed.

2017-03-10 12:10 GMT+01:00 Lyor Goldstein <ly...@gmail.com>:

> You are right - it disappeared - I can assure you it was there when I
> wrote the change. What do you recommend - revert the change until it is
> there ? I am all for it...
>
> On Fri, Mar 10, 2017 at 10:09 AM, Guillaume Nodet <gn...@apache.org>
> wrote:
>
>> Can you remove it from your local repository and try again ?
>> It's definitely not in maven central:
>>   https://repo1.maven.org/maven2/net/i2p/crypto/eddsa/
>>
>> 2017-03-10 9:01 GMT+01:00 Lyor Goldstein <ly...@gmail.com>:
>>
>>> The version is 0.1.1 - I had no problem when I did the upgrade - no
>>> special repository needed
>>>
>>> בתאריך 10 במרץ 2017 09:58,‏ "Guillaume Nodet" <gn...@apache.org> כתב:
>>>
>>> I can't find this artifact in maven central.
>>>> Could you add the needed repository please ?
>>>>
>>>> 2017-03-02 21:00 GMT+01:00 <lg...@apache.org>:
>>>>
>>>>> Repository: mina-sshd
>>>>> Updated Branches:
>>>>>   refs/heads/master 8e255459a -> cbb92d2a8
>>>>>
>>>>>
>>>>> [SSHD-727] Upgrade used EdDSA artifact version to 1.1
>>>>>
>>>>>
>>>>> Project: http://git-wip-us.apache.org/repos/asf/mina-sshd/repo
>>>>> Commit: http://git-wip-us.apache.org/repos/asf/mina-sshd/commit/cbb9
>>>>> 2d2a
>>>>> Tree: http://git-wip-us.apache.org/repos/asf/mina-sshd/tree/cbb92d2a
>>>>> Diff: http://git-wip-us.apache.org/repos/asf/mina-sshd/diff/cbb92d2a
>>>>>
>>>>> Branch: refs/heads/master
>>>>> Commit: cbb92d2a89600ee8a34abdf7d84cdc08291dcbf5
>>>>> Parents: 22dc7c3
>>>>> Author: Lyor Goldstein <ly...@gmail.com>
>>>>> Authored: Thu Mar 2 21:47:51 2017 +0200
>>>>> Committer: Lyor Goldstein <ly...@gmail.com>
>>>>> Committed: Thu Mar 2 22:01:14 2017 +0200
>>>>>
>>>>> ----------------------------------------------------------------------
>>>>>  pom.xml                                         |   6 +-
>>>>>  .../common/util/security/SecurityUtils.java     |  31 +--
>>>>>  .../security/eddsa/EdDSASecurityProvider.java   | 205
>>>>> -------------------
>>>>>  .../eddsa/EdDSASecurityProviderRegistrar.java   |   2 +-
>>>>>  .../eddsa/EdDSASecurityProviderUtils.java       | 197
>>>>> ++++++++++++++++++
>>>>>  .../OpenSSHEd25519PrivateKeyEntryDecoder.java   |   2 +-
>>>>>  .../common/signature/SignaturesDevelopment.java |   6 +-
>>>>>  .../util/security/eddsa/Ed25519VectorsTest.java |  12 +-
>>>>>  .../EdDSASecurityProviderRegistrarTest.java     |   2 +
>>>>>  9 files changed, 229 insertions(+), 234 deletions(-)
>>>>> ----------------------------------------------------------------------
>>>>>
>>>>>
>>>>> http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/cbb92d2a/pom.xml
>>>>> ----------------------------------------------------------------------
>>>>> diff --git a/pom.xml b/pom.xml
>>>>> index 806f7fb..06ec711 100644
>>>>> --- a/pom.xml
>>>>> +++ b/pom.xml
>>>>> @@ -104,7 +104,7 @@
>>>>>          <gmaven.plugin.version>2.0</gmaven.plugin.version>
>>>>>          <groovy.major.version>2</groovy.major.version>
>>>>>          <groovy.minor.version>4</groovy.minor.version>
>>>>> -        <groovy.release.version>8</groovy.release.version>
>>>>> +        <groovy.release.version>9</groovy.release.version>
>>>>>          <groovy.compliance.level>2.0</groovy.compliance.level>
>>>>>          <groovy.version>${groovy.major.version}.${groovy.minor.vers
>>>>> ion}.${groovy.release.version}</groovy.version>
>>>>>
>>>>> @@ -202,7 +202,7 @@
>>>>>              <dependency>
>>>>>                  <groupId>net.i2p.crypto</groupId>
>>>>>                  <artifactId>eddsa</artifactId>
>>>>> -                <version>0.1.0</version>
>>>>> +                <version>0.1.1</version>
>>>>>              </dependency>
>>>>>
>>>>>              <dependency>
>>>>> @@ -594,7 +594,7 @@
>>>>>                          <dependency>
>>>>>                              <groupId>com.puppycrawl.tools</groupId>
>>>>>                              <artifactId>checkstyle</artifactId>
>>>>> -                            <version>7.5.1</version>
>>>>> +                            <version>7.6</version>
>>>>>                              <exclusions>
>>>>>                                  <!-- MCHECKSTYLE-156 -->
>>>>>                                  <exclusion>
>>>>>
>>>>> http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/cbb92d
>>>>> 2a/sshd-core/src/main/java/org/apache/sshd/common/util/secur
>>>>> ity/SecurityUtils.java
>>>>> ----------------------------------------------------------------------
>>>>> diff --git a/sshd-core/src/main/java/org/
>>>>> apache/sshd/common/util/security/SecurityUtils.java
>>>>> b/sshd-core/src/main/java/org/apache/sshd/common/util/securi
>>>>> ty/SecurityUtils.java
>>>>> index 6aff088..b86bcc3 100644
>>>>> --- a/sshd-core/src/main/java/org/apache/sshd/common/util/securi
>>>>> ty/SecurityUtils.java
>>>>> +++ b/sshd-core/src/main/java/org/apache/sshd/common/util/securi
>>>>> ty/SecurityUtils.java
>>>>> @@ -73,7 +73,7 @@ import org.apache.sshd.common.util.buffer.Buffer;
>>>>>  import org.apache.sshd.common.util.security.bouncycastle.BouncyCast
>>>>> leGeneratorHostKeyProvider;
>>>>>  import org.apache.sshd.common.util.security.bouncycastle.BouncyCast
>>>>> leKeyPairResourceParser;
>>>>>  import org.apache.sshd.common.util.security.bouncycastle.BouncyCast
>>>>> leRandomFactory;
>>>>> -import org.apache.sshd.common.util.security.eddsa.EdDSASecurityProv
>>>>> ider;
>>>>> +import org.apache.sshd.common.util.security.eddsa.EdDSASecurityProv
>>>>> iderUtils;
>>>>>  import org.apache.sshd.common.util.threads.ThreadUtils;
>>>>>  import org.apache.sshd.server.keyprovider.AbstractGeneratorHostKeyP
>>>>> rovider;
>>>>>  import org.slf4j.Logger;
>>>>> @@ -91,12 +91,13 @@ public final class SecurityUtils {
>>>>>      public static final String BOUNCY_CASTLE = "BC";
>>>>>
>>>>>      /**
>>>>> -     * EDDSA support
>>>>> +     * EDDSA support - should match {@code EdDSAKey.KEY_ALGORITHM}
>>>>>       */
>>>>>      public static final String EDDSA = "EdDSA";
>>>>>
>>>>>      // A copy-paste from the original, but we don't want to drag the
>>>>> classes into the classpath
>>>>> -    public static final String CURVE_ED25519_SHA512 =
>>>>> "ed25519-sha-512";
>>>>> +    // See EdDSANamedCurveTable.CURVE_ED25519_SHA512
>>>>> +    public static final String CURVE_ED25519_SHA512 =
>>>>> "SHA512withEd25519";
>>>>>
>>>>>      /**
>>>>>       * System property used to configure the value for the maximum
>>>>> supported Diffie-Hellman
>>>>> @@ -538,7 +539,7 @@ public final class SecurityUtils {
>>>>>              throw new UnsupportedOperationException(EDDSA + "
>>>>> provider N/A");
>>>>>          }
>>>>>
>>>>> -        return EdDSASecurityProvider.getEDDSAPublicKeyEntryDecoder();
>>>>> +        return EdDSASecurityProviderUtils.get
>>>>> EDDSAPublicKeyEntryDecoder();
>>>>>      }
>>>>>
>>>>>      public static PrivateKeyEntryDecoder<? extends PublicKey, ?
>>>>> extends PrivateKey> getOpenSSHEDDSAPrivateKeyEntryDecoder() {
>>>>> @@ -546,35 +547,35 @@ public final class SecurityUtils {
>>>>>              throw new UnsupportedOperationException(EDDSA + "
>>>>> provider N/A");
>>>>>          }
>>>>>
>>>>> -        return EdDSASecurityProvider.getOpenS
>>>>> SHEDDSAPrivateKeyEntryDecoder();
>>>>> +        return EdDSASecurityProviderUtils.get
>>>>> OpenSSHEDDSAPrivateKeyEntryDecoder();
>>>>>      }
>>>>>
>>>>>      public static org.apache.sshd.common.signature.Signature
>>>>> getEDDSASigner() {
>>>>>          if (isEDDSACurveSupported()) {
>>>>> -            return EdDSASecurityProvider.getEDDSASignature();
>>>>> +            return EdDSASecurityProviderUtils.getEDDSASignature();
>>>>>          }
>>>>>
>>>>>          throw new UnsupportedOperationException(EDDSA + " Signer not
>>>>> available");
>>>>>      }
>>>>>
>>>>>      public static int getEDDSAKeySize(Key key) {
>>>>> -        return EdDSASecurityProvider.getEDDSAKeySize(key);
>>>>> +        return EdDSASecurityProviderUtils.getEDDSAKeySize(key);
>>>>>      }
>>>>>
>>>>>      public static Class<? extends PublicKey> getEDDSAPublicKeyType() {
>>>>> -        return isEDDSACurveSupported() ?
>>>>> EdDSASecurityProvider.getEDDSAPublicKeyType() : PublicKey.class;
>>>>> +        return isEDDSACurveSupported() ?
>>>>> EdDSASecurityProviderUtils.getEDDSAPublicKeyType() : PublicKey.class;
>>>>>      }
>>>>>
>>>>>      public static Class<? extends PrivateKey>
>>>>> getEDDSAPrivateKeyType() {
>>>>> -        return isEDDSACurveSupported() ?
>>>>> EdDSASecurityProvider.getEDDSAPrivateKeyType() : PrivateKey.class;
>>>>> +        return isEDDSACurveSupported() ?
>>>>> EdDSASecurityProviderUtils.getEDDSAPrivateKeyType() :
>>>>> PrivateKey.class;
>>>>>      }
>>>>>
>>>>>      public static boolean compareEDDSAPPublicKeys(PublicKey k1,
>>>>> PublicKey k2) {
>>>>> -        return isEDDSACurveSupported() ?
>>>>> EdDSASecurityProvider.compareEDDSAPPublicKeys(k1, k2) : false;
>>>>> +        return isEDDSACurveSupported() ?
>>>>> EdDSASecurityProviderUtils.compareEDDSAPPublicKeys(k1, k2) : false;
>>>>>      }
>>>>>
>>>>>      public static boolean compareEDDSAPrivateKeys(PrivateKey k1,
>>>>> PrivateKey k2) {
>>>>> -        return isEDDSACurveSupported() ?
>>>>> EdDSASecurityProvider.compareEDDSAPrivateKeys(k1, k2) : false;
>>>>> +        return isEDDSACurveSupported() ?
>>>>> EdDSASecurityProviderUtils.compareEDDSAPrivateKeys(k1, k2) : false;
>>>>>      }
>>>>>
>>>>>      public static PublicKey recoverEDDSAPublicKey(PrivateKey key)
>>>>> throws GeneralSecurityException {
>>>>> @@ -582,7 +583,7 @@ public final class SecurityUtils {
>>>>>              throw new NoSuchAlgorithmException(EDDSA + " provider not
>>>>> supported");
>>>>>          }
>>>>>
>>>>> -        return EdDSASecurityProvider.recoverEDDSAPublicKey(key);
>>>>> +        return EdDSASecurityProviderUtils.recoverEDDSAPublicKey(key);
>>>>>      }
>>>>>
>>>>>      public static PublicKey generateEDDSAPublicKey(String keyType,
>>>>> byte[] seed) throws GeneralSecurityException {
>>>>> @@ -594,7 +595,7 @@ public final class SecurityUtils {
>>>>>              throw new NoSuchAlgorithmException(EDDSA + " provider not
>>>>> supported");
>>>>>          }
>>>>>
>>>>> -        return EdDSASecurityProvider.generateEDDSAPublicKey(seed);
>>>>> +        return EdDSASecurityProviderUtils.gen
>>>>> erateEDDSAPublicKey(seed);
>>>>>      }
>>>>>
>>>>>      public static <B extends Buffer> B putRawEDDSAPublicKey(B buffer,
>>>>> PublicKey key) {
>>>>> @@ -602,7 +603,7 @@ public final class SecurityUtils {
>>>>>              throw new UnsupportedOperationException(EDDSA + "
>>>>> provider not supported");
>>>>>          }
>>>>>
>>>>> -        return EdDSASecurityProvider.putRawEDDSAPublicKey(buffer,
>>>>> key);
>>>>> +        return EdDSASecurityProviderUtils.putRawEDDSAPublicKey(buffer,
>>>>> key);
>>>>>      }
>>>>>
>>>>>      public static <B extends Buffer> B putEDDSAKeyPair(B buffer,
>>>>> KeyPair kp) {
>>>>> @@ -614,7 +615,7 @@ public final class SecurityUtils {
>>>>>              throw new UnsupportedOperationException(EDDSA + "
>>>>> provider not supported");
>>>>>          }
>>>>>
>>>>> -        return EdDSASecurityProvider.putEDDSAKeyPair(buffer, pubKey,
>>>>> prvKey);
>>>>> +        return EdDSASecurityProviderUtils.putEDDSAKeyPair(buffer,
>>>>> pubKey, prvKey);
>>>>>      }
>>>>>
>>>>>      public static KeyPair extractEDDSAKeyPair(Buffer buffer, String
>>>>> keyType) throws GeneralSecurityException {
>>>>>
>>>>> http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/cbb92d
>>>>> 2a/sshd-core/src/main/java/org/apache/sshd/common/util/secur
>>>>> ity/eddsa/EdDSASecurityProvider.java
>>>>> ----------------------------------------------------------------------
>>>>> diff --git a/sshd-core/src/main/java/org/
>>>>> apache/sshd/common/util/security/eddsa/EdDSASecurityProvider.java
>>>>> b/sshd-core/src/main/java/org/apache/sshd/common/util/securi
>>>>> ty/eddsa/EdDSASecurityProvider.java
>>>>> deleted file mode 100644
>>>>> index e039547..0000000
>>>>> --- a/sshd-core/src/main/java/org/apache/sshd/common/util/securi
>>>>> ty/eddsa/EdDSASecurityProvider.java
>>>>> +++ /dev/null
>>>>> @@ -1,205 +0,0 @@
>>>>> -/*
>>>>> - * Licensed to the Apache Software Foundation (ASF) under one
>>>>> - * or more contributor license agreements. See the NOTICE file
>>>>> - * distributed with this work for additional information
>>>>> - * regarding copyright ownership. The ASF licenses this file
>>>>> - * to you under the Apache License, Version 2.0 (the
>>>>> - * "License"); you may not use this file except in compliance
>>>>> - * with the License. You may obtain a copy of the License at
>>>>> - *
>>>>> - * http://www.apache.org/licenses/LICENSE-2.0
>>>>> - *
>>>>> - * Unless required by applicable law or agreed to in writing,
>>>>> - * software distributed under the License is distributed on an
>>>>> - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>>>>> - * KIND, either express or implied. See the License for the
>>>>> - * specific language governing permissions and limitations
>>>>> - * under the License.
>>>>> - */
>>>>> -package org.apache.sshd.common.util.security.eddsa;
>>>>> -
>>>>> -import java.security.GeneralSecurityException;
>>>>> -import java.security.InvalidKeyException;
>>>>> -import java.security.Key;
>>>>> -import java.security.KeyFactory;
>>>>> -import java.security.NoSuchAlgorithmException;
>>>>> -import java.security.PrivateKey;
>>>>> -import java.security.Provider;
>>>>> -import java.security.PublicKey;
>>>>> -import java.util.Arrays;
>>>>> -import java.util.Objects;
>>>>> -
>>>>> -import net.i2p.crypto.eddsa.EdDSAKey;
>>>>> -import net.i2p.crypto.eddsa.EdDSAPrivateKey;
>>>>> -import net.i2p.crypto.eddsa.EdDSAPublicKey;
>>>>> -import net.i2p.crypto.eddsa.spec.EdDSANamedCurveTable;
>>>>> -import net.i2p.crypto.eddsa.spec.EdDSAParameterSpec;
>>>>> -import net.i2p.crypto.eddsa.spec.EdDSAPrivateKeySpec;
>>>>> -import net.i2p.crypto.eddsa.spec.EdDSAPublicKeySpec;
>>>>> -
>>>>> -import org.apache.sshd.common.config.keys.PrivateKeyEntryDecoder;
>>>>> -import org.apache.sshd.common.config.keys.PublicKeyEntryDecoder;
>>>>> -import org.apache.sshd.common.keyprovider.KeyPairProvider;
>>>>> -import org.apache.sshd.common.util.ValidateUtils;
>>>>> -import org.apache.sshd.common.util.buffer.Buffer;
>>>>> -import org.apache.sshd.common.util.security.SecurityUtils;
>>>>> -
>>>>> -/**
>>>>> - * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD
>>>>> Project</a>
>>>>> - */
>>>>> -public class EdDSASecurityProvider extends Provider {
>>>>> -    private static final long serialVersionUID =
>>>>> -6183277432144104981L;
>>>>> -
>>>>> -    public EdDSASecurityProvider() {
>>>>> -        super(SecurityUtils.EDDSA, 0.1, "net.i2p security provider
>>>>> wrapper");
>>>>> -
>>>>> -        // see https://docs.oracle.com/javase
>>>>> /8/docs/technotes/guides/security/crypto/HowToImplAProvider.html
>>>>> -        put("KeyPairGenerator." + SecurityUtils.EDDSA,
>>>>> "net.i2p.crypto.eddsa.KeyPairGenerator");
>>>>> -        put("KeyFactory." + SecurityUtils.EDDSA,
>>>>> "net.i2p.crypto.eddsa.KeyFactory");
>>>>> -        put("Signature." + EdDSANamedCurveTable.CURVE_ED25519_SHA512,
>>>>> "net.i2p.crypto.eddsa.EdDSAEngine");
>>>>> -    }
>>>>> -
>>>>> -    public static Class<? extends PublicKey> getEDDSAPublicKeyType() {
>>>>> -        return EdDSAPublicKey.class;
>>>>> -    }
>>>>> -
>>>>> -    public static Class<? extends PrivateKey>
>>>>> getEDDSAPrivateKeyType() {
>>>>> -        return EdDSAPrivateKey.class;
>>>>> -    }
>>>>> -
>>>>> -    public static int getEDDSAKeySize(Key key) {
>>>>> -        return (SecurityUtils.isEDDSACurveSupported() && (key
>>>>> instanceof EdDSAKey)) ? 256 : -1;
>>>>> -    }
>>>>> -
>>>>> -    public static boolean compareEDDSAPPublicKeys(PublicKey k1,
>>>>> PublicKey k2) {
>>>>> -        if (!SecurityUtils.isEDDSACurveSupported()) {
>>>>> -            return false;
>>>>> -        }
>>>>> -
>>>>> -        if ((k1 instanceof EdDSAPublicKey) && (k2 instanceof
>>>>> EdDSAPublicKey)) {
>>>>> -            if (Objects.equals(k1, k2)) {
>>>>> -                return true;
>>>>> -            } else if (k1 == null || k2 == null) {
>>>>> -                return false;   // both null is covered by
>>>>> Objects#equals
>>>>> -            }
>>>>> -
>>>>> -            EdDSAPublicKey ed1 = (EdDSAPublicKey) k1;
>>>>> -            EdDSAPublicKey ed2 = (EdDSAPublicKey) k2;
>>>>> -            return Arrays.equals(ed1.getAbyte(), ed2.getAbyte())
>>>>> -                && compareEDDSAKeyParams(ed1.getParams(),
>>>>> ed2.getParams());
>>>>> -        }
>>>>> -
>>>>> -        return false;
>>>>> -    }
>>>>> -
>>>>> -    public static boolean isEDDSASignatureAlgorithm(String
>>>>> algorithm) {
>>>>> -        return EdDSANamedCurveTable.CURVE_ED2
>>>>> 5519_SHA512.equalsIgnoreCase(algorithm);
>>>>> -    }
>>>>> -
>>>>> -    public static EdDSAPublicKey recoverEDDSAPublicKey(PrivateKey
>>>>> key) throws GeneralSecurityException {
>>>>> -        ValidateUtils.checkTrue(SecurityUtils.isEDDSACurveSupported(),
>>>>> SecurityUtils.EDDSA + " not supported");
>>>>> -        if (!(key instanceof EdDSAPrivateKey)) {
>>>>> -            throw new InvalidKeyException("Private key is not " +
>>>>> SecurityUtils.EDDSA);
>>>>> -        }
>>>>> -
>>>>> -        EdDSAPrivateKey prvKey = (EdDSAPrivateKey) key;
>>>>> -        EdDSAPublicKeySpec keySpec = new
>>>>> EdDSAPublicKeySpec(prvKey.getSeed(), prvKey.getParams());
>>>>> -        KeyFactory factory = SecurityUtils.getKeyFactory(Se
>>>>> curityUtils.EDDSA);
>>>>> -        return EdDSAPublicKey.class.cast(fact
>>>>> ory.generatePublic(keySpec));
>>>>> -    }
>>>>> -
>>>>> -    public static org.apache.sshd.common.signature.Signature
>>>>> getEDDSASignature() {
>>>>> -        ValidateUtils.checkTrue(SecurityUtils.isEDDSACurveSupported(),
>>>>> SecurityUtils.EDDSA + " not supported");
>>>>> -        return new SignatureEd25519();
>>>>> -    }
>>>>> -
>>>>> -    public static boolean isEDDSAKeyFactoryAlgorithm(String
>>>>> algorithm) {
>>>>> -        return SecurityUtils.EDDSA.equalsIgnoreCase(algorithm);
>>>>> -    }
>>>>> -
>>>>> -    public static boolean isEDDSAKeyPairGeneratorAlgorithm(String
>>>>> algorithm) {
>>>>> -        return SecurityUtils.EDDSA.equalsIgnoreCase(algorithm);
>>>>> -    }
>>>>> -
>>>>> -    public static PublicKeyEntryDecoder<? extends PublicKey, ?
>>>>> extends PrivateKey> getEDDSAPublicKeyEntryDecoder() {
>>>>> -        ValidateUtils.checkTrue(SecurityUtils.isEDDSACurveSupported(),
>>>>> SecurityUtils.EDDSA + " not supported");
>>>>> -        return Ed25519PublicKeyDecoder.INSTANCE;
>>>>> -    }
>>>>> -
>>>>> -    public static PrivateKeyEntryDecoder<? extends PublicKey, ?
>>>>> extends PrivateKey> getOpenSSHEDDSAPrivateKeyEntryDecoder() {
>>>>> -        ValidateUtils.checkTrue(SecurityUtils.isEDDSACurveSupported(),
>>>>> SecurityUtils.EDDSA + " not supported");
>>>>> -        return OpenSSHEd25519PrivateKeyEntryDecoder.INSTANCE;
>>>>> -    }
>>>>> -
>>>>> -    public static boolean compareEDDSAPrivateKeys(PrivateKey k1,
>>>>> PrivateKey k2) {
>>>>> -        if (!SecurityUtils.isEDDSACurveSupported()) {
>>>>> -            return false;
>>>>> -        }
>>>>> -
>>>>> -        if ((k1 instanceof EdDSAPrivateKey) && (k2 instanceof
>>>>> EdDSAPrivateKey)) {
>>>>> -            if (Objects.equals(k1, k2)) {
>>>>> -                return true;
>>>>> -            } else if (k1 == null || k2 == null) {
>>>>> -                return false;   // both null is covered by
>>>>> Objects#equals
>>>>> -            }
>>>>> -
>>>>> -            EdDSAPrivateKey ed1 = (EdDSAPrivateKey) k1;
>>>>> -            EdDSAPrivateKey ed2 = (EdDSAPrivateKey) k2;
>>>>> -            return Arrays.equals(ed1.getSeed(), ed2.getSeed())
>>>>> -                && compareEDDSAKeyParams(ed1.getParams(),
>>>>> ed2.getParams());
>>>>> -        }
>>>>> -
>>>>> -        return false;
>>>>> -    }
>>>>> -
>>>>> -    public static boolean compareEDDSAKeyParams(EdDSAParameterSpec
>>>>> s1, EdDSAParameterSpec s2) {
>>>>> -        if (Objects.equals(s1, s2)) {
>>>>> -            return true;
>>>>> -        } else if (s1 == null || s2 == null) {
>>>>> -            return false;   // both null is covered by Objects#equals
>>>>> -        } else {
>>>>> -            return Objects.equals(s1.getHashAlgorithm(),
>>>>> s2.getHashAlgorithm())
>>>>> -                && Objects.equals(s1.getCurve(), s2.getCurve())
>>>>> -                && Objects.equals(s1.getB(), s2.getB());
>>>>> -        }
>>>>> -    }
>>>>> -
>>>>> -    public static PublicKey generateEDDSAPublicKey(byte[] seed)
>>>>> throws GeneralSecurityException {
>>>>> -        if (!SecurityUtils.isEDDSACurveSupported()) {
>>>>> -            throw new NoSuchAlgorithmException(SecurityUtils.EDDSA +
>>>>> " not supported");
>>>>> -        }
>>>>> -
>>>>> -        EdDSAParameterSpec params = EdDSANamedCurveTable.getByName
>>>>> (EdDSANamedCurveTable.CURVE_ED25519_SHA512);
>>>>> -        EdDSAPublicKeySpec keySpec = new EdDSAPublicKeySpec(seed,
>>>>> params);
>>>>> -        KeyFactory factory = SecurityUtils.getKeyFactory(Se
>>>>> curityUtils.EDDSA);
>>>>> -        return factory.generatePublic(keySpec);
>>>>> -    }
>>>>> -
>>>>> -    public static PrivateKey generateEDDSAPrivateKey(byte[] seed)
>>>>> throws GeneralSecurityException {
>>>>> -        if (!SecurityUtils.isEDDSACurveSupported()) {
>>>>> -            throw new NoSuchAlgorithmException(SecurityUtils.EDDSA +
>>>>> " not supported");
>>>>> -        }
>>>>> -
>>>>> -        EdDSAParameterSpec params = EdDSANamedCurveTable.getByName
>>>>> (EdDSANamedCurveTable.CURVE_ED25519_SHA512);
>>>>> -        EdDSAPrivateKeySpec keySpec = new EdDSAPrivateKeySpec(seed,
>>>>> params);
>>>>> -        KeyFactory factory = SecurityUtils.getKeyFactory(Se
>>>>> curityUtils.EDDSA);
>>>>> -        return factory.generatePrivate(keySpec);
>>>>> -    }
>>>>> -
>>>>> -    public static <B extends Buffer> B putRawEDDSAPublicKey(B buffer,
>>>>> PublicKey key) {
>>>>> -        ValidateUtils.checkTrue(SecurityUtils.isEDDSACurveSupported(),
>>>>> SecurityUtils.EDDSA + " not supported");
>>>>> -        EdDSAPublicKey edKey = ValidateUtils.checkInstanceOf(key,
>>>>> EdDSAPublicKey.class, "Not an EDDSA public key: %s", key);
>>>>> -        byte[] seed = Ed25519PublicKeyDecoder.getSeedValue(edKey);
>>>>> -        ValidateUtils.checkNotNull(seed, "No seed extracted from
>>>>> key: %s", edKey.getA());
>>>>> -        buffer.putString(KeyPairProvider.SSH_ED25519);
>>>>> -        buffer.putBytes(seed);
>>>>> -        return buffer;
>>>>> -    }
>>>>> -
>>>>> -    public static <B extends Buffer> B putEDDSAKeyPair(B buffer,
>>>>> PublicKey pubKey, PrivateKey prvKey) {
>>>>> -        ValidateUtils.checkTrue(SecurityUtils.isEDDSACurveSupported(),
>>>>> SecurityUtils.EDDSA + " not supported");
>>>>> -        ValidateUtils.checkInstanceOf(pubKey, EdDSAPublicKey.class,
>>>>> "Not an EDDSA public key: %s", pubKey);
>>>>> -        ValidateUtils.checkInstanceOf(prvKey, EdDSAPrivateKey.class,
>>>>> "Not an EDDSA private key: %s", prvKey);
>>>>> -        throw new UnsupportedOperationException("Full SSHD-440
>>>>> implementation N/A");
>>>>> -    }
>>>>> -}
>>>>> \ No newline at end of file
>>>>>
>>>>> http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/cbb92d
>>>>> 2a/sshd-core/src/main/java/org/apache/sshd/common/util/secur
>>>>> ity/eddsa/EdDSASecurityProviderRegistrar.java
>>>>> ----------------------------------------------------------------------
>>>>> diff --git a/sshd-core/src/main/java/org/
>>>>> apache/sshd/common/util/security/eddsa/EdDSASecurityProviderRegistrar.java
>>>>> b/sshd-core/src/main/java/org/apache/sshd/common/util/securi
>>>>> ty/eddsa/EdDSASecurityProviderRegistrar.java
>>>>> index b463d27..2bb3f95 100644
>>>>> --- a/sshd-core/src/main/java/org/apache/sshd/common/util/securi
>>>>> ty/eddsa/EdDSASecurityProviderRegistrar.java
>>>>> +++ b/sshd-core/src/main/java/org/apache/sshd/common/util/securi
>>>>> ty/eddsa/EdDSASecurityProviderRegistrar.java
>>>>> @@ -36,7 +36,7 @@ import org.apache.sshd.common.util.th
>>>>> reads.ThreadUtils;
>>>>>   * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD
>>>>> Project</a>
>>>>>   */
>>>>>  public class EdDSASecurityProviderRegistrar extends
>>>>> AbstractSecurityProviderRegistrar {
>>>>> -    public static final String PROVIDER_CLASS =
>>>>> "org.apache.sshd.common.util.security.eddsa.EdDSASecurityProvider";
>>>>> +    public static final String PROVIDER_CLASS =
>>>>> "net.i2p.crypto.eddsa.EdDSASecurityProvider";
>>>>>      // Do not define a static registrar instance to minimize class
>>>>> loading issues
>>>>>      private final AtomicReference<Boolean> supportHolder = new
>>>>> AtomicReference<>(null);
>>>>>
>>>>>
>>>>> http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/cbb92d
>>>>> 2a/sshd-core/src/main/java/org/apache/sshd/common/util/secur
>>>>> ity/eddsa/EdDSASecurityProviderUtils.java
>>>>> ----------------------------------------------------------------------
>>>>> diff --git a/sshd-core/src/main/java/org/
>>>>> apache/sshd/common/util/security/eddsa/EdDSASecurityProviderUtils.java
>>>>> b/sshd-core/src/main/java/org/apache/sshd/common/util/securi
>>>>> ty/eddsa/EdDSASecurityProviderUtils.java
>>>>> new file mode 100644
>>>>> index 0000000..b5d79f0
>>>>> --- /dev/null
>>>>> +++ b/sshd-core/src/main/java/org/apache/sshd/common/util/securi
>>>>> ty/eddsa/EdDSASecurityProviderUtils.java
>>>>> @@ -0,0 +1,197 @@
>>>>> +/*
>>>>> + * Licensed to the Apache Software Foundation (ASF) under one
>>>>> + * or more contributor license agreements. See the NOTICE file
>>>>> + * distributed with this work for additional information
>>>>> + * regarding copyright ownership. The ASF licenses this file
>>>>> + * to you under the Apache License, Version 2.0 (the
>>>>> + * "License"); you may not use this file except in compliance
>>>>> + * with the License. You may obtain a copy of the License at
>>>>> + *
>>>>> + * http://www.apache.org/licenses/LICENSE-2.0
>>>>> + *
>>>>> + * Unless required by applicable law or agreed to in writing,
>>>>> + * software distributed under the License is distributed on an
>>>>> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>>>>> + * KIND, either express or implied. See the License for the
>>>>> + * specific language governing permissions and limitations
>>>>> + * under the License.
>>>>> + */
>>>>> +package org.apache.sshd.common.util.security.eddsa;
>>>>> +
>>>>> +import java.security.GeneralSecurityException;
>>>>> +import java.security.InvalidKeyException;
>>>>> +import java.security.Key;
>>>>> +import java.security.KeyFactory;
>>>>> +import java.security.NoSuchAlgorithmException;
>>>>> +import java.security.PrivateKey;
>>>>> +import java.security.PublicKey;
>>>>> +import java.util.Arrays;
>>>>> +import java.util.Objects;
>>>>> +
>>>>> +import net.i2p.crypto.eddsa.EdDSAKey;
>>>>> +import net.i2p.crypto.eddsa.EdDSAPrivateKey;
>>>>> +import net.i2p.crypto.eddsa.EdDSAPublicKey;
>>>>> +import net.i2p.crypto.eddsa.spec.EdDSANamedCurveTable;
>>>>> +import net.i2p.crypto.eddsa.spec.EdDSAParameterSpec;
>>>>> +import net.i2p.crypto.eddsa.spec.EdDSAPrivateKeySpec;
>>>>> +import net.i2p.crypto.eddsa.spec.EdDSAPublicKeySpec;
>>>>> +
>>>>> +import org.apache.sshd.common.config.keys.PrivateKeyEntryDecoder;
>>>>> +import org.apache.sshd.common.config.keys.PublicKeyEntryDecoder;
>>>>> +import org.apache.sshd.common.keyprovider.KeyPairProvider;
>>>>> +import org.apache.sshd.common.util.ValidateUtils;
>>>>> +import org.apache.sshd.common.util.buffer.Buffer;
>>>>> +import org.apache.sshd.common.util.security.SecurityUtils;
>>>>> +
>>>>> +/**
>>>>> + * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD
>>>>> Project</a>
>>>>> + */
>>>>> +public final class EdDSASecurityProviderUtils {
>>>>> +    private EdDSASecurityProviderUtils() {
>>>>> +        throw new UnsupportedOperationException("No instance");
>>>>> +    }
>>>>> +
>>>>> +    public static Class<? extends PublicKey> getEDDSAPublicKeyType() {
>>>>> +        return EdDSAPublicKey.class;
>>>>> +    }
>>>>> +
>>>>> +    public static Class<? extends PrivateKey>
>>>>> getEDDSAPrivateKeyType() {
>>>>> +        return EdDSAPrivateKey.class;
>>>>> +    }
>>>>> +
>>>>> +    public static int getEDDSAKeySize(Key key) {
>>>>> +        return (SecurityUtils.isEDDSACurveSupported() && (key
>>>>> instanceof EdDSAKey)) ? 256 : -1;
>>>>> +    }
>>>>> +
>>>>> +    public static boolean compareEDDSAPPublicKeys(PublicKey k1,
>>>>> PublicKey k2) {
>>>>> +        if (!SecurityUtils.isEDDSACurveSupported()) {
>>>>> +            return false;
>>>>> +        }
>>>>> +
>>>>> +        if ((k1 instanceof EdDSAPublicKey) && (k2 instanceof
>>>>> EdDSAPublicKey)) {
>>>>> +            if (Objects.equals(k1, k2)) {
>>>>> +                return true;
>>>>> +            } else if (k1 == null || k2 == null) {
>>>>> +                return false;   // both null is covered by
>>>>> Objects#equals
>>>>> +            }
>>>>> +
>>>>> +            EdDSAPublicKey ed1 = (EdDSAPublicKey) k1;
>>>>> +            EdDSAPublicKey ed2 = (EdDSAPublicKey) k2;
>>>>> +            return Arrays.equals(ed1.getAbyte(), ed2.getAbyte())
>>>>> +                && compareEDDSAKeyParams(ed1.getParams(),
>>>>> ed2.getParams());
>>>>> +        }
>>>>> +
>>>>> +        return false;
>>>>> +    }
>>>>> +
>>>>> +    public static boolean isEDDSASignatureAlgorithm(String
>>>>> algorithm) {
>>>>> +        return EdDSANamedCurveTable.CURVE_ED2
>>>>> 5519_SHA512.equalsIgnoreCase(algorithm);
>>>>> +    }
>>>>> +
>>>>> +    public static EdDSAPublicKey recoverEDDSAPublicKey(PrivateKey
>>>>> key) throws GeneralSecurityException {
>>>>> +        ValidateUtils.checkTrue(SecurityUtils.isEDDSACurveSupported(),
>>>>> SecurityUtils.EDDSA + " not supported");
>>>>> +        if (!(key instanceof EdDSAPrivateKey)) {
>>>>> +            throw new InvalidKeyException("Private key is not " +
>>>>> SecurityUtils.EDDSA);
>>>>> +        }
>>>>> +
>>>>> +        EdDSAPrivateKey prvKey = (EdDSAPrivateKey) key;
>>>>> +        EdDSAPublicKeySpec keySpec = new
>>>>> EdDSAPublicKeySpec(prvKey.getSeed(), prvKey.getParams());
>>>>> +        KeyFactory factory = SecurityUtils.getKeyFactory(Se
>>>>> curityUtils.EDDSA);
>>>>> +        return EdDSAPublicKey.class.cast(fact
>>>>> ory.generatePublic(keySpec));
>>>>> +    }
>>>>> +
>>>>> +    public static org.apache.sshd.common.signature.Signature
>>>>> getEDDSASignature() {
>>>>> +        ValidateUtils.checkTrue(SecurityUtils.isEDDSACurveSupported(),
>>>>> SecurityUtils.EDDSA + " not supported");
>>>>> +        return new SignatureEd25519();
>>>>> +    }
>>>>> +
>>>>> +    public static boolean isEDDSAKeyFactoryAlgorithm(String
>>>>> algorithm) {
>>>>> +        return SecurityUtils.EDDSA.equalsIgnoreCase(algorithm);
>>>>> +    }
>>>>> +
>>>>> +    public static boolean isEDDSAKeyPairGeneratorAlgorithm(String
>>>>> algorithm) {
>>>>> +        return SecurityUtils.EDDSA.equalsIgnoreCase(algorithm);
>>>>> +    }
>>>>> +
>>>>> +    public static PublicKeyEntryDecoder<? extends PublicKey, ?
>>>>> extends PrivateKey> getEDDSAPublicKeyEntryDecoder() {
>>>>> +        ValidateUtils.checkTrue(SecurityUtils.isEDDSACurveSupported(),
>>>>> SecurityUtils.EDDSA + " not supported");
>>>>> +        return Ed25519PublicKeyDecoder.INSTANCE;
>>>>> +    }
>>>>> +
>>>>> +    public static PrivateKeyEntryDecoder<? extends PublicKey, ?
>>>>> extends PrivateKey> getOpenSSHEDDSAPrivateKeyEntryDecoder() {
>>>>> +        ValidateUtils.checkTrue(SecurityUtils.isEDDSACurveSupported(),
>>>>> SecurityUtils.EDDSA + " not supported");
>>>>> +        return OpenSSHEd25519PrivateKeyEntryDecoder.INSTANCE;
>>>>> +    }
>>>>> +
>>>>> +    public static boolean compareEDDSAPrivateKeys(PrivateKey k1,
>>>>> PrivateKey k2) {
>>>>> +        if (!SecurityUtils.isEDDSACurveSupported()) {
>>>>> +            return false;
>>>>> +        }
>>>>> +
>>>>> +        if ((k1 instanceof EdDSAPrivateKey) && (k2 instanceof
>>>>> EdDSAPrivateKey)) {
>>>>> +            if (Objects.equals(k1, k2)) {
>>>>> +                return true;
>>>>> +            } else if (k1 == null || k2 == null) {
>>>>> +                return false;   // both null is covered by
>>>>> Objects#equals
>>>>> +            }
>>>>> +
>>>>> +            EdDSAPrivateKey ed1 = (EdDSAPrivateKey) k1;
>>>>> +            EdDSAPrivateKey ed2 = (EdDSAPrivateKey) k2;
>>>>> +            return Arrays.equals(ed1.getSeed(), ed2.getSeed())
>>>>> +                && compareEDDSAKeyParams(ed1.getParams(),
>>>>> ed2.getParams());
>>>>> +        }
>>>>> +
>>>>> +        return false;
>>>>> +    }
>>>>> +
>>>>> +    public static boolean compareEDDSAKeyParams(EdDSAParameterSpec
>>>>> s1, EdDSAParameterSpec s2) {
>>>>> +        if (Objects.equals(s1, s2)) {
>>>>> +            return true;
>>>>> +        } else if (s1 == null || s2 == null) {
>>>>> +            return false;   // both null is covered by Objects#equals
>>>>> +        } else {
>>>>> +            return Objects.equals(s1.getHashAlgorithm(),
>>>>> s2.getHashAlgorithm())
>>>>> +                && Objects.equals(s1.getCurve(), s2.getCurve())
>>>>> +                && Objects.equals(s1.getB(), s2.getB());
>>>>> +        }
>>>>> +    }
>>>>> +
>>>>> +    public static PublicKey generateEDDSAPublicKey(byte[] seed)
>>>>> throws GeneralSecurityException {
>>>>> +        if (!SecurityUtils.isEDDSACurveSupported()) {
>>>>> +            throw new NoSuchAlgorithmException(SecurityUtils.EDDSA +
>>>>> " not supported");
>>>>> +        }
>>>>> +
>>>>> +        EdDSAParameterSpec params = EdDSANamedCurveTable.getByName
>>>>> (EdDSANamedCurveTable.CURVE_ED25519_SHA512);
>>>>> +        EdDSAPublicKeySpec keySpec = new EdDSAPublicKeySpec(seed,
>>>>> params);
>>>>> +        KeyFactory factory = SecurityUtils.getKeyFactory(Se
>>>>> curityUtils.EDDSA);
>>>>> +        return factory.generatePublic(keySpec);
>>>>> +    }
>>>>> +
>>>>> +    public static PrivateKey generateEDDSAPrivateKey(byte[] seed)
>>>>> throws GeneralSecurityException {
>>>>> +        if (!SecurityUtils.isEDDSACurveSupported()) {
>>>>> +            throw new NoSuchAlgorithmException(SecurityUtils.EDDSA +
>>>>> " not supported");
>>>>> +        }
>>>>> +
>>>>> +        EdDSAParameterSpec params = EdDSANamedCurveTable.getByName
>>>>> (EdDSANamedCurveTable.CURVE_ED25519_SHA512);
>>>>> +        EdDSAPrivateKeySpec keySpec = new EdDSAPrivateKeySpec(seed,
>>>>> params);
>>>>> +        KeyFactory factory = SecurityUtils.getKeyFactory(Se
>>>>> curityUtils.EDDSA);
>>>>> +        return factory.generatePrivate(keySpec);
>>>>> +    }
>>>>> +
>>>>> +    public static <B extends Buffer> B putRawEDDSAPublicKey(B buffer,
>>>>> PublicKey key) {
>>>>> +        ValidateUtils.checkTrue(SecurityUtils.isEDDSACurveSupported(),
>>>>> SecurityUtils.EDDSA + " not supported");
>>>>> +        EdDSAPublicKey edKey = ValidateUtils.checkInstanceOf(key,
>>>>> EdDSAPublicKey.class, "Not an EDDSA public key: %s", key);
>>>>> +        byte[] seed = Ed25519PublicKeyDecoder.getSeedValue(edKey);
>>>>> +        ValidateUtils.checkNotNull(seed, "No seed extracted from
>>>>> key: %s", edKey.getA());
>>>>> +        buffer.putString(KeyPairProvider.SSH_ED25519);
>>>>> +        buffer.putBytes(seed);
>>>>> +        return buffer;
>>>>> +    }
>>>>> +
>>>>> +    public static <B extends Buffer> B putEDDSAKeyPair(B buffer,
>>>>> PublicKey pubKey, PrivateKey prvKey) {
>>>>> +        ValidateUtils.checkTrue(SecurityUtils.isEDDSACurveSupported(),
>>>>> SecurityUtils.EDDSA + " not supported");
>>>>> +        ValidateUtils.checkInstanceOf(pubKey, EdDSAPublicKey.class,
>>>>> "Not an EDDSA public key: %s", pubKey);
>>>>> +        ValidateUtils.checkInstanceOf(prvKey, EdDSAPrivateKey.class,
>>>>> "Not an EDDSA private key: %s", prvKey);
>>>>> +        throw new UnsupportedOperationException("Full SSHD-440
>>>>> implementation N/A");
>>>>> +    }
>>>>> +}
>>>>> \ No newline at end of file
>>>>>
>>>>> http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/cbb92d
>>>>> 2a/sshd-core/src/main/java/org/apache/sshd/common/util/secur
>>>>> ity/eddsa/OpenSSHEd25519PrivateKeyEntryDecoder.java
>>>>> ----------------------------------------------------------------------
>>>>> diff --git a/sshd-core/src/main/java/org/
>>>>> apache/sshd/common/util/security/eddsa/OpenSSHEd25519PrivateKeyEntryDecoder.java
>>>>> b/sshd-core/src/main/java/org/apache/sshd/common/util/securi
>>>>> ty/eddsa/OpenSSHEd25519PrivateKeyEntryDecoder.java
>>>>> index b05a4cc..e5ae0ac 100644
>>>>> --- a/sshd-core/src/main/java/org/apache/sshd/common/util/securi
>>>>> ty/eddsa/OpenSSHEd25519PrivateKeyEntryDecoder.java
>>>>> +++ b/sshd-core/src/main/java/org/apache/sshd/common/util/securi
>>>>> ty/eddsa/OpenSSHEd25519PrivateKeyEntryDecoder.java
>>>>> @@ -98,7 +98,7 @@ public class OpenSSHEd25519PrivateKeyEntryDecoder
>>>>> extends AbstractPrivateKeyEntr
>>>>>
>>>>>      @Override
>>>>>      public EdDSAPublicKey recoverPublicKey(EdDSAPrivateKey prvKey)
>>>>> throws GeneralSecurityException {
>>>>> -        return EdDSASecurityProvider.recoverEDDSAPublicKey(prvKey);
>>>>> +        return EdDSASecurityProviderUtils.rec
>>>>> overEDDSAPublicKey(prvKey);
>>>>>      }
>>>>>
>>>>>      @Override
>>>>>
>>>>> http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/cbb92d
>>>>> 2a/sshd-core/src/test/java/org/apache/sshd/common/signature/
>>>>> SignaturesDevelopment.java
>>>>> ----------------------------------------------------------------------
>>>>> diff --git a/sshd-core/src/test/java/org/
>>>>> apache/sshd/common/signature/SignaturesDevelopment.java
>>>>> b/sshd-core/src/test/java/org/apache/sshd/common/signature/S
>>>>> ignaturesDevelopment.java
>>>>> index 6c4929a..180e997 100644
>>>>> --- a/sshd-core/src/test/java/org/apache/sshd/common/signature/S
>>>>> ignaturesDevelopment.java
>>>>> +++ b/sshd-core/src/test/java/org/apache/sshd/common/signature/S
>>>>> ignaturesDevelopment.java
>>>>> @@ -25,7 +25,7 @@ import java.security.PublicKey;
>>>>>
>>>>>  import org.apache.sshd.common.util.GenericUtils;
>>>>>  import org.apache.sshd.common.util.buffer.BufferUtils;
>>>>> -import org.apache.sshd.common.util.security.eddsa.EdDSASecurityProv
>>>>> ider;
>>>>> +import org.apache.sshd.common.util.security.eddsa.EdDSASecurityProv
>>>>> iderUtils;
>>>>>  import org.apache.sshd.util.test.BaseTestSupport;
>>>>>
>>>>>  /**
>>>>> @@ -64,9 +64,9 @@ public class SignaturesDevelopment extends
>>>>> BaseTestSupport {
>>>>>          SignatureFactory factory = BuiltinSignatures.resolveFacto
>>>>> ry(args[0]);
>>>>>          // TODO recover public/private keys according to factory name
>>>>>          byte[] publicKey = BufferUtils.decodeHex(':', args[1]);
>>>>> -        PublicKey pubKey = EdDSASecurityProvider.generate
>>>>> EDDSAPublicKey(publicKey);
>>>>> +        PublicKey pubKey = EdDSASecurityProviderUtils.gen
>>>>> erateEDDSAPublicKey(publicKey);
>>>>>          byte[] privateKey = BufferUtils.decodeHex(':', args[2]);
>>>>> -        PrivateKey prvKey = EdDSASecurityProvider.generate
>>>>> EDDSAPrivateKey(privateKey);
>>>>> +        PrivateKey prvKey = EdDSASecurityProviderUtils.gen
>>>>> erateEDDSAPrivateKey(privateKey);
>>>>>          String op = args[3];
>>>>>          byte[] data = BufferUtils.decodeHex(':', args[4]);
>>>>>          byte[] signature = GenericUtils.EMPTY_BYTE_ARRAY;
>>>>>
>>>>> http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/cbb92d
>>>>> 2a/sshd-core/src/test/java/org/apache/sshd/common/util/secur
>>>>> ity/eddsa/Ed25519VectorsTest.java
>>>>> ----------------------------------------------------------------------
>>>>> diff --git a/sshd-core/src/test/java/org/
>>>>> apache/sshd/common/util/security/eddsa/Ed25519VectorsTest.java
>>>>> b/sshd-core/src/test/java/org/apache/sshd/common/util/securi
>>>>> ty/eddsa/Ed25519VectorsTest.java
>>>>> index fab3294..b58aad3 100644
>>>>> --- a/sshd-core/src/test/java/org/apache/sshd/common/util/securi
>>>>> ty/eddsa/Ed25519VectorsTest.java
>>>>> +++ b/sshd-core/src/test/java/org/apache/sshd/common/util/securi
>>>>> ty/eddsa/Ed25519VectorsTest.java
>>>>> @@ -60,9 +60,9 @@ public class Ed25519VectorsTest extends
>>>>> BaseTestSupport {
>>>>>      public Ed25519VectorsTest(String name, String prvKey, String
>>>>> pubKey, String msg, String signature)
>>>>>              throws GeneralSecurityException {
>>>>>          prvBytes = BufferUtils.decodeHex(BufferUtils.EMPTY_HEX_SEPARATOR,
>>>>> prvKey);
>>>>> -        privateKey = EdDSASecurityProvider.generate
>>>>> EDDSAPrivateKey(prvBytes.clone());
>>>>> +        privateKey = EdDSASecurityProviderUtils.gen
>>>>> erateEDDSAPrivateKey(prvBytes.clone());
>>>>>          pubBytes = BufferUtils.decodeHex(BufferUtils.EMPTY_HEX_SEPARATOR,
>>>>> pubKey);
>>>>> -        publicKey = EdDSASecurityProvider.generate
>>>>> EDDSAPublicKey(pubBytes.clone());
>>>>> +        publicKey = EdDSASecurityProviderUtils.gen
>>>>> erateEDDSAPublicKey(pubBytes.clone());
>>>>>          msgBytes = BufferUtils.decodeHex(BufferUtils.EMPTY_HEX_SEPARATOR,
>>>>> msg);
>>>>>          expSignature = BufferUtils.decodeHex(BufferUtils.EMPTY_HEX_SEPARATOR,
>>>>> signature);
>>>>>      }
>>>>> @@ -200,14 +200,14 @@ public class Ed25519VectorsTest extends
>>>>> BaseTestSupport {
>>>>>
>>>>>      @Test
>>>>>      public void testSignature() throws Exception {
>>>>> -        Signature signer = EdDSASecurityProvider.getEDDSASignature();
>>>>> +        Signature signer = EdDSASecurityProviderUtils.get
>>>>> EDDSASignature();
>>>>>          signer.initSigner(privateKey);
>>>>>          signer.update(msgBytes.clone());
>>>>>
>>>>>          byte[] actSignature = signer.sign();
>>>>>          assertArrayEquals("Mismatched signature", expSignature,
>>>>> actSignature);
>>>>>
>>>>> -        Signature verifier = EdDSASecurityProvider.getEDDSA
>>>>> Signature();
>>>>> +        Signature verifier = EdDSASecurityProviderUtils.get
>>>>> EDDSASignature();
>>>>>          verifier.initVerifier(publicKey);
>>>>>          verifier.update(msgBytes.clone());
>>>>>          assertTrue("Verification failed",
>>>>> verifier.verify(expSignature));
>>>>> @@ -222,14 +222,14 @@ public class Ed25519VectorsTest extends
>>>>> BaseTestSupport {
>>>>>          System.arraycopy(msgBytes, 0, dataBuf, offset,
>>>>> msgBytes.length);
>>>>>          System.arraycopy(extraData, offset, dataBuf, offset +
>>>>> msgBytes.length, extraData.length - offset);
>>>>>
>>>>> -        Signature signer = EdDSASecurityProvider.getEDDSASignature();
>>>>> +        Signature signer = EdDSASecurityProviderUtils.get
>>>>> EDDSASignature();
>>>>>          signer.initSigner(privateKey);
>>>>>          signer.update(dataBuf.clone(), offset, msgBytes.length);
>>>>>
>>>>>          byte[] actSignature = signer.sign();
>>>>>          assertArrayEquals("Mismatched signature", expSignature,
>>>>> actSignature);
>>>>>
>>>>> -        Signature verifier = EdDSASecurityProvider.getEDDSA
>>>>> Signature();
>>>>> +        Signature verifier = EdDSASecurityProviderUtils.get
>>>>> EDDSASignature();
>>>>>          verifier.initVerifier(publicKey);
>>>>>          verifier.update(dataBuf.clone(), offset, msgBytes.length);
>>>>>          assertTrue("Verification failed",
>>>>> verifier.verify(expSignature));
>>>>>
>>>>> http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/cbb92d
>>>>> 2a/sshd-core/src/test/java/org/apache/sshd/common/util/secur
>>>>> ity/eddsa/EdDSASecurityProviderRegistrarTest.java
>>>>> ----------------------------------------------------------------------
>>>>> diff --git a/sshd-core/src/test/java/org/
>>>>> apache/sshd/common/util/security/eddsa/EdDSASecurityProviderRegistrarTest.java
>>>>> b/sshd-core/src/test/java/org/apache/sshd/common/util/securi
>>>>> ty/eddsa/EdDSASecurityProviderRegistrarTest.java
>>>>> index 9e12fab..f2c1f3f 100644
>>>>> --- a/sshd-core/src/test/java/org/apache/sshd/common/util/securi
>>>>> ty/eddsa/EdDSASecurityProviderRegistrarTest.java
>>>>> +++ b/sshd-core/src/test/java/org/apache/sshd/common/util/securi
>>>>> ty/eddsa/EdDSASecurityProviderRegistrarTest.java
>>>>> @@ -26,6 +26,8 @@ import java.util.Arrays;
>>>>>  import java.util.Collection;
>>>>>  import java.util.HashSet;
>>>>>
>>>>> +import net.i2p.crypto.eddsa.EdDSASecurityProvider;
>>>>> +
>>>>>  import org.apache.sshd.common.util.security.SecurityProviderRegistr
>>>>> ar;
>>>>>  import org.apache.sshd.common.util.security.SecurityProviderRegistr
>>>>> arTestSupport;
>>>>>  import org.apache.sshd.common.util.security.SecurityUtils;
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> ------------------------
>>>> Guillaume Nodet
>>>>
>>>>
>>
>>
>> --
>> ------------------------
>> Guillaume Nodet
>>
>>
>


-- 
------------------------
Guillaume Nodet

Re: [1/2] mina-sshd git commit: [SSHD-727] Upgrade used EdDSA artifact version to 1.1

Posted by Guillaume Nodet <gn...@apache.org>.
Can you remove it from your local repository and try again ?
It's definitely not in maven central:
  https://repo1.maven.org/maven2/net/i2p/crypto/eddsa/

2017-03-10 9:01 GMT+01:00 Lyor Goldstein <ly...@gmail.com>:

> The version is 0.1.1 - I had no problem when I did the upgrade - no
> special repository needed
>
> בתאריך 10 במרץ 2017 09:58,‏ "Guillaume Nodet" <gn...@apache.org> כתב:
>
> I can't find this artifact in maven central.
>> Could you add the needed repository please ?
>>
>> 2017-03-02 21:00 GMT+01:00 <lg...@apache.org>:
>>
>>> Repository: mina-sshd
>>> Updated Branches:
>>>   refs/heads/master 8e255459a -> cbb92d2a8
>>>
>>>
>>> [SSHD-727] Upgrade used EdDSA artifact version to 1.1
>>>
>>>
>>> Project: http://git-wip-us.apache.org/repos/asf/mina-sshd/repo
>>> Commit: http://git-wip-us.apache.org/repos/asf/mina-sshd/commit/cbb92d2a
>>> Tree: http://git-wip-us.apache.org/repos/asf/mina-sshd/tree/cbb92d2a
>>> Diff: http://git-wip-us.apache.org/repos/asf/mina-sshd/diff/cbb92d2a
>>>
>>> Branch: refs/heads/master
>>> Commit: cbb92d2a89600ee8a34abdf7d84cdc08291dcbf5
>>> Parents: 22dc7c3
>>> Author: Lyor Goldstein <ly...@gmail.com>
>>> Authored: Thu Mar 2 21:47:51 2017 +0200
>>> Committer: Lyor Goldstein <ly...@gmail.com>
>>> Committed: Thu Mar 2 22:01:14 2017 +0200
>>>
>>> ----------------------------------------------------------------------
>>>  pom.xml                                         |   6 +-
>>>  .../common/util/security/SecurityUtils.java     |  31 +--
>>>  .../security/eddsa/EdDSASecurityProvider.java   | 205
>>> -------------------
>>>  .../eddsa/EdDSASecurityProviderRegistrar.java   |   2 +-
>>>  .../eddsa/EdDSASecurityProviderUtils.java       | 197
>>> ++++++++++++++++++
>>>  .../OpenSSHEd25519PrivateKeyEntryDecoder.java   |   2 +-
>>>  .../common/signature/SignaturesDevelopment.java |   6 +-
>>>  .../util/security/eddsa/Ed25519VectorsTest.java |  12 +-
>>>  .../EdDSASecurityProviderRegistrarTest.java     |   2 +
>>>  9 files changed, 229 insertions(+), 234 deletions(-)
>>> ----------------------------------------------------------------------
>>>
>>>
>>> http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/cbb92d2a/pom.xml
>>> ----------------------------------------------------------------------
>>> diff --git a/pom.xml b/pom.xml
>>> index 806f7fb..06ec711 100644
>>> --- a/pom.xml
>>> +++ b/pom.xml
>>> @@ -104,7 +104,7 @@
>>>          <gmaven.plugin.version>2.0</gmaven.plugin.version>
>>>          <groovy.major.version>2</groovy.major.version>
>>>          <groovy.minor.version>4</groovy.minor.version>
>>> -        <groovy.release.version>8</groovy.release.version>
>>> +        <groovy.release.version>9</groovy.release.version>
>>>          <groovy.compliance.level>2.0</groovy.compliance.level>
>>>          <groovy.version>${groovy.major.version}.${groovy.minor.vers
>>> ion}.${groovy.release.version}</groovy.version>
>>>
>>> @@ -202,7 +202,7 @@
>>>              <dependency>
>>>                  <groupId>net.i2p.crypto</groupId>
>>>                  <artifactId>eddsa</artifactId>
>>> -                <version>0.1.0</version>
>>> +                <version>0.1.1</version>
>>>              </dependency>
>>>
>>>              <dependency>
>>> @@ -594,7 +594,7 @@
>>>                          <dependency>
>>>                              <groupId>com.puppycrawl.tools</groupId>
>>>                              <artifactId>checkstyle</artifactId>
>>> -                            <version>7.5.1</version>
>>> +                            <version>7.6</version>
>>>                              <exclusions>
>>>                                  <!-- MCHECKSTYLE-156 -->
>>>                                  <exclusion>
>>>
>>> http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/cbb92d
>>> 2a/sshd-core/src/main/java/org/apache/sshd/common/util/secur
>>> ity/SecurityUtils.java
>>> ----------------------------------------------------------------------
>>> diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/security/SecurityUtils.java
>>> b/sshd-core/src/main/java/org/apache/sshd/common/util/securi
>>> ty/SecurityUtils.java
>>> index 6aff088..b86bcc3 100644
>>> --- a/sshd-core/src/main/java/org/apache/sshd/common/util/securi
>>> ty/SecurityUtils.java
>>> +++ b/sshd-core/src/main/java/org/apache/sshd/common/util/securi
>>> ty/SecurityUtils.java
>>> @@ -73,7 +73,7 @@ import org.apache.sshd.common.util.buffer.Buffer;
>>>  import org.apache.sshd.common.util.security.bouncycastle.BouncyCast
>>> leGeneratorHostKeyProvider;
>>>  import org.apache.sshd.common.util.security.bouncycastle.BouncyCast
>>> leKeyPairResourceParser;
>>>  import org.apache.sshd.common.util.security.bouncycastle.BouncyCast
>>> leRandomFactory;
>>> -import org.apache.sshd.common.util.security.eddsa.EdDSASecurityProv
>>> ider;
>>> +import org.apache.sshd.common.util.security.eddsa.EdDSASecurityProv
>>> iderUtils;
>>>  import org.apache.sshd.common.util.threads.ThreadUtils;
>>>  import org.apache.sshd.server.keyprovider.AbstractGeneratorHostKeyP
>>> rovider;
>>>  import org.slf4j.Logger;
>>> @@ -91,12 +91,13 @@ public final class SecurityUtils {
>>>      public static final String BOUNCY_CASTLE = "BC";
>>>
>>>      /**
>>> -     * EDDSA support
>>> +     * EDDSA support - should match {@code EdDSAKey.KEY_ALGORITHM}
>>>       */
>>>      public static final String EDDSA = "EdDSA";
>>>
>>>      // A copy-paste from the original, but we don't want to drag the
>>> classes into the classpath
>>> -    public static final String CURVE_ED25519_SHA512 = "ed25519-sha-512";
>>> +    // See EdDSANamedCurveTable.CURVE_ED25519_SHA512
>>> +    public static final String CURVE_ED25519_SHA512 =
>>> "SHA512withEd25519";
>>>
>>>      /**
>>>       * System property used to configure the value for the maximum
>>> supported Diffie-Hellman
>>> @@ -538,7 +539,7 @@ public final class SecurityUtils {
>>>              throw new UnsupportedOperationException(EDDSA + " provider
>>> N/A");
>>>          }
>>>
>>> -        return EdDSASecurityProvider.getEDDSAPublicKeyEntryDecoder();
>>> +        return EdDSASecurityProviderUtils.get
>>> EDDSAPublicKeyEntryDecoder();
>>>      }
>>>
>>>      public static PrivateKeyEntryDecoder<? extends PublicKey, ? extends
>>> PrivateKey> getOpenSSHEDDSAPrivateKeyEntryDecoder() {
>>> @@ -546,35 +547,35 @@ public final class SecurityUtils {
>>>              throw new UnsupportedOperationException(EDDSA + " provider
>>> N/A");
>>>          }
>>>
>>> -        return EdDSASecurityProvider.getOpenS
>>> SHEDDSAPrivateKeyEntryDecoder();
>>> +        return EdDSASecurityProviderUtils.get
>>> OpenSSHEDDSAPrivateKeyEntryDecoder();
>>>      }
>>>
>>>      public static org.apache.sshd.common.signature.Signature
>>> getEDDSASigner() {
>>>          if (isEDDSACurveSupported()) {
>>> -            return EdDSASecurityProvider.getEDDSASignature();
>>> +            return EdDSASecurityProviderUtils.getEDDSASignature();
>>>          }
>>>
>>>          throw new UnsupportedOperationException(EDDSA + " Signer not
>>> available");
>>>      }
>>>
>>>      public static int getEDDSAKeySize(Key key) {
>>> -        return EdDSASecurityProvider.getEDDSAKeySize(key);
>>> +        return EdDSASecurityProviderUtils.getEDDSAKeySize(key);
>>>      }
>>>
>>>      public static Class<? extends PublicKey> getEDDSAPublicKeyType() {
>>> -        return isEDDSACurveSupported() ? EdDSASecurityProvider.getEDDSAPublicKeyType()
>>> : PublicKey.class;
>>> +        return isEDDSACurveSupported() ? EdDSASecurityProviderUtils.getEDDSAPublicKeyType()
>>> : PublicKey.class;
>>>      }
>>>
>>>      public static Class<? extends PrivateKey> getEDDSAPrivateKeyType() {
>>> -        return isEDDSACurveSupported() ? EdDSASecurityProvider.getEDDSAPrivateKeyType()
>>> : PrivateKey.class;
>>> +        return isEDDSACurveSupported() ? EdDSASecurityProviderUtils.getEDDSAPrivateKeyType()
>>> : PrivateKey.class;
>>>      }
>>>
>>>      public static boolean compareEDDSAPPublicKeys(PublicKey k1,
>>> PublicKey k2) {
>>> -        return isEDDSACurveSupported() ? EdDSASecurityProvider.compareEDDSAPPublicKeys(k1,
>>> k2) : false;
>>> +        return isEDDSACurveSupported() ? EdDSASecurityProviderUtils.compareEDDSAPPublicKeys(k1,
>>> k2) : false;
>>>      }
>>>
>>>      public static boolean compareEDDSAPrivateKeys(PrivateKey k1,
>>> PrivateKey k2) {
>>> -        return isEDDSACurveSupported() ? EdDSASecurityProvider.compareEDDSAPrivateKeys(k1,
>>> k2) : false;
>>> +        return isEDDSACurveSupported() ? EdDSASecurityProviderUtils.compareEDDSAPrivateKeys(k1,
>>> k2) : false;
>>>      }
>>>
>>>      public static PublicKey recoverEDDSAPublicKey(PrivateKey key)
>>> throws GeneralSecurityException {
>>> @@ -582,7 +583,7 @@ public final class SecurityUtils {
>>>              throw new NoSuchAlgorithmException(EDDSA + " provider not
>>> supported");
>>>          }
>>>
>>> -        return EdDSASecurityProvider.recoverEDDSAPublicKey(key);
>>> +        return EdDSASecurityProviderUtils.recoverEDDSAPublicKey(key);
>>>      }
>>>
>>>      public static PublicKey generateEDDSAPublicKey(String keyType,
>>> byte[] seed) throws GeneralSecurityException {
>>> @@ -594,7 +595,7 @@ public final class SecurityUtils {
>>>              throw new NoSuchAlgorithmException(EDDSA + " provider not
>>> supported");
>>>          }
>>>
>>> -        return EdDSASecurityProvider.generateEDDSAPublicKey(seed);
>>> +        return EdDSASecurityProviderUtils.generateEDDSAPublicKey(seed);
>>>      }
>>>
>>>      public static <B extends Buffer> B putRawEDDSAPublicKey(B buffer,
>>> PublicKey key) {
>>> @@ -602,7 +603,7 @@ public final class SecurityUtils {
>>>              throw new UnsupportedOperationException(EDDSA + " provider
>>> not supported");
>>>          }
>>>
>>> -        return EdDSASecurityProvider.putRawEDDSAPublicKey(buffer, key);
>>> +        return EdDSASecurityProviderUtils.putRawEDDSAPublicKey(buffer,
>>> key);
>>>      }
>>>
>>>      public static <B extends Buffer> B putEDDSAKeyPair(B buffer,
>>> KeyPair kp) {
>>> @@ -614,7 +615,7 @@ public final class SecurityUtils {
>>>              throw new UnsupportedOperationException(EDDSA + " provider
>>> not supported");
>>>          }
>>>
>>> -        return EdDSASecurityProvider.putEDDSAKeyPair(buffer, pubKey,
>>> prvKey);
>>> +        return EdDSASecurityProviderUtils.putEDDSAKeyPair(buffer,
>>> pubKey, prvKey);
>>>      }
>>>
>>>      public static KeyPair extractEDDSAKeyPair(Buffer buffer, String
>>> keyType) throws GeneralSecurityException {
>>>
>>> http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/cbb92d
>>> 2a/sshd-core/src/main/java/org/apache/sshd/common/util/secur
>>> ity/eddsa/EdDSASecurityProvider.java
>>> ----------------------------------------------------------------------
>>> diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/securi
>>> ty/eddsa/EdDSASecurityProvider.java b/sshd-core/src/main/java/org/
>>> apache/sshd/common/util/security/eddsa/EdDSASecurityProvider.java
>>> deleted file mode 100644
>>> index e039547..0000000
>>> --- a/sshd-core/src/main/java/org/apache/sshd/common/util/securi
>>> ty/eddsa/EdDSASecurityProvider.java
>>> +++ /dev/null
>>> @@ -1,205 +0,0 @@
>>> -/*
>>> - * Licensed to the Apache Software Foundation (ASF) under one
>>> - * or more contributor license agreements. See the NOTICE file
>>> - * distributed with this work for additional information
>>> - * regarding copyright ownership. The ASF licenses this file
>>> - * to you under the Apache License, Version 2.0 (the
>>> - * "License"); you may not use this file except in compliance
>>> - * with the License. You may obtain a copy of the License at
>>> - *
>>> - * http://www.apache.org/licenses/LICENSE-2.0
>>> - *
>>> - * Unless required by applicable law or agreed to in writing,
>>> - * software distributed under the License is distributed on an
>>> - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>>> - * KIND, either express or implied. See the License for the
>>> - * specific language governing permissions and limitations
>>> - * under the License.
>>> - */
>>> -package org.apache.sshd.common.util.security.eddsa;
>>> -
>>> -import java.security.GeneralSecurityException;
>>> -import java.security.InvalidKeyException;
>>> -import java.security.Key;
>>> -import java.security.KeyFactory;
>>> -import java.security.NoSuchAlgorithmException;
>>> -import java.security.PrivateKey;
>>> -import java.security.Provider;
>>> -import java.security.PublicKey;
>>> -import java.util.Arrays;
>>> -import java.util.Objects;
>>> -
>>> -import net.i2p.crypto.eddsa.EdDSAKey;
>>> -import net.i2p.crypto.eddsa.EdDSAPrivateKey;
>>> -import net.i2p.crypto.eddsa.EdDSAPublicKey;
>>> -import net.i2p.crypto.eddsa.spec.EdDSANamedCurveTable;
>>> -import net.i2p.crypto.eddsa.spec.EdDSAParameterSpec;
>>> -import net.i2p.crypto.eddsa.spec.EdDSAPrivateKeySpec;
>>> -import net.i2p.crypto.eddsa.spec.EdDSAPublicKeySpec;
>>> -
>>> -import org.apache.sshd.common.config.keys.PrivateKeyEntryDecoder;
>>> -import org.apache.sshd.common.config.keys.PublicKeyEntryDecoder;
>>> -import org.apache.sshd.common.keyprovider.KeyPairProvider;
>>> -import org.apache.sshd.common.util.ValidateUtils;
>>> -import org.apache.sshd.common.util.buffer.Buffer;
>>> -import org.apache.sshd.common.util.security.SecurityUtils;
>>> -
>>> -/**
>>> - * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD
>>> Project</a>
>>> - */
>>> -public class EdDSASecurityProvider extends Provider {
>>> -    private static final long serialVersionUID = -6183277432144104981L;
>>> -
>>> -    public EdDSASecurityProvider() {
>>> -        super(SecurityUtils.EDDSA, 0.1, "net.i2p security provider
>>> wrapper");
>>> -
>>> -        // see https://docs.oracle.com/javase
>>> /8/docs/technotes/guides/security/crypto/HowToImplAProvider.html
>>> -        put("KeyPairGenerator." + SecurityUtils.EDDSA,
>>> "net.i2p.crypto.eddsa.KeyPairGenerator");
>>> -        put("KeyFactory." + SecurityUtils.EDDSA,
>>> "net.i2p.crypto.eddsa.KeyFactory");
>>> -        put("Signature." + EdDSANamedCurveTable.CURVE_ED25519_SHA512,
>>> "net.i2p.crypto.eddsa.EdDSAEngine");
>>> -    }
>>> -
>>> -    public static Class<? extends PublicKey> getEDDSAPublicKeyType() {
>>> -        return EdDSAPublicKey.class;
>>> -    }
>>> -
>>> -    public static Class<? extends PrivateKey> getEDDSAPrivateKeyType() {
>>> -        return EdDSAPrivateKey.class;
>>> -    }
>>> -
>>> -    public static int getEDDSAKeySize(Key key) {
>>> -        return (SecurityUtils.isEDDSACurveSupported() && (key
>>> instanceof EdDSAKey)) ? 256 : -1;
>>> -    }
>>> -
>>> -    public static boolean compareEDDSAPPublicKeys(PublicKey k1,
>>> PublicKey k2) {
>>> -        if (!SecurityUtils.isEDDSACurveSupported()) {
>>> -            return false;
>>> -        }
>>> -
>>> -        if ((k1 instanceof EdDSAPublicKey) && (k2 instanceof
>>> EdDSAPublicKey)) {
>>> -            if (Objects.equals(k1, k2)) {
>>> -                return true;
>>> -            } else if (k1 == null || k2 == null) {
>>> -                return false;   // both null is covered by
>>> Objects#equals
>>> -            }
>>> -
>>> -            EdDSAPublicKey ed1 = (EdDSAPublicKey) k1;
>>> -            EdDSAPublicKey ed2 = (EdDSAPublicKey) k2;
>>> -            return Arrays.equals(ed1.getAbyte(), ed2.getAbyte())
>>> -                && compareEDDSAKeyParams(ed1.getParams(),
>>> ed2.getParams());
>>> -        }
>>> -
>>> -        return false;
>>> -    }
>>> -
>>> -    public static boolean isEDDSASignatureAlgorithm(String algorithm) {
>>> -        return EdDSANamedCurveTable.CURVE_ED2
>>> 5519_SHA512.equalsIgnoreCase(algorithm);
>>> -    }
>>> -
>>> -    public static EdDSAPublicKey recoverEDDSAPublicKey(PrivateKey key)
>>> throws GeneralSecurityException {
>>> -        ValidateUtils.checkTrue(SecurityUtils.isEDDSACurveSupported(),
>>> SecurityUtils.EDDSA + " not supported");
>>> -        if (!(key instanceof EdDSAPrivateKey)) {
>>> -            throw new InvalidKeyException("Private key is not " +
>>> SecurityUtils.EDDSA);
>>> -        }
>>> -
>>> -        EdDSAPrivateKey prvKey = (EdDSAPrivateKey) key;
>>> -        EdDSAPublicKeySpec keySpec = new EdDSAPublicKeySpec(prvKey.getSeed(),
>>> prvKey.getParams());
>>> -        KeyFactory factory = SecurityUtils.getKeyFactory(Se
>>> curityUtils.EDDSA);
>>> -        return EdDSAPublicKey.class.cast(fact
>>> ory.generatePublic(keySpec));
>>> -    }
>>> -
>>> -    public static org.apache.sshd.common.signature.Signature
>>> getEDDSASignature() {
>>> -        ValidateUtils.checkTrue(SecurityUtils.isEDDSACurveSupported(),
>>> SecurityUtils.EDDSA + " not supported");
>>> -        return new SignatureEd25519();
>>> -    }
>>> -
>>> -    public static boolean isEDDSAKeyFactoryAlgorithm(String algorithm)
>>> {
>>> -        return SecurityUtils.EDDSA.equalsIgnoreCase(algorithm);
>>> -    }
>>> -
>>> -    public static boolean isEDDSAKeyPairGeneratorAlgorithm(String
>>> algorithm) {
>>> -        return SecurityUtils.EDDSA.equalsIgnoreCase(algorithm);
>>> -    }
>>> -
>>> -    public static PublicKeyEntryDecoder<? extends PublicKey, ? extends
>>> PrivateKey> getEDDSAPublicKeyEntryDecoder() {
>>> -        ValidateUtils.checkTrue(SecurityUtils.isEDDSACurveSupported(),
>>> SecurityUtils.EDDSA + " not supported");
>>> -        return Ed25519PublicKeyDecoder.INSTANCE;
>>> -    }
>>> -
>>> -    public static PrivateKeyEntryDecoder<? extends PublicKey, ? extends
>>> PrivateKey> getOpenSSHEDDSAPrivateKeyEntryDecoder() {
>>> -        ValidateUtils.checkTrue(SecurityUtils.isEDDSACurveSupported(),
>>> SecurityUtils.EDDSA + " not supported");
>>> -        return OpenSSHEd25519PrivateKeyEntryDecoder.INSTANCE;
>>> -    }
>>> -
>>> -    public static boolean compareEDDSAPrivateKeys(PrivateKey k1,
>>> PrivateKey k2) {
>>> -        if (!SecurityUtils.isEDDSACurveSupported()) {
>>> -            return false;
>>> -        }
>>> -
>>> -        if ((k1 instanceof EdDSAPrivateKey) && (k2 instanceof
>>> EdDSAPrivateKey)) {
>>> -            if (Objects.equals(k1, k2)) {
>>> -                return true;
>>> -            } else if (k1 == null || k2 == null) {
>>> -                return false;   // both null is covered by
>>> Objects#equals
>>> -            }
>>> -
>>> -            EdDSAPrivateKey ed1 = (EdDSAPrivateKey) k1;
>>> -            EdDSAPrivateKey ed2 = (EdDSAPrivateKey) k2;
>>> -            return Arrays.equals(ed1.getSeed(), ed2.getSeed())
>>> -                && compareEDDSAKeyParams(ed1.getParams(),
>>> ed2.getParams());
>>> -        }
>>> -
>>> -        return false;
>>> -    }
>>> -
>>> -    public static boolean compareEDDSAKeyParams(EdDSAParameterSpec s1,
>>> EdDSAParameterSpec s2) {
>>> -        if (Objects.equals(s1, s2)) {
>>> -            return true;
>>> -        } else if (s1 == null || s2 == null) {
>>> -            return false;   // both null is covered by Objects#equals
>>> -        } else {
>>> -            return Objects.equals(s1.getHashAlgorithm(),
>>> s2.getHashAlgorithm())
>>> -                && Objects.equals(s1.getCurve(), s2.getCurve())
>>> -                && Objects.equals(s1.getB(), s2.getB());
>>> -        }
>>> -    }
>>> -
>>> -    public static PublicKey generateEDDSAPublicKey(byte[] seed) throws
>>> GeneralSecurityException {
>>> -        if (!SecurityUtils.isEDDSACurveSupported()) {
>>> -            throw new NoSuchAlgorithmException(SecurityUtils.EDDSA + "
>>> not supported");
>>> -        }
>>> -
>>> -        EdDSAParameterSpec params = EdDSANamedCurveTable.getByName
>>> (EdDSANamedCurveTable.CURVE_ED25519_SHA512);
>>> -        EdDSAPublicKeySpec keySpec = new EdDSAPublicKeySpec(seed,
>>> params);
>>> -        KeyFactory factory = SecurityUtils.getKeyFactory(Se
>>> curityUtils.EDDSA);
>>> -        return factory.generatePublic(keySpec);
>>> -    }
>>> -
>>> -    public static PrivateKey generateEDDSAPrivateKey(byte[] seed)
>>> throws GeneralSecurityException {
>>> -        if (!SecurityUtils.isEDDSACurveSupported()) {
>>> -            throw new NoSuchAlgorithmException(SecurityUtils.EDDSA + "
>>> not supported");
>>> -        }
>>> -
>>> -        EdDSAParameterSpec params = EdDSANamedCurveTable.getByName
>>> (EdDSANamedCurveTable.CURVE_ED25519_SHA512);
>>> -        EdDSAPrivateKeySpec keySpec = new EdDSAPrivateKeySpec(seed,
>>> params);
>>> -        KeyFactory factory = SecurityUtils.getKeyFactory(Se
>>> curityUtils.EDDSA);
>>> -        return factory.generatePrivate(keySpec);
>>> -    }
>>> -
>>> -    public static <B extends Buffer> B putRawEDDSAPublicKey(B buffer,
>>> PublicKey key) {
>>> -        ValidateUtils.checkTrue(SecurityUtils.isEDDSACurveSupported(),
>>> SecurityUtils.EDDSA + " not supported");
>>> -        EdDSAPublicKey edKey = ValidateUtils.checkInstanceOf(key,
>>> EdDSAPublicKey.class, "Not an EDDSA public key: %s", key);
>>> -        byte[] seed = Ed25519PublicKeyDecoder.getSeedValue(edKey);
>>> -        ValidateUtils.checkNotNull(seed, "No seed extracted from key:
>>> %s", edKey.getA());
>>> -        buffer.putString(KeyPairProvider.SSH_ED25519);
>>> -        buffer.putBytes(seed);
>>> -        return buffer;
>>> -    }
>>> -
>>> -    public static <B extends Buffer> B putEDDSAKeyPair(B buffer,
>>> PublicKey pubKey, PrivateKey prvKey) {
>>> -        ValidateUtils.checkTrue(SecurityUtils.isEDDSACurveSupported(),
>>> SecurityUtils.EDDSA + " not supported");
>>> -        ValidateUtils.checkInstanceOf(pubKey, EdDSAPublicKey.class,
>>> "Not an EDDSA public key: %s", pubKey);
>>> -        ValidateUtils.checkInstanceOf(prvKey, EdDSAPrivateKey.class,
>>> "Not an EDDSA private key: %s", prvKey);
>>> -        throw new UnsupportedOperationException("Full SSHD-440
>>> implementation N/A");
>>> -    }
>>> -}
>>> \ No newline at end of file
>>>
>>> http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/cbb92d
>>> 2a/sshd-core/src/main/java/org/apache/sshd/common/util/secur
>>> ity/eddsa/EdDSASecurityProviderRegistrar.java
>>> ----------------------------------------------------------------------
>>> diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/securi
>>> ty/eddsa/EdDSASecurityProviderRegistrar.java
>>> b/sshd-core/src/main/java/org/apache/sshd/common/util/securi
>>> ty/eddsa/EdDSASecurityProviderRegistrar.java
>>> index b463d27..2bb3f95 100644
>>> --- a/sshd-core/src/main/java/org/apache/sshd/common/util/securi
>>> ty/eddsa/EdDSASecurityProviderRegistrar.java
>>> +++ b/sshd-core/src/main/java/org/apache/sshd/common/util/securi
>>> ty/eddsa/EdDSASecurityProviderRegistrar.java
>>> @@ -36,7 +36,7 @@ import org.apache.sshd.common.util.th
>>> reads.ThreadUtils;
>>>   * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD
>>> Project</a>
>>>   */
>>>  public class EdDSASecurityProviderRegistrar extends
>>> AbstractSecurityProviderRegistrar {
>>> -    public static final String PROVIDER_CLASS =
>>> "org.apache.sshd.common.util.security.eddsa.EdDSASecurityProvider";
>>> +    public static final String PROVIDER_CLASS =
>>> "net.i2p.crypto.eddsa.EdDSASecurityProvider";
>>>      // Do not define a static registrar instance to minimize class
>>> loading issues
>>>      private final AtomicReference<Boolean> supportHolder = new
>>> AtomicReference<>(null);
>>>
>>>
>>> http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/cbb92d
>>> 2a/sshd-core/src/main/java/org/apache/sshd/common/util/secur
>>> ity/eddsa/EdDSASecurityProviderUtils.java
>>> ----------------------------------------------------------------------
>>> diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/securi
>>> ty/eddsa/EdDSASecurityProviderUtils.java b/sshd-core/src/main/java/org/
>>> apache/sshd/common/util/security/eddsa/EdDSASecurityProviderUtils.java
>>> new file mode 100644
>>> index 0000000..b5d79f0
>>> --- /dev/null
>>> +++ b/sshd-core/src/main/java/org/apache/sshd/common/util/securi
>>> ty/eddsa/EdDSASecurityProviderUtils.java
>>> @@ -0,0 +1,197 @@
>>> +/*
>>> + * Licensed to the Apache Software Foundation (ASF) under one
>>> + * or more contributor license agreements. See the NOTICE file
>>> + * distributed with this work for additional information
>>> + * regarding copyright ownership. The ASF licenses this file
>>> + * to you under the Apache License, Version 2.0 (the
>>> + * "License"); you may not use this file except in compliance
>>> + * with the License. You may obtain a copy of the License at
>>> + *
>>> + * http://www.apache.org/licenses/LICENSE-2.0
>>> + *
>>> + * Unless required by applicable law or agreed to in writing,
>>> + * software distributed under the License is distributed on an
>>> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>>> + * KIND, either express or implied. See the License for the
>>> + * specific language governing permissions and limitations
>>> + * under the License.
>>> + */
>>> +package org.apache.sshd.common.util.security.eddsa;
>>> +
>>> +import java.security.GeneralSecurityException;
>>> +import java.security.InvalidKeyException;
>>> +import java.security.Key;
>>> +import java.security.KeyFactory;
>>> +import java.security.NoSuchAlgorithmException;
>>> +import java.security.PrivateKey;
>>> +import java.security.PublicKey;
>>> +import java.util.Arrays;
>>> +import java.util.Objects;
>>> +
>>> +import net.i2p.crypto.eddsa.EdDSAKey;
>>> +import net.i2p.crypto.eddsa.EdDSAPrivateKey;
>>> +import net.i2p.crypto.eddsa.EdDSAPublicKey;
>>> +import net.i2p.crypto.eddsa.spec.EdDSANamedCurveTable;
>>> +import net.i2p.crypto.eddsa.spec.EdDSAParameterSpec;
>>> +import net.i2p.crypto.eddsa.spec.EdDSAPrivateKeySpec;
>>> +import net.i2p.crypto.eddsa.spec.EdDSAPublicKeySpec;
>>> +
>>> +import org.apache.sshd.common.config.keys.PrivateKeyEntryDecoder;
>>> +import org.apache.sshd.common.config.keys.PublicKeyEntryDecoder;
>>> +import org.apache.sshd.common.keyprovider.KeyPairProvider;
>>> +import org.apache.sshd.common.util.ValidateUtils;
>>> +import org.apache.sshd.common.util.buffer.Buffer;
>>> +import org.apache.sshd.common.util.security.SecurityUtils;
>>> +
>>> +/**
>>> + * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD
>>> Project</a>
>>> + */
>>> +public final class EdDSASecurityProviderUtils {
>>> +    private EdDSASecurityProviderUtils() {
>>> +        throw new UnsupportedOperationException("No instance");
>>> +    }
>>> +
>>> +    public static Class<? extends PublicKey> getEDDSAPublicKeyType() {
>>> +        return EdDSAPublicKey.class;
>>> +    }
>>> +
>>> +    public static Class<? extends PrivateKey> getEDDSAPrivateKeyType() {
>>> +        return EdDSAPrivateKey.class;
>>> +    }
>>> +
>>> +    public static int getEDDSAKeySize(Key key) {
>>> +        return (SecurityUtils.isEDDSACurveSupported() && (key
>>> instanceof EdDSAKey)) ? 256 : -1;
>>> +    }
>>> +
>>> +    public static boolean compareEDDSAPPublicKeys(PublicKey k1,
>>> PublicKey k2) {
>>> +        if (!SecurityUtils.isEDDSACurveSupported()) {
>>> +            return false;
>>> +        }
>>> +
>>> +        if ((k1 instanceof EdDSAPublicKey) && (k2 instanceof
>>> EdDSAPublicKey)) {
>>> +            if (Objects.equals(k1, k2)) {
>>> +                return true;
>>> +            } else if (k1 == null || k2 == null) {
>>> +                return false;   // both null is covered by
>>> Objects#equals
>>> +            }
>>> +
>>> +            EdDSAPublicKey ed1 = (EdDSAPublicKey) k1;
>>> +            EdDSAPublicKey ed2 = (EdDSAPublicKey) k2;
>>> +            return Arrays.equals(ed1.getAbyte(), ed2.getAbyte())
>>> +                && compareEDDSAKeyParams(ed1.getParams(),
>>> ed2.getParams());
>>> +        }
>>> +
>>> +        return false;
>>> +    }
>>> +
>>> +    public static boolean isEDDSASignatureAlgorithm(String algorithm) {
>>> +        return EdDSANamedCurveTable.CURVE_ED2
>>> 5519_SHA512.equalsIgnoreCase(algorithm);
>>> +    }
>>> +
>>> +    public static EdDSAPublicKey recoverEDDSAPublicKey(PrivateKey key)
>>> throws GeneralSecurityException {
>>> +        ValidateUtils.checkTrue(SecurityUtils.isEDDSACurveSupported(),
>>> SecurityUtils.EDDSA + " not supported");
>>> +        if (!(key instanceof EdDSAPrivateKey)) {
>>> +            throw new InvalidKeyException("Private key is not " +
>>> SecurityUtils.EDDSA);
>>> +        }
>>> +
>>> +        EdDSAPrivateKey prvKey = (EdDSAPrivateKey) key;
>>> +        EdDSAPublicKeySpec keySpec = new EdDSAPublicKeySpec(prvKey.getSeed(),
>>> prvKey.getParams());
>>> +        KeyFactory factory = SecurityUtils.getKeyFactory(Se
>>> curityUtils.EDDSA);
>>> +        return EdDSAPublicKey.class.cast(fact
>>> ory.generatePublic(keySpec));
>>> +    }
>>> +
>>> +    public static org.apache.sshd.common.signature.Signature
>>> getEDDSASignature() {
>>> +        ValidateUtils.checkTrue(SecurityUtils.isEDDSACurveSupported(),
>>> SecurityUtils.EDDSA + " not supported");
>>> +        return new SignatureEd25519();
>>> +    }
>>> +
>>> +    public static boolean isEDDSAKeyFactoryAlgorithm(String algorithm)
>>> {
>>> +        return SecurityUtils.EDDSA.equalsIgnoreCase(algorithm);
>>> +    }
>>> +
>>> +    public static boolean isEDDSAKeyPairGeneratorAlgorithm(String
>>> algorithm) {
>>> +        return SecurityUtils.EDDSA.equalsIgnoreCase(algorithm);
>>> +    }
>>> +
>>> +    public static PublicKeyEntryDecoder<? extends PublicKey, ? extends
>>> PrivateKey> getEDDSAPublicKeyEntryDecoder() {
>>> +        ValidateUtils.checkTrue(SecurityUtils.isEDDSACurveSupported(),
>>> SecurityUtils.EDDSA + " not supported");
>>> +        return Ed25519PublicKeyDecoder.INSTANCE;
>>> +    }
>>> +
>>> +    public static PrivateKeyEntryDecoder<? extends PublicKey, ? extends
>>> PrivateKey> getOpenSSHEDDSAPrivateKeyEntryDecoder() {
>>> +        ValidateUtils.checkTrue(SecurityUtils.isEDDSACurveSupported(),
>>> SecurityUtils.EDDSA + " not supported");
>>> +        return OpenSSHEd25519PrivateKeyEntryDecoder.INSTANCE;
>>> +    }
>>> +
>>> +    public static boolean compareEDDSAPrivateKeys(PrivateKey k1,
>>> PrivateKey k2) {
>>> +        if (!SecurityUtils.isEDDSACurveSupported()) {
>>> +            return false;
>>> +        }
>>> +
>>> +        if ((k1 instanceof EdDSAPrivateKey) && (k2 instanceof
>>> EdDSAPrivateKey)) {
>>> +            if (Objects.equals(k1, k2)) {
>>> +                return true;
>>> +            } else if (k1 == null || k2 == null) {
>>> +                return false;   // both null is covered by
>>> Objects#equals
>>> +            }
>>> +
>>> +            EdDSAPrivateKey ed1 = (EdDSAPrivateKey) k1;
>>> +            EdDSAPrivateKey ed2 = (EdDSAPrivateKey) k2;
>>> +            return Arrays.equals(ed1.getSeed(), ed2.getSeed())
>>> +                && compareEDDSAKeyParams(ed1.getParams(),
>>> ed2.getParams());
>>> +        }
>>> +
>>> +        return false;
>>> +    }
>>> +
>>> +    public static boolean compareEDDSAKeyParams(EdDSAParameterSpec s1,
>>> EdDSAParameterSpec s2) {
>>> +        if (Objects.equals(s1, s2)) {
>>> +            return true;
>>> +        } else if (s1 == null || s2 == null) {
>>> +            return false;   // both null is covered by Objects#equals
>>> +        } else {
>>> +            return Objects.equals(s1.getHashAlgorithm(),
>>> s2.getHashAlgorithm())
>>> +                && Objects.equals(s1.getCurve(), s2.getCurve())
>>> +                && Objects.equals(s1.getB(), s2.getB());
>>> +        }
>>> +    }
>>> +
>>> +    public static PublicKey generateEDDSAPublicKey(byte[] seed) throws
>>> GeneralSecurityException {
>>> +        if (!SecurityUtils.isEDDSACurveSupported()) {
>>> +            throw new NoSuchAlgorithmException(SecurityUtils.EDDSA + "
>>> not supported");
>>> +        }
>>> +
>>> +        EdDSAParameterSpec params = EdDSANamedCurveTable.getByName
>>> (EdDSANamedCurveTable.CURVE_ED25519_SHA512);
>>> +        EdDSAPublicKeySpec keySpec = new EdDSAPublicKeySpec(seed,
>>> params);
>>> +        KeyFactory factory = SecurityUtils.getKeyFactory(Se
>>> curityUtils.EDDSA);
>>> +        return factory.generatePublic(keySpec);
>>> +    }
>>> +
>>> +    public static PrivateKey generateEDDSAPrivateKey(byte[] seed)
>>> throws GeneralSecurityException {
>>> +        if (!SecurityUtils.isEDDSACurveSupported()) {
>>> +            throw new NoSuchAlgorithmException(SecurityUtils.EDDSA + "
>>> not supported");
>>> +        }
>>> +
>>> +        EdDSAParameterSpec params = EdDSANamedCurveTable.getByName
>>> (EdDSANamedCurveTable.CURVE_ED25519_SHA512);
>>> +        EdDSAPrivateKeySpec keySpec = new EdDSAPrivateKeySpec(seed,
>>> params);
>>> +        KeyFactory factory = SecurityUtils.getKeyFactory(Se
>>> curityUtils.EDDSA);
>>> +        return factory.generatePrivate(keySpec);
>>> +    }
>>> +
>>> +    public static <B extends Buffer> B putRawEDDSAPublicKey(B buffer,
>>> PublicKey key) {
>>> +        ValidateUtils.checkTrue(SecurityUtils.isEDDSACurveSupported(),
>>> SecurityUtils.EDDSA + " not supported");
>>> +        EdDSAPublicKey edKey = ValidateUtils.checkInstanceOf(key,
>>> EdDSAPublicKey.class, "Not an EDDSA public key: %s", key);
>>> +        byte[] seed = Ed25519PublicKeyDecoder.getSeedValue(edKey);
>>> +        ValidateUtils.checkNotNull(seed, "No seed extracted from key:
>>> %s", edKey.getA());
>>> +        buffer.putString(KeyPairProvider.SSH_ED25519);
>>> +        buffer.putBytes(seed);
>>> +        return buffer;
>>> +    }
>>> +
>>> +    public static <B extends Buffer> B putEDDSAKeyPair(B buffer,
>>> PublicKey pubKey, PrivateKey prvKey) {
>>> +        ValidateUtils.checkTrue(SecurityUtils.isEDDSACurveSupported(),
>>> SecurityUtils.EDDSA + " not supported");
>>> +        ValidateUtils.checkInstanceOf(pubKey, EdDSAPublicKey.class,
>>> "Not an EDDSA public key: %s", pubKey);
>>> +        ValidateUtils.checkInstanceOf(prvKey, EdDSAPrivateKey.class,
>>> "Not an EDDSA private key: %s", prvKey);
>>> +        throw new UnsupportedOperationException("Full SSHD-440
>>> implementation N/A");
>>> +    }
>>> +}
>>> \ No newline at end of file
>>>
>>> http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/cbb92d
>>> 2a/sshd-core/src/main/java/org/apache/sshd/common/util/secur
>>> ity/eddsa/OpenSSHEd25519PrivateKeyEntryDecoder.java
>>> ----------------------------------------------------------------------
>>> diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/securi
>>> ty/eddsa/OpenSSHEd25519PrivateKeyEntryDecoder.java
>>> b/sshd-core/src/main/java/org/apache/sshd/common/util/securi
>>> ty/eddsa/OpenSSHEd25519PrivateKeyEntryDecoder.java
>>> index b05a4cc..e5ae0ac 100644
>>> --- a/sshd-core/src/main/java/org/apache/sshd/common/util/securi
>>> ty/eddsa/OpenSSHEd25519PrivateKeyEntryDecoder.java
>>> +++ b/sshd-core/src/main/java/org/apache/sshd/common/util/securi
>>> ty/eddsa/OpenSSHEd25519PrivateKeyEntryDecoder.java
>>> @@ -98,7 +98,7 @@ public class OpenSSHEd25519PrivateKeyEntryDecoder
>>> extends AbstractPrivateKeyEntr
>>>
>>>      @Override
>>>      public EdDSAPublicKey recoverPublicKey(EdDSAPrivateKey prvKey)
>>> throws GeneralSecurityException {
>>> -        return EdDSASecurityProvider.recoverEDDSAPublicKey(prvKey);
>>> +        return EdDSASecurityProviderUtils.rec
>>> overEDDSAPublicKey(prvKey);
>>>      }
>>>
>>>      @Override
>>>
>>> http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/cbb92d
>>> 2a/sshd-core/src/test/java/org/apache/sshd/common/signature/
>>> SignaturesDevelopment.java
>>> ----------------------------------------------------------------------
>>> diff --git a/sshd-core/src/test/java/org/apache/sshd/common/signature/SignaturesDevelopment.java
>>> b/sshd-core/src/test/java/org/apache/sshd/common/signature/S
>>> ignaturesDevelopment.java
>>> index 6c4929a..180e997 100644
>>> --- a/sshd-core/src/test/java/org/apache/sshd/common/signature/S
>>> ignaturesDevelopment.java
>>> +++ b/sshd-core/src/test/java/org/apache/sshd/common/signature/S
>>> ignaturesDevelopment.java
>>> @@ -25,7 +25,7 @@ import java.security.PublicKey;
>>>
>>>  import org.apache.sshd.common.util.GenericUtils;
>>>  import org.apache.sshd.common.util.buffer.BufferUtils;
>>> -import org.apache.sshd.common.util.security.eddsa.EdDSASecurityProv
>>> ider;
>>> +import org.apache.sshd.common.util.security.eddsa.EdDSASecurityProv
>>> iderUtils;
>>>  import org.apache.sshd.util.test.BaseTestSupport;
>>>
>>>  /**
>>> @@ -64,9 +64,9 @@ public class SignaturesDevelopment extends
>>> BaseTestSupport {
>>>          SignatureFactory factory = BuiltinSignatures.resolveFacto
>>> ry(args[0]);
>>>          // TODO recover public/private keys according to factory name
>>>          byte[] publicKey = BufferUtils.decodeHex(':', args[1]);
>>> -        PublicKey pubKey = EdDSASecurityProvider.generate
>>> EDDSAPublicKey(publicKey);
>>> +        PublicKey pubKey = EdDSASecurityProviderUtils.gen
>>> erateEDDSAPublicKey(publicKey);
>>>          byte[] privateKey = BufferUtils.decodeHex(':', args[2]);
>>> -        PrivateKey prvKey = EdDSASecurityProvider.generate
>>> EDDSAPrivateKey(privateKey);
>>> +        PrivateKey prvKey = EdDSASecurityProviderUtils.gen
>>> erateEDDSAPrivateKey(privateKey);
>>>          String op = args[3];
>>>          byte[] data = BufferUtils.decodeHex(':', args[4]);
>>>          byte[] signature = GenericUtils.EMPTY_BYTE_ARRAY;
>>>
>>> http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/cbb92d
>>> 2a/sshd-core/src/test/java/org/apache/sshd/common/util/secur
>>> ity/eddsa/Ed25519VectorsTest.java
>>> ----------------------------------------------------------------------
>>> diff --git a/sshd-core/src/test/java/org/apache/sshd/common/util/securi
>>> ty/eddsa/Ed25519VectorsTest.java b/sshd-core/src/test/java/org/
>>> apache/sshd/common/util/security/eddsa/Ed25519VectorsTest.java
>>> index fab3294..b58aad3 100644
>>> --- a/sshd-core/src/test/java/org/apache/sshd/common/util/securi
>>> ty/eddsa/Ed25519VectorsTest.java
>>> +++ b/sshd-core/src/test/java/org/apache/sshd/common/util/securi
>>> ty/eddsa/Ed25519VectorsTest.java
>>> @@ -60,9 +60,9 @@ public class Ed25519VectorsTest extends
>>> BaseTestSupport {
>>>      public Ed25519VectorsTest(String name, String prvKey, String
>>> pubKey, String msg, String signature)
>>>              throws GeneralSecurityException {
>>>          prvBytes = BufferUtils.decodeHex(BufferUtils.EMPTY_HEX_SEPARATOR,
>>> prvKey);
>>> -        privateKey = EdDSASecurityProvider.generate
>>> EDDSAPrivateKey(prvBytes.clone());
>>> +        privateKey = EdDSASecurityProviderUtils.gen
>>> erateEDDSAPrivateKey(prvBytes.clone());
>>>          pubBytes = BufferUtils.decodeHex(BufferUtils.EMPTY_HEX_SEPARATOR,
>>> pubKey);
>>> -        publicKey = EdDSASecurityProvider.generate
>>> EDDSAPublicKey(pubBytes.clone());
>>> +        publicKey = EdDSASecurityProviderUtils.gen
>>> erateEDDSAPublicKey(pubBytes.clone());
>>>          msgBytes = BufferUtils.decodeHex(BufferUtils.EMPTY_HEX_SEPARATOR,
>>> msg);
>>>          expSignature = BufferUtils.decodeHex(BufferUtils.EMPTY_HEX_SEPARATOR,
>>> signature);
>>>      }
>>> @@ -200,14 +200,14 @@ public class Ed25519VectorsTest extends
>>> BaseTestSupport {
>>>
>>>      @Test
>>>      public void testSignature() throws Exception {
>>> -        Signature signer = EdDSASecurityProvider.getEDDSASignature();
>>> +        Signature signer = EdDSASecurityProviderUtils.get
>>> EDDSASignature();
>>>          signer.initSigner(privateKey);
>>>          signer.update(msgBytes.clone());
>>>
>>>          byte[] actSignature = signer.sign();
>>>          assertArrayEquals("Mismatched signature", expSignature,
>>> actSignature);
>>>
>>> -        Signature verifier = EdDSASecurityProvider.getEDDSASignature();
>>> +        Signature verifier = EdDSASecurityProviderUtils.get
>>> EDDSASignature();
>>>          verifier.initVerifier(publicKey);
>>>          verifier.update(msgBytes.clone());
>>>          assertTrue("Verification failed", verifier.verify(expSignature))
>>> ;
>>> @@ -222,14 +222,14 @@ public class Ed25519VectorsTest extends
>>> BaseTestSupport {
>>>          System.arraycopy(msgBytes, 0, dataBuf, offset, msgBytes.length);
>>>          System.arraycopy(extraData, offset, dataBuf, offset +
>>> msgBytes.length, extraData.length - offset);
>>>
>>> -        Signature signer = EdDSASecurityProvider.getEDDSASignature();
>>> +        Signature signer = EdDSASecurityProviderUtils.get
>>> EDDSASignature();
>>>          signer.initSigner(privateKey);
>>>          signer.update(dataBuf.clone(), offset, msgBytes.length);
>>>
>>>          byte[] actSignature = signer.sign();
>>>          assertArrayEquals("Mismatched signature", expSignature,
>>> actSignature);
>>>
>>> -        Signature verifier = EdDSASecurityProvider.getEDDSASignature();
>>> +        Signature verifier = EdDSASecurityProviderUtils.get
>>> EDDSASignature();
>>>          verifier.initVerifier(publicKey);
>>>          verifier.update(dataBuf.clone(), offset, msgBytes.length);
>>>          assertTrue("Verification failed", verifier.verify(expSignature))
>>> ;
>>>
>>> http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/cbb92d
>>> 2a/sshd-core/src/test/java/org/apache/sshd/common/util/secur
>>> ity/eddsa/EdDSASecurityProviderRegistrarTest.java
>>> ----------------------------------------------------------------------
>>> diff --git a/sshd-core/src/test/java/org/apache/sshd/common/util/securi
>>> ty/eddsa/EdDSASecurityProviderRegistrarTest.java
>>> b/sshd-core/src/test/java/org/apache/sshd/common/util/securi
>>> ty/eddsa/EdDSASecurityProviderRegistrarTest.java
>>> index 9e12fab..f2c1f3f 100644
>>> --- a/sshd-core/src/test/java/org/apache/sshd/common/util/securi
>>> ty/eddsa/EdDSASecurityProviderRegistrarTest.java
>>> +++ b/sshd-core/src/test/java/org/apache/sshd/common/util/securi
>>> ty/eddsa/EdDSASecurityProviderRegistrarTest.java
>>> @@ -26,6 +26,8 @@ import java.util.Arrays;
>>>  import java.util.Collection;
>>>  import java.util.HashSet;
>>>
>>> +import net.i2p.crypto.eddsa.EdDSASecurityProvider;
>>> +
>>>  import org.apache.sshd.common.util.security.SecurityProviderRegistrar;
>>>  import org.apache.sshd.common.util.security.SecurityProviderRegistr
>>> arTestSupport;
>>>  import org.apache.sshd.common.util.security.SecurityUtils;
>>>
>>>
>>
>>
>> --
>> ------------------------
>> Guillaume Nodet
>>
>>


-- 
------------------------
Guillaume Nodet

Re: [1/2] mina-sshd git commit: [SSHD-727] Upgrade used EdDSA artifact version to 1.1

Posted by Guillaume Nodet <gn...@apache.org>.
I can't find this artifact in maven central.
Could you add the needed repository please ?

2017-03-02 21:00 GMT+01:00 <lg...@apache.org>:

> Repository: mina-sshd
> Updated Branches:
>   refs/heads/master 8e255459a -> cbb92d2a8
>
>
> [SSHD-727] Upgrade used EdDSA artifact version to 1.1
>
>
> Project: http://git-wip-us.apache.org/repos/asf/mina-sshd/repo
> Commit: http://git-wip-us.apache.org/repos/asf/mina-sshd/commit/cbb92d2a
> Tree: http://git-wip-us.apache.org/repos/asf/mina-sshd/tree/cbb92d2a
> Diff: http://git-wip-us.apache.org/repos/asf/mina-sshd/diff/cbb92d2a
>
> Branch: refs/heads/master
> Commit: cbb92d2a89600ee8a34abdf7d84cdc08291dcbf5
> Parents: 22dc7c3
> Author: Lyor Goldstein <ly...@gmail.com>
> Authored: Thu Mar 2 21:47:51 2017 +0200
> Committer: Lyor Goldstein <ly...@gmail.com>
> Committed: Thu Mar 2 22:01:14 2017 +0200
>
> ----------------------------------------------------------------------
>  pom.xml                                         |   6 +-
>  .../common/util/security/SecurityUtils.java     |  31 +--
>  .../security/eddsa/EdDSASecurityProvider.java   | 205 -------------------
>  .../eddsa/EdDSASecurityProviderRegistrar.java   |   2 +-
>  .../eddsa/EdDSASecurityProviderUtils.java       | 197 ++++++++++++++++++
>  .../OpenSSHEd25519PrivateKeyEntryDecoder.java   |   2 +-
>  .../common/signature/SignaturesDevelopment.java |   6 +-
>  .../util/security/eddsa/Ed25519VectorsTest.java |  12 +-
>  .../EdDSASecurityProviderRegistrarTest.java     |   2 +
>  9 files changed, 229 insertions(+), 234 deletions(-)
> ----------------------------------------------------------------------
>
>
> http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/cbb92d2a/pom.xml
> ----------------------------------------------------------------------
> diff --git a/pom.xml b/pom.xml
> index 806f7fb..06ec711 100644
> --- a/pom.xml
> +++ b/pom.xml
> @@ -104,7 +104,7 @@
>          <gmaven.plugin.version>2.0</gmaven.plugin.version>
>          <groovy.major.version>2</groovy.major.version>
>          <groovy.minor.version>4</groovy.minor.version>
> -        <groovy.release.version>8</groovy.release.version>
> +        <groovy.release.version>9</groovy.release.version>
>          <groovy.compliance.level>2.0</groovy.compliance.level>
>          <groovy.version>${groovy.major.version}.${groovy.minor.
> version}.${groovy.release.version}</groovy.version>
>
> @@ -202,7 +202,7 @@
>              <dependency>
>                  <groupId>net.i2p.crypto</groupId>
>                  <artifactId>eddsa</artifactId>
> -                <version>0.1.0</version>
> +                <version>0.1.1</version>
>              </dependency>
>
>              <dependency>
> @@ -594,7 +594,7 @@
>                          <dependency>
>                              <groupId>com.puppycrawl.tools</groupId>
>                              <artifactId>checkstyle</artifactId>
> -                            <version>7.5.1</version>
> +                            <version>7.6</version>
>                              <exclusions>
>                                  <!-- MCHECKSTYLE-156 -->
>                                  <exclusion>
>
> http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/
> cbb92d2a/sshd-core/src/main/java/org/apache/sshd/common/
> util/security/SecurityUtils.java
> ----------------------------------------------------------------------
> diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/security/SecurityUtils.java
> b/sshd-core/src/main/java/org/apache/sshd/common/util/
> security/SecurityUtils.java
> index 6aff088..b86bcc3 100644
> --- a/sshd-core/src/main/java/org/apache/sshd/common/util/
> security/SecurityUtils.java
> +++ b/sshd-core/src/main/java/org/apache/sshd/common/util/
> security/SecurityUtils.java
> @@ -73,7 +73,7 @@ import org.apache.sshd.common.util.buffer.Buffer;
>  import org.apache.sshd.common.util.security.bouncycastle.
> BouncyCastleGeneratorHostKeyProvider;
>  import org.apache.sshd.common.util.security.bouncycastle.
> BouncyCastleKeyPairResourceParser;
>  import org.apache.sshd.common.util.security.bouncycastle.
> BouncyCastleRandomFactory;
> -import org.apache.sshd.common.util.security.eddsa.EdDSASecurityProvider;
> +import org.apache.sshd.common.util.security.eddsa.
> EdDSASecurityProviderUtils;
>  import org.apache.sshd.common.util.threads.ThreadUtils;
>  import org.apache.sshd.server.keyprovider.AbstractGeneratorHostKeyProvid
> er;
>  import org.slf4j.Logger;
> @@ -91,12 +91,13 @@ public final class SecurityUtils {
>      public static final String BOUNCY_CASTLE = "BC";
>
>      /**
> -     * EDDSA support
> +     * EDDSA support - should match {@code EdDSAKey.KEY_ALGORITHM}
>       */
>      public static final String EDDSA = "EdDSA";
>
>      // A copy-paste from the original, but we don't want to drag the
> classes into the classpath
> -    public static final String CURVE_ED25519_SHA512 = "ed25519-sha-512";
> +    // See EdDSANamedCurveTable.CURVE_ED25519_SHA512
> +    public static final String CURVE_ED25519_SHA512 = "SHA512withEd25519";
>
>      /**
>       * System property used to configure the value for the maximum
> supported Diffie-Hellman
> @@ -538,7 +539,7 @@ public final class SecurityUtils {
>              throw new UnsupportedOperationException(EDDSA + " provider
> N/A");
>          }
>
> -        return EdDSASecurityProvider.getEDDSAPublicKeyEntryDecoder();
> +        return EdDSASecurityProviderUtils.getEDDSAPublicKeyEntryDecoder(
> );
>      }
>
>      public static PrivateKeyEntryDecoder<? extends PublicKey, ? extends
> PrivateKey> getOpenSSHEDDSAPrivateKeyEntryDecoder() {
> @@ -546,35 +547,35 @@ public final class SecurityUtils {
>              throw new UnsupportedOperationException(EDDSA + " provider
> N/A");
>          }
>
> -        return EdDSASecurityProvider.getOpenSSHEDDSAPrivateKeyEntry
> Decoder();
> +        return EdDSASecurityProviderUtils.getOpenSSHEDDSAPrivateKeyEntry
> Decoder();
>      }
>
>      public static org.apache.sshd.common.signature.Signature
> getEDDSASigner() {
>          if (isEDDSACurveSupported()) {
> -            return EdDSASecurityProvider.getEDDSASignature();
> +            return EdDSASecurityProviderUtils.getEDDSASignature();
>          }
>
>          throw new UnsupportedOperationException(EDDSA + " Signer not
> available");
>      }
>
>      public static int getEDDSAKeySize(Key key) {
> -        return EdDSASecurityProvider.getEDDSAKeySize(key);
> +        return EdDSASecurityProviderUtils.getEDDSAKeySize(key);
>      }
>
>      public static Class<? extends PublicKey> getEDDSAPublicKeyType() {
> -        return isEDDSACurveSupported() ? EdDSASecurityProvider.getEDDSAPublicKeyType()
> : PublicKey.class;
> +        return isEDDSACurveSupported() ? EdDSASecurityProviderUtils.getEDDSAPublicKeyType()
> : PublicKey.class;
>      }
>
>      public static Class<? extends PrivateKey> getEDDSAPrivateKeyType() {
> -        return isEDDSACurveSupported() ? EdDSASecurityProvider.getEDDSAPrivateKeyType()
> : PrivateKey.class;
> +        return isEDDSACurveSupported() ? EdDSASecurityProviderUtils.getEDDSAPrivateKeyType()
> : PrivateKey.class;
>      }
>
>      public static boolean compareEDDSAPPublicKeys(PublicKey k1,
> PublicKey k2) {
> -        return isEDDSACurveSupported() ? EdDSASecurityProvider.compareEDDSAPPublicKeys(k1,
> k2) : false;
> +        return isEDDSACurveSupported() ? EdDSASecurityProviderUtils.compareEDDSAPPublicKeys(k1,
> k2) : false;
>      }
>
>      public static boolean compareEDDSAPrivateKeys(PrivateKey k1,
> PrivateKey k2) {
> -        return isEDDSACurveSupported() ? EdDSASecurityProvider.compareEDDSAPrivateKeys(k1,
> k2) : false;
> +        return isEDDSACurveSupported() ? EdDSASecurityProviderUtils.compareEDDSAPrivateKeys(k1,
> k2) : false;
>      }
>
>      public static PublicKey recoverEDDSAPublicKey(PrivateKey key) throws
> GeneralSecurityException {
> @@ -582,7 +583,7 @@ public final class SecurityUtils {
>              throw new NoSuchAlgorithmException(EDDSA + " provider not
> supported");
>          }
>
> -        return EdDSASecurityProvider.recoverEDDSAPublicKey(key);
> +        return EdDSASecurityProviderUtils.recoverEDDSAPublicKey(key);
>      }
>
>      public static PublicKey generateEDDSAPublicKey(String keyType, byte[]
> seed) throws GeneralSecurityException {
> @@ -594,7 +595,7 @@ public final class SecurityUtils {
>              throw new NoSuchAlgorithmException(EDDSA + " provider not
> supported");
>          }
>
> -        return EdDSASecurityProvider.generateEDDSAPublicKey(seed);
> +        return EdDSASecurityProviderUtils.generateEDDSAPublicKey(seed);
>      }
>
>      public static <B extends Buffer> B putRawEDDSAPublicKey(B buffer,
> PublicKey key) {
> @@ -602,7 +603,7 @@ public final class SecurityUtils {
>              throw new UnsupportedOperationException(EDDSA + " provider
> not supported");
>          }
>
> -        return EdDSASecurityProvider.putRawEDDSAPublicKey(buffer, key);
> +        return EdDSASecurityProviderUtils.putRawEDDSAPublicKey(buffer,
> key);
>      }
>
>      public static <B extends Buffer> B putEDDSAKeyPair(B buffer, KeyPair
> kp) {
> @@ -614,7 +615,7 @@ public final class SecurityUtils {
>              throw new UnsupportedOperationException(EDDSA + " provider
> not supported");
>          }
>
> -        return EdDSASecurityProvider.putEDDSAKeyPair(buffer, pubKey,
> prvKey);
> +        return EdDSASecurityProviderUtils.putEDDSAKeyPair(buffer,
> pubKey, prvKey);
>      }
>
>      public static KeyPair extractEDDSAKeyPair(Buffer buffer, String
> keyType) throws GeneralSecurityException {
>
> http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/
> cbb92d2a/sshd-core/src/main/java/org/apache/sshd/common/
> util/security/eddsa/EdDSASecurityProvider.java
> ----------------------------------------------------------------------
> diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/
> security/eddsa/EdDSASecurityProvider.java b/sshd-core/src/main/java/org/
> apache/sshd/common/util/security/eddsa/EdDSASecurityProvider.java
> deleted file mode 100644
> index e039547..0000000
> --- a/sshd-core/src/main/java/org/apache/sshd/common/util/security/eddsa/
> EdDSASecurityProvider.java
> +++ /dev/null
> @@ -1,205 +0,0 @@
> -/*
> - * Licensed to the Apache Software Foundation (ASF) under one
> - * or more contributor license agreements. See the NOTICE file
> - * distributed with this work for additional information
> - * regarding copyright ownership. The ASF licenses this file
> - * to you under the Apache License, Version 2.0 (the
> - * "License"); you may not use this file except in compliance
> - * with the License. You may obtain a copy of the License at
> - *
> - * http://www.apache.org/licenses/LICENSE-2.0
> - *
> - * Unless required by applicable law or agreed to in writing,
> - * software distributed under the License is distributed on an
> - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> - * KIND, either express or implied. See the License for the
> - * specific language governing permissions and limitations
> - * under the License.
> - */
> -package org.apache.sshd.common.util.security.eddsa;
> -
> -import java.security.GeneralSecurityException;
> -import java.security.InvalidKeyException;
> -import java.security.Key;
> -import java.security.KeyFactory;
> -import java.security.NoSuchAlgorithmException;
> -import java.security.PrivateKey;
> -import java.security.Provider;
> -import java.security.PublicKey;
> -import java.util.Arrays;
> -import java.util.Objects;
> -
> -import net.i2p.crypto.eddsa.EdDSAKey;
> -import net.i2p.crypto.eddsa.EdDSAPrivateKey;
> -import net.i2p.crypto.eddsa.EdDSAPublicKey;
> -import net.i2p.crypto.eddsa.spec.EdDSANamedCurveTable;
> -import net.i2p.crypto.eddsa.spec.EdDSAParameterSpec;
> -import net.i2p.crypto.eddsa.spec.EdDSAPrivateKeySpec;
> -import net.i2p.crypto.eddsa.spec.EdDSAPublicKeySpec;
> -
> -import org.apache.sshd.common.config.keys.PrivateKeyEntryDecoder;
> -import org.apache.sshd.common.config.keys.PublicKeyEntryDecoder;
> -import org.apache.sshd.common.keyprovider.KeyPairProvider;
> -import org.apache.sshd.common.util.ValidateUtils;
> -import org.apache.sshd.common.util.buffer.Buffer;
> -import org.apache.sshd.common.util.security.SecurityUtils;
> -
> -/**
> - * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD
> Project</a>
> - */
> -public class EdDSASecurityProvider extends Provider {
> -    private static final long serialVersionUID = -6183277432144104981L;
> -
> -    public EdDSASecurityProvider() {
> -        super(SecurityUtils.EDDSA, 0.1, "net.i2p security provider
> wrapper");
> -
> -        // see https://docs.oracle.com/javase/8/docs/technotes/
> guides/security/crypto/HowToImplAProvider.html
> -        put("KeyPairGenerator." + SecurityUtils.EDDSA,
> "net.i2p.crypto.eddsa.KeyPairGenerator");
> -        put("KeyFactory." + SecurityUtils.EDDSA, "net.i2p.crypto.eddsa.
> KeyFactory");
> -        put("Signature." + EdDSANamedCurveTable.CURVE_ED25519_SHA512,
> "net.i2p.crypto.eddsa.EdDSAEngine");
> -    }
> -
> -    public static Class<? extends PublicKey> getEDDSAPublicKeyType() {
> -        return EdDSAPublicKey.class;
> -    }
> -
> -    public static Class<? extends PrivateKey> getEDDSAPrivateKeyType() {
> -        return EdDSAPrivateKey.class;
> -    }
> -
> -    public static int getEDDSAKeySize(Key key) {
> -        return (SecurityUtils.isEDDSACurveSupported() && (key instanceof
> EdDSAKey)) ? 256 : -1;
> -    }
> -
> -    public static boolean compareEDDSAPPublicKeys(PublicKey k1,
> PublicKey k2) {
> -        if (!SecurityUtils.isEDDSACurveSupported()) {
> -            return false;
> -        }
> -
> -        if ((k1 instanceof EdDSAPublicKey) && (k2 instanceof
> EdDSAPublicKey)) {
> -            if (Objects.equals(k1, k2)) {
> -                return true;
> -            } else if (k1 == null || k2 == null) {
> -                return false;   // both null is covered by Objects#equals
> -            }
> -
> -            EdDSAPublicKey ed1 = (EdDSAPublicKey) k1;
> -            EdDSAPublicKey ed2 = (EdDSAPublicKey) k2;
> -            return Arrays.equals(ed1.getAbyte(), ed2.getAbyte())
> -                && compareEDDSAKeyParams(ed1.getParams(),
> ed2.getParams());
> -        }
> -
> -        return false;
> -    }
> -
> -    public static boolean isEDDSASignatureAlgorithm(String algorithm) {
> -        return EdDSANamedCurveTable.CURVE_ED25519_SHA512.
> equalsIgnoreCase(algorithm);
> -    }
> -
> -    public static EdDSAPublicKey recoverEDDSAPublicKey(PrivateKey key)
> throws GeneralSecurityException {
> -        ValidateUtils.checkTrue(SecurityUtils.isEDDSACurveSupported(),
> SecurityUtils.EDDSA + " not supported");
> -        if (!(key instanceof EdDSAPrivateKey)) {
> -            throw new InvalidKeyException("Private key is not " +
> SecurityUtils.EDDSA);
> -        }
> -
> -        EdDSAPrivateKey prvKey = (EdDSAPrivateKey) key;
> -        EdDSAPublicKeySpec keySpec = new EdDSAPublicKeySpec(prvKey.getSeed(),
> prvKey.getParams());
> -        KeyFactory factory = SecurityUtils.getKeyFactory(
> SecurityUtils.EDDSA);
> -        return EdDSAPublicKey.class.cast(factory.generatePublic(
> keySpec));
> -    }
> -
> -    public static org.apache.sshd.common.signature.Signature
> getEDDSASignature() {
> -        ValidateUtils.checkTrue(SecurityUtils.isEDDSACurveSupported(),
> SecurityUtils.EDDSA + " not supported");
> -        return new SignatureEd25519();
> -    }
> -
> -    public static boolean isEDDSAKeyFactoryAlgorithm(String algorithm) {
> -        return SecurityUtils.EDDSA.equalsIgnoreCase(algorithm);
> -    }
> -
> -    public static boolean isEDDSAKeyPairGeneratorAlgorithm(String
> algorithm) {
> -        return SecurityUtils.EDDSA.equalsIgnoreCase(algorithm);
> -    }
> -
> -    public static PublicKeyEntryDecoder<? extends PublicKey, ? extends
> PrivateKey> getEDDSAPublicKeyEntryDecoder() {
> -        ValidateUtils.checkTrue(SecurityUtils.isEDDSACurveSupported(),
> SecurityUtils.EDDSA + " not supported");
> -        return Ed25519PublicKeyDecoder.INSTANCE;
> -    }
> -
> -    public static PrivateKeyEntryDecoder<? extends PublicKey, ? extends
> PrivateKey> getOpenSSHEDDSAPrivateKeyEntryDecoder() {
> -        ValidateUtils.checkTrue(SecurityUtils.isEDDSACurveSupported(),
> SecurityUtils.EDDSA + " not supported");
> -        return OpenSSHEd25519PrivateKeyEntryDecoder.INSTANCE;
> -    }
> -
> -    public static boolean compareEDDSAPrivateKeys(PrivateKey k1,
> PrivateKey k2) {
> -        if (!SecurityUtils.isEDDSACurveSupported()) {
> -            return false;
> -        }
> -
> -        if ((k1 instanceof EdDSAPrivateKey) && (k2 instanceof
> EdDSAPrivateKey)) {
> -            if (Objects.equals(k1, k2)) {
> -                return true;
> -            } else if (k1 == null || k2 == null) {
> -                return false;   // both null is covered by Objects#equals
> -            }
> -
> -            EdDSAPrivateKey ed1 = (EdDSAPrivateKey) k1;
> -            EdDSAPrivateKey ed2 = (EdDSAPrivateKey) k2;
> -            return Arrays.equals(ed1.getSeed(), ed2.getSeed())
> -                && compareEDDSAKeyParams(ed1.getParams(),
> ed2.getParams());
> -        }
> -
> -        return false;
> -    }
> -
> -    public static boolean compareEDDSAKeyParams(EdDSAParameterSpec s1,
> EdDSAParameterSpec s2) {
> -        if (Objects.equals(s1, s2)) {
> -            return true;
> -        } else if (s1 == null || s2 == null) {
> -            return false;   // both null is covered by Objects#equals
> -        } else {
> -            return Objects.equals(s1.getHashAlgorithm(),
> s2.getHashAlgorithm())
> -                && Objects.equals(s1.getCurve(), s2.getCurve())
> -                && Objects.equals(s1.getB(), s2.getB());
> -        }
> -    }
> -
> -    public static PublicKey generateEDDSAPublicKey(byte[] seed) throws
> GeneralSecurityException {
> -        if (!SecurityUtils.isEDDSACurveSupported()) {
> -            throw new NoSuchAlgorithmException(SecurityUtils.EDDSA + "
> not supported");
> -        }
> -
> -        EdDSAParameterSpec params = EdDSANamedCurveTable.getByName(
> EdDSANamedCurveTable.CURVE_ED25519_SHA512);
> -        EdDSAPublicKeySpec keySpec = new EdDSAPublicKeySpec(seed, params);
> -        KeyFactory factory = SecurityUtils.getKeyFactory(
> SecurityUtils.EDDSA);
> -        return factory.generatePublic(keySpec);
> -    }
> -
> -    public static PrivateKey generateEDDSAPrivateKey(byte[] seed) throws
> GeneralSecurityException {
> -        if (!SecurityUtils.isEDDSACurveSupported()) {
> -            throw new NoSuchAlgorithmException(SecurityUtils.EDDSA + "
> not supported");
> -        }
> -
> -        EdDSAParameterSpec params = EdDSANamedCurveTable.getByName(
> EdDSANamedCurveTable.CURVE_ED25519_SHA512);
> -        EdDSAPrivateKeySpec keySpec = new EdDSAPrivateKeySpec(seed,
> params);
> -        KeyFactory factory = SecurityUtils.getKeyFactory(
> SecurityUtils.EDDSA);
> -        return factory.generatePrivate(keySpec);
> -    }
> -
> -    public static <B extends Buffer> B putRawEDDSAPublicKey(B buffer,
> PublicKey key) {
> -        ValidateUtils.checkTrue(SecurityUtils.isEDDSACurveSupported(),
> SecurityUtils.EDDSA + " not supported");
> -        EdDSAPublicKey edKey = ValidateUtils.checkInstanceOf(key,
> EdDSAPublicKey.class, "Not an EDDSA public key: %s", key);
> -        byte[] seed = Ed25519PublicKeyDecoder.getSeedValue(edKey);
> -        ValidateUtils.checkNotNull(seed, "No seed extracted from key:
> %s", edKey.getA());
> -        buffer.putString(KeyPairProvider.SSH_ED25519);
> -        buffer.putBytes(seed);
> -        return buffer;
> -    }
> -
> -    public static <B extends Buffer> B putEDDSAKeyPair(B buffer,
> PublicKey pubKey, PrivateKey prvKey) {
> -        ValidateUtils.checkTrue(SecurityUtils.isEDDSACurveSupported(),
> SecurityUtils.EDDSA + " not supported");
> -        ValidateUtils.checkInstanceOf(pubKey, EdDSAPublicKey.class, "Not
> an EDDSA public key: %s", pubKey);
> -        ValidateUtils.checkInstanceOf(prvKey, EdDSAPrivateKey.class,
> "Not an EDDSA private key: %s", prvKey);
> -        throw new UnsupportedOperationException("Full SSHD-440
> implementation N/A");
> -    }
> -}
> \ No newline at end of file
>
> http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/
> cbb92d2a/sshd-core/src/main/java/org/apache/sshd/common/
> util/security/eddsa/EdDSASecurityProviderRegistrar.java
> ----------------------------------------------------------------------
> diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/
> security/eddsa/EdDSASecurityProviderRegistrar.java
> b/sshd-core/src/main/java/org/apache/sshd/common/util/security/eddsa/
> EdDSASecurityProviderRegistrar.java
> index b463d27..2bb3f95 100644
> --- a/sshd-core/src/main/java/org/apache/sshd/common/util/security/eddsa/
> EdDSASecurityProviderRegistrar.java
> +++ b/sshd-core/src/main/java/org/apache/sshd/common/util/security/eddsa/
> EdDSASecurityProviderRegistrar.java
> @@ -36,7 +36,7 @@ import org.apache.sshd.common.util.threads.ThreadUtils;
>   * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD
> Project</a>
>   */
>  public class EdDSASecurityProviderRegistrar extends
> AbstractSecurityProviderRegistrar {
> -    public static final String PROVIDER_CLASS =
> "org.apache.sshd.common.util.security.eddsa.EdDSASecurityProvider";
> +    public static final String PROVIDER_CLASS = "net.i2p.crypto.eddsa.
> EdDSASecurityProvider";
>      // Do not define a static registrar instance to minimize class
> loading issues
>      private final AtomicReference<Boolean> supportHolder = new
> AtomicReference<>(null);
>
>
> http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/
> cbb92d2a/sshd-core/src/main/java/org/apache/sshd/common/
> util/security/eddsa/EdDSASecurityProviderUtils.java
> ----------------------------------------------------------------------
> diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/
> security/eddsa/EdDSASecurityProviderUtils.java
> b/sshd-core/src/main/java/org/apache/sshd/common/util/security/eddsa/
> EdDSASecurityProviderUtils.java
> new file mode 100644
> index 0000000..b5d79f0
> --- /dev/null
> +++ b/sshd-core/src/main/java/org/apache/sshd/common/util/security/eddsa/
> EdDSASecurityProviderUtils.java
> @@ -0,0 +1,197 @@
> +/*
> + * Licensed to the Apache Software Foundation (ASF) under one
> + * or more contributor license agreements. See the NOTICE file
> + * distributed with this work for additional information
> + * regarding copyright ownership. The ASF licenses this file
> + * to you under the Apache License, Version 2.0 (the
> + * "License"); you may not use this file except in compliance
> + * with the License. You may obtain a copy of the License at
> + *
> + * http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing,
> + * software distributed under the License is distributed on an
> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> + * KIND, either express or implied. See the License for the
> + * specific language governing permissions and limitations
> + * under the License.
> + */
> +package org.apache.sshd.common.util.security.eddsa;
> +
> +import java.security.GeneralSecurityException;
> +import java.security.InvalidKeyException;
> +import java.security.Key;
> +import java.security.KeyFactory;
> +import java.security.NoSuchAlgorithmException;
> +import java.security.PrivateKey;
> +import java.security.PublicKey;
> +import java.util.Arrays;
> +import java.util.Objects;
> +
> +import net.i2p.crypto.eddsa.EdDSAKey;
> +import net.i2p.crypto.eddsa.EdDSAPrivateKey;
> +import net.i2p.crypto.eddsa.EdDSAPublicKey;
> +import net.i2p.crypto.eddsa.spec.EdDSANamedCurveTable;
> +import net.i2p.crypto.eddsa.spec.EdDSAParameterSpec;
> +import net.i2p.crypto.eddsa.spec.EdDSAPrivateKeySpec;
> +import net.i2p.crypto.eddsa.spec.EdDSAPublicKeySpec;
> +
> +import org.apache.sshd.common.config.keys.PrivateKeyEntryDecoder;
> +import org.apache.sshd.common.config.keys.PublicKeyEntryDecoder;
> +import org.apache.sshd.common.keyprovider.KeyPairProvider;
> +import org.apache.sshd.common.util.ValidateUtils;
> +import org.apache.sshd.common.util.buffer.Buffer;
> +import org.apache.sshd.common.util.security.SecurityUtils;
> +
> +/**
> + * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD
> Project</a>
> + */
> +public final class EdDSASecurityProviderUtils {
> +    private EdDSASecurityProviderUtils() {
> +        throw new UnsupportedOperationException("No instance");
> +    }
> +
> +    public static Class<? extends PublicKey> getEDDSAPublicKeyType() {
> +        return EdDSAPublicKey.class;
> +    }
> +
> +    public static Class<? extends PrivateKey> getEDDSAPrivateKeyType() {
> +        return EdDSAPrivateKey.class;
> +    }
> +
> +    public static int getEDDSAKeySize(Key key) {
> +        return (SecurityUtils.isEDDSACurveSupported() && (key instanceof
> EdDSAKey)) ? 256 : -1;
> +    }
> +
> +    public static boolean compareEDDSAPPublicKeys(PublicKey k1,
> PublicKey k2) {
> +        if (!SecurityUtils.isEDDSACurveSupported()) {
> +            return false;
> +        }
> +
> +        if ((k1 instanceof EdDSAPublicKey) && (k2 instanceof
> EdDSAPublicKey)) {
> +            if (Objects.equals(k1, k2)) {
> +                return true;
> +            } else if (k1 == null || k2 == null) {
> +                return false;   // both null is covered by Objects#equals
> +            }
> +
> +            EdDSAPublicKey ed1 = (EdDSAPublicKey) k1;
> +            EdDSAPublicKey ed2 = (EdDSAPublicKey) k2;
> +            return Arrays.equals(ed1.getAbyte(), ed2.getAbyte())
> +                && compareEDDSAKeyParams(ed1.getParams(),
> ed2.getParams());
> +        }
> +
> +        return false;
> +    }
> +
> +    public static boolean isEDDSASignatureAlgorithm(String algorithm) {
> +        return EdDSANamedCurveTable.CURVE_ED25519_SHA512.
> equalsIgnoreCase(algorithm);
> +    }
> +
> +    public static EdDSAPublicKey recoverEDDSAPublicKey(PrivateKey key)
> throws GeneralSecurityException {
> +        ValidateUtils.checkTrue(SecurityUtils.isEDDSACurveSupported(),
> SecurityUtils.EDDSA + " not supported");
> +        if (!(key instanceof EdDSAPrivateKey)) {
> +            throw new InvalidKeyException("Private key is not " +
> SecurityUtils.EDDSA);
> +        }
> +
> +        EdDSAPrivateKey prvKey = (EdDSAPrivateKey) key;
> +        EdDSAPublicKeySpec keySpec = new EdDSAPublicKeySpec(prvKey.getSeed(),
> prvKey.getParams());
> +        KeyFactory factory = SecurityUtils.getKeyFactory(
> SecurityUtils.EDDSA);
> +        return EdDSAPublicKey.class.cast(factory.generatePublic(
> keySpec));
> +    }
> +
> +    public static org.apache.sshd.common.signature.Signature
> getEDDSASignature() {
> +        ValidateUtils.checkTrue(SecurityUtils.isEDDSACurveSupported(),
> SecurityUtils.EDDSA + " not supported");
> +        return new SignatureEd25519();
> +    }
> +
> +    public static boolean isEDDSAKeyFactoryAlgorithm(String algorithm) {
> +        return SecurityUtils.EDDSA.equalsIgnoreCase(algorithm);
> +    }
> +
> +    public static boolean isEDDSAKeyPairGeneratorAlgorithm(String
> algorithm) {
> +        return SecurityUtils.EDDSA.equalsIgnoreCase(algorithm);
> +    }
> +
> +    public static PublicKeyEntryDecoder<? extends PublicKey, ? extends
> PrivateKey> getEDDSAPublicKeyEntryDecoder() {
> +        ValidateUtils.checkTrue(SecurityUtils.isEDDSACurveSupported(),
> SecurityUtils.EDDSA + " not supported");
> +        return Ed25519PublicKeyDecoder.INSTANCE;
> +    }
> +
> +    public static PrivateKeyEntryDecoder<? extends PublicKey, ? extends
> PrivateKey> getOpenSSHEDDSAPrivateKeyEntryDecoder() {
> +        ValidateUtils.checkTrue(SecurityUtils.isEDDSACurveSupported(),
> SecurityUtils.EDDSA + " not supported");
> +        return OpenSSHEd25519PrivateKeyEntryDecoder.INSTANCE;
> +    }
> +
> +    public static boolean compareEDDSAPrivateKeys(PrivateKey k1,
> PrivateKey k2) {
> +        if (!SecurityUtils.isEDDSACurveSupported()) {
> +            return false;
> +        }
> +
> +        if ((k1 instanceof EdDSAPrivateKey) && (k2 instanceof
> EdDSAPrivateKey)) {
> +            if (Objects.equals(k1, k2)) {
> +                return true;
> +            } else if (k1 == null || k2 == null) {
> +                return false;   // both null is covered by Objects#equals
> +            }
> +
> +            EdDSAPrivateKey ed1 = (EdDSAPrivateKey) k1;
> +            EdDSAPrivateKey ed2 = (EdDSAPrivateKey) k2;
> +            return Arrays.equals(ed1.getSeed(), ed2.getSeed())
> +                && compareEDDSAKeyParams(ed1.getParams(),
> ed2.getParams());
> +        }
> +
> +        return false;
> +    }
> +
> +    public static boolean compareEDDSAKeyParams(EdDSAParameterSpec s1,
> EdDSAParameterSpec s2) {
> +        if (Objects.equals(s1, s2)) {
> +            return true;
> +        } else if (s1 == null || s2 == null) {
> +            return false;   // both null is covered by Objects#equals
> +        } else {
> +            return Objects.equals(s1.getHashAlgorithm(),
> s2.getHashAlgorithm())
> +                && Objects.equals(s1.getCurve(), s2.getCurve())
> +                && Objects.equals(s1.getB(), s2.getB());
> +        }
> +    }
> +
> +    public static PublicKey generateEDDSAPublicKey(byte[] seed) throws
> GeneralSecurityException {
> +        if (!SecurityUtils.isEDDSACurveSupported()) {
> +            throw new NoSuchAlgorithmException(SecurityUtils.EDDSA + "
> not supported");
> +        }
> +
> +        EdDSAParameterSpec params = EdDSANamedCurveTable.getByName(
> EdDSANamedCurveTable.CURVE_ED25519_SHA512);
> +        EdDSAPublicKeySpec keySpec = new EdDSAPublicKeySpec(seed, params);
> +        KeyFactory factory = SecurityUtils.getKeyFactory(
> SecurityUtils.EDDSA);
> +        return factory.generatePublic(keySpec);
> +    }
> +
> +    public static PrivateKey generateEDDSAPrivateKey(byte[] seed) throws
> GeneralSecurityException {
> +        if (!SecurityUtils.isEDDSACurveSupported()) {
> +            throw new NoSuchAlgorithmException(SecurityUtils.EDDSA + "
> not supported");
> +        }
> +
> +        EdDSAParameterSpec params = EdDSANamedCurveTable.getByName(
> EdDSANamedCurveTable.CURVE_ED25519_SHA512);
> +        EdDSAPrivateKeySpec keySpec = new EdDSAPrivateKeySpec(seed,
> params);
> +        KeyFactory factory = SecurityUtils.getKeyFactory(
> SecurityUtils.EDDSA);
> +        return factory.generatePrivate(keySpec);
> +    }
> +
> +    public static <B extends Buffer> B putRawEDDSAPublicKey(B buffer,
> PublicKey key) {
> +        ValidateUtils.checkTrue(SecurityUtils.isEDDSACurveSupported(),
> SecurityUtils.EDDSA + " not supported");
> +        EdDSAPublicKey edKey = ValidateUtils.checkInstanceOf(key,
> EdDSAPublicKey.class, "Not an EDDSA public key: %s", key);
> +        byte[] seed = Ed25519PublicKeyDecoder.getSeedValue(edKey);
> +        ValidateUtils.checkNotNull(seed, "No seed extracted from key:
> %s", edKey.getA());
> +        buffer.putString(KeyPairProvider.SSH_ED25519);
> +        buffer.putBytes(seed);
> +        return buffer;
> +    }
> +
> +    public static <B extends Buffer> B putEDDSAKeyPair(B buffer,
> PublicKey pubKey, PrivateKey prvKey) {
> +        ValidateUtils.checkTrue(SecurityUtils.isEDDSACurveSupported(),
> SecurityUtils.EDDSA + " not supported");
> +        ValidateUtils.checkInstanceOf(pubKey, EdDSAPublicKey.class, "Not
> an EDDSA public key: %s", pubKey);
> +        ValidateUtils.checkInstanceOf(prvKey, EdDSAPrivateKey.class,
> "Not an EDDSA private key: %s", prvKey);
> +        throw new UnsupportedOperationException("Full SSHD-440
> implementation N/A");
> +    }
> +}
> \ No newline at end of file
>
> http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/
> cbb92d2a/sshd-core/src/main/java/org/apache/sshd/common/
> util/security/eddsa/OpenSSHEd25519PrivateKeyEntryDecoder.java
> ----------------------------------------------------------------------
> diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/
> security/eddsa/OpenSSHEd25519PrivateKeyEntryDecoder.java
> b/sshd-core/src/main/java/org/apache/sshd/common/util/security/eddsa/
> OpenSSHEd25519PrivateKeyEntryDecoder.java
> index b05a4cc..e5ae0ac 100644
> --- a/sshd-core/src/main/java/org/apache/sshd/common/util/security/eddsa/
> OpenSSHEd25519PrivateKeyEntryDecoder.java
> +++ b/sshd-core/src/main/java/org/apache/sshd/common/util/security/eddsa/
> OpenSSHEd25519PrivateKeyEntryDecoder.java
> @@ -98,7 +98,7 @@ public class OpenSSHEd25519PrivateKeyEntryDecoder
> extends AbstractPrivateKeyEntr
>
>      @Override
>      public EdDSAPublicKey recoverPublicKey(EdDSAPrivateKey prvKey)
> throws GeneralSecurityException {
> -        return EdDSASecurityProvider.recoverEDDSAPublicKey(prvKey);
> +        return EdDSASecurityProviderUtils.recoverEDDSAPublicKey(prvKey);
>      }
>
>      @Override
>
> http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/
> cbb92d2a/sshd-core/src/test/java/org/apache/sshd/common/signature/
> SignaturesDevelopment.java
> ----------------------------------------------------------------------
> diff --git a/sshd-core/src/test/java/org/apache/sshd/common/signature/SignaturesDevelopment.java
> b/sshd-core/src/test/java/org/apache/sshd/common/signature/
> SignaturesDevelopment.java
> index 6c4929a..180e997 100644
> --- a/sshd-core/src/test/java/org/apache/sshd/common/signature/
> SignaturesDevelopment.java
> +++ b/sshd-core/src/test/java/org/apache/sshd/common/signature/
> SignaturesDevelopment.java
> @@ -25,7 +25,7 @@ import java.security.PublicKey;
>
>  import org.apache.sshd.common.util.GenericUtils;
>  import org.apache.sshd.common.util.buffer.BufferUtils;
> -import org.apache.sshd.common.util.security.eddsa.EdDSASecurityProvider;
> +import org.apache.sshd.common.util.security.eddsa.
> EdDSASecurityProviderUtils;
>  import org.apache.sshd.util.test.BaseTestSupport;
>
>  /**
> @@ -64,9 +64,9 @@ public class SignaturesDevelopment extends
> BaseTestSupport {
>          SignatureFactory factory = BuiltinSignatures.
> resolveFactory(args[0]);
>          // TODO recover public/private keys according to factory name
>          byte[] publicKey = BufferUtils.decodeHex(':', args[1]);
> -        PublicKey pubKey = EdDSASecurityProvider.generateEDDSAPublicKey(
> publicKey);
> +        PublicKey pubKey = EdDSASecurityProviderUtils.
> generateEDDSAPublicKey(publicKey);
>          byte[] privateKey = BufferUtils.decodeHex(':', args[2]);
> -        PrivateKey prvKey = EdDSASecurityProvider.
> generateEDDSAPrivateKey(privateKey);
> +        PrivateKey prvKey = EdDSASecurityProviderUtils.
> generateEDDSAPrivateKey(privateKey);
>          String op = args[3];
>          byte[] data = BufferUtils.decodeHex(':', args[4]);
>          byte[] signature = GenericUtils.EMPTY_BYTE_ARRAY;
>
> http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/
> cbb92d2a/sshd-core/src/test/java/org/apache/sshd/common/
> util/security/eddsa/Ed25519VectorsTest.java
> ----------------------------------------------------------------------
> diff --git a/sshd-core/src/test/java/org/apache/sshd/common/util/
> security/eddsa/Ed25519VectorsTest.java b/sshd-core/src/test/java/org/
> apache/sshd/common/util/security/eddsa/Ed25519VectorsTest.java
> index fab3294..b58aad3 100644
> --- a/sshd-core/src/test/java/org/apache/sshd/common/util/security/eddsa/
> Ed25519VectorsTest.java
> +++ b/sshd-core/src/test/java/org/apache/sshd/common/util/security/eddsa/
> Ed25519VectorsTest.java
> @@ -60,9 +60,9 @@ public class Ed25519VectorsTest extends BaseTestSupport {
>      public Ed25519VectorsTest(String name, String prvKey, String pubKey,
> String msg, String signature)
>              throws GeneralSecurityException {
>          prvBytes = BufferUtils.decodeHex(BufferUtils.EMPTY_HEX_SEPARATOR,
> prvKey);
> -        privateKey = EdDSASecurityProvider.generateEDDSAPrivateKey(
> prvBytes.clone());
> +        privateKey = EdDSASecurityProviderUtils.generateEDDSAPrivateKey(
> prvBytes.clone());
>          pubBytes = BufferUtils.decodeHex(BufferUtils.EMPTY_HEX_SEPARATOR,
> pubKey);
> -        publicKey = EdDSASecurityProvider.generateEDDSAPublicKey(
> pubBytes.clone());
> +        publicKey = EdDSASecurityProviderUtils.generateEDDSAPublicKey(
> pubBytes.clone());
>          msgBytes = BufferUtils.decodeHex(BufferUtils.EMPTY_HEX_SEPARATOR,
> msg);
>          expSignature = BufferUtils.decodeHex(BufferUtils.EMPTY_HEX_SEPARATOR,
> signature);
>      }
> @@ -200,14 +200,14 @@ public class Ed25519VectorsTest extends
> BaseTestSupport {
>
>      @Test
>      public void testSignature() throws Exception {
> -        Signature signer = EdDSASecurityProvider.getEDDSASignature();
> +        Signature signer = EdDSASecurityProviderUtils.
> getEDDSASignature();
>          signer.initSigner(privateKey);
>          signer.update(msgBytes.clone());
>
>          byte[] actSignature = signer.sign();
>          assertArrayEquals("Mismatched signature", expSignature,
> actSignature);
>
> -        Signature verifier = EdDSASecurityProvider.getEDDSASignature();
> +        Signature verifier = EdDSASecurityProviderUtils.
> getEDDSASignature();
>          verifier.initVerifier(publicKey);
>          verifier.update(msgBytes.clone());
>          assertTrue("Verification failed", verifier.verify(expSignature));
> @@ -222,14 +222,14 @@ public class Ed25519VectorsTest extends
> BaseTestSupport {
>          System.arraycopy(msgBytes, 0, dataBuf, offset, msgBytes.length);
>          System.arraycopy(extraData, offset, dataBuf, offset +
> msgBytes.length, extraData.length - offset);
>
> -        Signature signer = EdDSASecurityProvider.getEDDSASignature();
> +        Signature signer = EdDSASecurityProviderUtils.
> getEDDSASignature();
>          signer.initSigner(privateKey);
>          signer.update(dataBuf.clone(), offset, msgBytes.length);
>
>          byte[] actSignature = signer.sign();
>          assertArrayEquals("Mismatched signature", expSignature,
> actSignature);
>
> -        Signature verifier = EdDSASecurityProvider.getEDDSASignature();
> +        Signature verifier = EdDSASecurityProviderUtils.
> getEDDSASignature();
>          verifier.initVerifier(publicKey);
>          verifier.update(dataBuf.clone(), offset, msgBytes.length);
>          assertTrue("Verification failed", verifier.verify(expSignature));
>
> http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/
> cbb92d2a/sshd-core/src/test/java/org/apache/sshd/common/
> util/security/eddsa/EdDSASecurityProviderRegistrarTest.java
> ----------------------------------------------------------------------
> diff --git a/sshd-core/src/test/java/org/apache/sshd/common/util/
> security/eddsa/EdDSASecurityProviderRegistrarTest.java
> b/sshd-core/src/test/java/org/apache/sshd/common/util/security/eddsa/
> EdDSASecurityProviderRegistrarTest.java
> index 9e12fab..f2c1f3f 100644
> --- a/sshd-core/src/test/java/org/apache/sshd/common/util/security/eddsa/
> EdDSASecurityProviderRegistrarTest.java
> +++ b/sshd-core/src/test/java/org/apache/sshd/common/util/security/eddsa/
> EdDSASecurityProviderRegistrarTest.java
> @@ -26,6 +26,8 @@ import java.util.Arrays;
>  import java.util.Collection;
>  import java.util.HashSet;
>
> +import net.i2p.crypto.eddsa.EdDSASecurityProvider;
> +
>  import org.apache.sshd.common.util.security.SecurityProviderRegistrar;
>  import org.apache.sshd.common.util.security.
> SecurityProviderRegistrarTestSupport;
>  import org.apache.sshd.common.util.security.SecurityUtils;
>
>


-- 
------------------------
Guillaume Nodet

[2/2] mina-sshd git commit: Upgraded checkstyle version to 7.6

Posted by lg...@apache.org.
Upgraded checkstyle version to 7.6


Project: http://git-wip-us.apache.org/repos/asf/mina-sshd/repo
Commit: http://git-wip-us.apache.org/repos/asf/mina-sshd/commit/22dc7c3a
Tree: http://git-wip-us.apache.org/repos/asf/mina-sshd/tree/22dc7c3a
Diff: http://git-wip-us.apache.org/repos/asf/mina-sshd/diff/22dc7c3a

Branch: refs/heads/master
Commit: 22dc7c3a7b55a98530d9d7720d1d89d5097d2dd4
Parents: 8e25545
Author: Lyor Goldstein <ly...@gmail.com>
Authored: Thu Mar 2 21:32:08 2017 +0200
Committer: Lyor Goldstein <ly...@gmail.com>
Committed: Thu Mar 2 22:01:14 2017 +0200

----------------------------------------------------------------------
 .../client/ClientAuthenticationManager.java     |  2 +-
 .../java/org/apache/sshd/client/SshClient.java  |  6 ++---
 .../auth/hostbased/HostKeyIdentityProvider.java |  2 +-
 .../auth/password/PasswordIdentityProvider.java |  6 ++---
 .../DefaultConfigFileHostEntryResolver.java     |  2 +-
 .../client/config/hosts/HostConfigEntry.java    |  4 ++--
 .../client/config/hosts/HostPatternsHolder.java |  4 ++--
 .../sshd/client/scp/DefaultScpClient.java       |  2 +-
 .../sshd/client/subsystem/sftp/SftpClient.java  |  4 ++--
 .../subsystem/sftp/SftpVersionSelector.java     |  2 +-
 .../org/apache/sshd/common/channel/PtyMode.java |  4 ++--
 .../apache/sshd/common/channel/SttySupport.java |  2 +-
 .../keys/loader/KeyPairResourceParser.java      |  2 +-
 .../loader/PrivateKeyEncryptionContext.java     |  2 +-
 .../sshd/common/kex/KexFactoryManager.java      |  6 ++---
 .../common/keyprovider/FileKeyPairProvider.java |  2 +-
 .../common/keyprovider/KeyIdentityProvider.java |  4 ++--
 .../common/keyprovider/KeyPairProvider.java     |  2 +-
 .../keyprovider/MappedKeyPairProvider.java      |  2 +-
 .../org/apache/sshd/common/session/Session.java |  2 +-
 .../signature/SignatureFactoriesManager.java    |  2 +-
 .../apache/sshd/common/util/GenericUtils.java   | 16 ++++++-------
 .../apache/sshd/common/util/NumberUtils.java    | 20 ++++++++--------
 .../sshd/common/util/buffer/BufferUtils.java    | 10 ++++----
 .../keys/AbstractBufferPublicKeyParser.java     |  2 +-
 .../sshd/common/util/io/FileInfoExtractor.java  |  2 +-
 .../sshd/common/util/io/der/ASN1Object.java     |  4 ++--
 .../server/ServerAuthenticationManager.java     |  2 +-
 .../keys/AuthorizedKeysAuthenticator.java       |  2 +-
 .../server/session/AbstractServerSession.java   |  2 +-
 .../apache/sshd/server/shell/ProcessShell.java  |  2 +-
 .../sshd/server/shell/ProcessShellFactory.java  |  4 ++--
 .../server/subsystem/sftp/SftpSubsystem.java    | 24 ++++++++++----------
 .../client/subsystem/sftp/SftpVersionsTest.java |  4 ++--
 .../config/keys/AuthorizedKeysTestSupport.java  |  2 +-
 .../SecurityProviderRegistrarTestSupport.java   |  2 +-
 .../server/shell/InvertedShellWrapperTest.java  |  2 +-
 .../apache/sshd/util/test/BaseTestSupport.java  |  6 ++---
 .../sshd/server/auth/BaseAuthenticatorTest.java |  4 ++--
 39 files changed, 87 insertions(+), 87 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/22dc7c3a/sshd-core/src/main/java/org/apache/sshd/client/ClientAuthenticationManager.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/ClientAuthenticationManager.java b/sshd-core/src/main/java/org/apache/sshd/client/ClientAuthenticationManager.java
index 0e0ff05..c495c68 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/ClientAuthenticationManager.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/ClientAuthenticationManager.java
@@ -141,7 +141,7 @@ public interface ClientAuthenticationManager extends KeyPairProviderHolder {
     default void setUserAuthFactoriesNameList(String names) {
         setUserAuthFactoriesNames(GenericUtils.split(names, ','));
     }
-    default void setUserAuthFactoriesNames(String ... names) {
+    default void setUserAuthFactoriesNames(String... names) {
         setUserAuthFactoriesNames(GenericUtils.isEmpty((Object[]) names) ? Collections.emptyList() : Arrays.asList(names));
     }
     default void setUserAuthFactoriesNames(Collection<String> names) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/22dc7c3a/sshd-core/src/main/java/org/apache/sshd/client/SshClient.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/SshClient.java b/sshd-core/src/main/java/org/apache/sshd/client/SshClient.java
index 63755d2..d3f2f3f 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/SshClient.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/SshClient.java
@@ -535,7 +535,7 @@ public class SshClient extends AbstractFactoryManager implements ClientFactoryMa
         return doConnect(hostConfig.getUsername(), new InetSocketAddress(host, port), keys, !hostConfig.isIdentitiesOnly());
     }
 
-    protected List<KeyPair> loadClientIdentities(Collection<String> locations, LinkOption ... options) throws IOException {
+    protected List<KeyPair> loadClientIdentities(Collection<String> locations, LinkOption... options) throws IOException {
         if (GenericUtils.isEmpty(locations)) {
             return Collections.emptyList();
         }
@@ -1120,7 +1120,7 @@ public class SshClient extends AbstractFactoryManager implements ClientFactoryMa
         return current;
     }
 
-    public static Level resolveLoggingVerbosity(String ... args) {
+    public static Level resolveLoggingVerbosity(String... args) {
         return resolveLoggingVerbosity(args, GenericUtils.length(args));
     }
 
@@ -1139,7 +1139,7 @@ public class SshClient extends AbstractFactoryManager implements ClientFactoryMa
         return Level.WARNING;
     }
 
-    public static OutputStream resolveLoggingTargetStream(PrintStream stdout, PrintStream stderr, String ... args) {
+    public static OutputStream resolveLoggingTargetStream(PrintStream stdout, PrintStream stderr, String... args) {
         return resolveLoggingTargetStream(stdout, stderr, args, GenericUtils.length(args));
     }
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/22dc7c3a/sshd-core/src/main/java/org/apache/sshd/client/auth/hostbased/HostKeyIdentityProvider.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/auth/hostbased/HostKeyIdentityProvider.java b/sshd-core/src/main/java/org/apache/sshd/client/auth/hostbased/HostKeyIdentityProvider.java
index 1632fc7..62206a1 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/auth/hostbased/HostKeyIdentityProvider.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/auth/hostbased/HostKeyIdentityProvider.java
@@ -42,7 +42,7 @@ public interface HostKeyIdentityProvider {
         return GenericUtils.iteratorOf((provider == null) ? null : provider.loadHostKeys());
     }
 
-    static HostKeyIdentityProvider wrap(KeyPair ... pairs) {
+    static HostKeyIdentityProvider wrap(KeyPair... pairs) {
         return wrap(GenericUtils.asList(pairs));
     }
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/22dc7c3a/sshd-core/src/main/java/org/apache/sshd/client/auth/password/PasswordIdentityProvider.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/auth/password/PasswordIdentityProvider.java b/sshd-core/src/main/java/org/apache/sshd/client/auth/password/PasswordIdentityProvider.java
index a6263ec..1662764 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/auth/password/PasswordIdentityProvider.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/auth/password/PasswordIdentityProvider.java
@@ -132,7 +132,7 @@ public interface PasswordIdentityProvider {
      * @return The wrapping provider
      * @see #multiProvider(Collection)
      */
-    static PasswordIdentityProvider multiProvider(PasswordIdentityProvider ... providers) {
+    static PasswordIdentityProvider multiProvider(PasswordIdentityProvider... providers) {
         return multiProvider(GenericUtils.asList(providers));
     }
 
@@ -166,7 +166,7 @@ public interface PasswordIdentityProvider {
      * (i.e., returns {@link #EMPTY_PASSWORDS_PROVIDER})
      * @return The provider wrapper
      */
-    static PasswordIdentityProvider wrap(String ... passwords) {
+    static PasswordIdentityProvider wrap(String... passwords) {
         return wrap(GenericUtils.asList(passwords));
     }
 
@@ -177,7 +177,7 @@ public interface PasswordIdentityProvider {
      * (i.e., returns {@link #EMPTY_PASSWORDS_PROVIDER})
      * @return The provider wrapper
      */
-    static PasswordIdentityProvider wrap(final Iterable<String> passwords) {
+    static PasswordIdentityProvider wrap(Iterable<String> passwords) {
         return (passwords == null) ? EMPTY_PASSWORDS_PROVIDER : () -> passwords;
     }
 }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/22dc7c3a/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/DefaultConfigFileHostEntryResolver.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/DefaultConfigFileHostEntryResolver.java b/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/DefaultConfigFileHostEntryResolver.java
index 954dc50..e04cad6 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/DefaultConfigFileHostEntryResolver.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/DefaultConfigFileHostEntryResolver.java
@@ -59,7 +59,7 @@ public class DefaultConfigFileHostEntryResolver extends ConfigFileHostEntryResol
         this(Objects.requireNonNull(file, "No file provided").toPath(), strict, IoUtils.getLinkOptions(false));
     }
 
-    public DefaultConfigFileHostEntryResolver(Path path, boolean strict, LinkOption ... options) {
+    public DefaultConfigFileHostEntryResolver(Path path, boolean strict, LinkOption... options) {
         super(path, options);
         this.strict = strict;
     }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/22dc7c3a/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/HostConfigEntry.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/HostConfigEntry.java b/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/HostConfigEntry.java
index 1eed0c6..c17c6ce 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/HostConfigEntry.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/HostConfigEntry.java
@@ -639,7 +639,7 @@ public class HostConfigEntry extends HostPatternsHolder implements MutableUserHo
      * @throws IOException If failed to append the requested data
      * @see #appendNonEmptyValues(Appendable, String, Collection)
      */
-    public static <A extends Appendable> A appendNonEmptyValues(A sb, String name, Object ... values) throws IOException {
+    public static <A extends Appendable> A appendNonEmptyValues(A sb, String name, Object... values) throws IOException {
         return appendNonEmptyValues(sb, name, GenericUtils.isEmpty(values) ? Collections.emptyList() : Arrays.asList(values));
     }
 
@@ -1011,7 +1011,7 @@ public class HostConfigEntry extends HostPatternsHolder implements MutableUserHo
         writeHostConfigEntries(Objects.requireNonNull(file, "No file").toPath(), entries, IoUtils.EMPTY_OPEN_OPTIONS);
     }
 
-    public static void writeHostConfigEntries(Path path, Collection<? extends HostConfigEntry> entries, OpenOption ... options) throws IOException {
+    public static void writeHostConfigEntries(Path path, Collection<? extends HostConfigEntry> entries, OpenOption... options) throws IOException {
         try (OutputStream outputStream = Files.newOutputStream(path, options)) {
             writeHostConfigEntries(outputStream, true, entries);
         }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/22dc7c3a/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/HostPatternsHolder.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/HostPatternsHolder.java b/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/HostPatternsHolder.java
index e81d01c..a3e20ab 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/HostPatternsHolder.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/config/hosts/HostPatternsHolder.java
@@ -113,7 +113,7 @@ public abstract class HostPatternsHolder {
      * @return A {@link List} of all the matching entries
      * @see #isHostMatch(String)
      */
-    public static List<HostConfigEntry> findMatchingEntries(String host, HostConfigEntry ... entries) {
+    public static List<HostConfigEntry> findMatchingEntries(String host, HostConfigEntry... entries) {
         // TODO in Java-8 use Stream(s) + predicate
         if (GenericUtils.isEmpty(host) || GenericUtils.isEmpty(entries)) {
             return Collections.emptyList();
@@ -207,7 +207,7 @@ public abstract class HostPatternsHolder {
         return m.matches();
     }
 
-    public static List<Pair<Pattern, Boolean>> parsePatterns(CharSequence ... patterns) {
+    public static List<Pair<Pattern, Boolean>> parsePatterns(CharSequence... patterns) {
         return parsePatterns(GenericUtils.isEmpty(patterns) ? Collections.emptyList() : Arrays.asList(patterns));
     }
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/22dc7c3a/sshd-core/src/main/java/org/apache/sshd/client/scp/DefaultScpClient.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/scp/DefaultScpClient.java b/sshd-core/src/main/java/org/apache/sshd/client/scp/DefaultScpClient.java
index c06210f..854929a 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/scp/DefaultScpClient.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/scp/DefaultScpClient.java
@@ -178,7 +178,7 @@ public class DefaultScpClient extends AbstractScpClient {
         return true;
     }
 
-    private static String[] normalizeCommandArguments(PrintStream stdout, PrintStream stderr, String ... args) {
+    private static String[] normalizeCommandArguments(PrintStream stdout, PrintStream stderr, String... args) {
         int numArgs = GenericUtils.length(args);
         if (numArgs <= 0) {
             return args;

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/22dc7c3a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpClient.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpClient.java b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpClient.java
index 68e40e6..bda565d 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpClient.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpClient.java
@@ -808,7 +808,7 @@ public interface SftpClient extends SubsystemClient {
     // High level API
     //
 
-    default SftpRemotePathChannel openRemotePathChannel(String path, OpenOption ... options) throws IOException {
+    default SftpRemotePathChannel openRemotePathChannel(String path, OpenOption... options) throws IOException {
         return openRemotePathChannel(path, GenericUtils.isEmpty(options) ? Collections.emptyList() : Arrays.asList(options));
     }
 
@@ -816,7 +816,7 @@ public interface SftpClient extends SubsystemClient {
         return openRemoteFileChannel(path, OpenMode.fromOpenOptions(options));
     }
 
-    default SftpRemotePathChannel openRemoteFileChannel(String path, OpenMode ... modes) throws IOException {
+    default SftpRemotePathChannel openRemoteFileChannel(String path, OpenMode... modes) throws IOException {
         return openRemoteFileChannel(path, GenericUtils.isEmpty(modes) ? Collections.emptyList() : Arrays.asList(modes));
     }
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/22dc7c3a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpVersionSelector.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpVersionSelector.java b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpVersionSelector.java
index efa5dbe..83a7964 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpVersionSelector.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpVersionSelector.java
@@ -83,7 +83,7 @@ public interface SftpVersionSelector {
      * @return A {@link SftpVersionSelector} that attempts to select
      * the most preferred version that is also listed as available.
      */
-    static SftpVersionSelector preferredVersionSelector(final int ... preferred) {
+    static SftpVersionSelector preferredVersionSelector(final int... preferred) {
         return preferredVersionSelector(NumberUtils.asList(preferred));
 
     }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/22dc7c3a/sshd-core/src/main/java/org/apache/sshd/common/channel/PtyMode.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/channel/PtyMode.java b/sshd-core/src/main/java/org/apache/sshd/common/channel/PtyMode.java
index f58f4cc..9dac896 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/channel/PtyMode.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/channel/PtyMode.java
@@ -320,7 +320,7 @@ public enum PtyMode {
      * @param options The options to enable - ignored if {@code null}/empty
      * @return A {@link Map} where all the specified {@link PtyMode}s have {@link #TRUE_SETTING}
      */
-    public static Map<PtyMode, Integer> createEnabledOptions(PtyMode ... options) {
+    public static Map<PtyMode, Integer> createEnabledOptions(PtyMode... options) {
         return createEnabledOptions(GenericUtils.of(options));
     }
 
@@ -341,7 +341,7 @@ public enum PtyMode {
         return modes;
     }
 
-    public static Set<PtyMode> resolveEnabledOptions(Map<PtyMode, ?> modes, PtyMode ... options) {
+    public static Set<PtyMode> resolveEnabledOptions(Map<PtyMode, ?> modes, PtyMode... options) {
         return resolveEnabledOptions(modes, GenericUtils.of(options));
     }
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/22dc7c3a/sshd-core/src/main/java/org/apache/sshd/common/channel/SttySupport.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/channel/SttySupport.java b/sshd-core/src/main/java/org/apache/sshd/common/channel/SttySupport.java
index 11676e2..b2f712b 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/channel/SttySupport.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/channel/SttySupport.java
@@ -258,7 +258,7 @@ public final class SttySupport {
      * @throws IOException If failed to execute the command
      * @throws InterruptedException If interrupted while awaiting command execution
      */
-    private static String exec(String ... cmd)
+    private static String exec(String... cmd)
             throws IOException, InterruptedException {
         try (ByteArrayOutputStream bout = new ByteArrayOutputStream()) {
             Process p = Runtime.getRuntime().exec(cmd);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/22dc7c3a/sshd-core/src/main/java/org/apache/sshd/common/config/keys/loader/KeyPairResourceParser.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/config/keys/loader/KeyPairResourceParser.java b/sshd-core/src/main/java/org/apache/sshd/common/config/keys/loader/KeyPairResourceParser.java
index e3336ad..88dd2bd 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/config/keys/loader/KeyPairResourceParser.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/config/keys/loader/KeyPairResourceParser.java
@@ -141,7 +141,7 @@ public interface KeyPairResourceParser extends KeyPairResourceLoader {
         return null;
     }
 
-    static KeyPairResourceParser aggregate(KeyPairResourceParser ... parsers) {
+    static KeyPairResourceParser aggregate(KeyPairResourceParser... parsers) {
         return aggregate(Arrays.asList(ValidateUtils.checkNotNullAndNotEmpty(parsers, "No parsers to aggregate")));
     }
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/22dc7c3a/sshd-core/src/main/java/org/apache/sshd/common/config/keys/loader/PrivateKeyEncryptionContext.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/config/keys/loader/PrivateKeyEncryptionContext.java b/sshd-core/src/main/java/org/apache/sshd/common/config/keys/loader/PrivateKeyEncryptionContext.java
index d7ce237..b935460 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/config/keys/loader/PrivateKeyEncryptionContext.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/config/keys/loader/PrivateKeyEncryptionContext.java
@@ -101,7 +101,7 @@ public class PrivateKeyEncryptionContext implements Cloneable {
         return initVector;
     }
 
-    public void setInitVector(byte ... values) {
+    public void setInitVector(byte... values) {
         initVector = values;
     }
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/22dc7c3a/sshd-core/src/main/java/org/apache/sshd/common/kex/KexFactoryManager.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/kex/KexFactoryManager.java b/sshd-core/src/main/java/org/apache/sshd/common/kex/KexFactoryManager.java
index 1559858..898b5c5 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/kex/KexFactoryManager.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/kex/KexFactoryManager.java
@@ -67,7 +67,7 @@ public interface KexFactoryManager extends KeyPairProviderHolder, SignatureFacto
     default void setCipherFactoriesNameList(String names) {
         setCipherFactoriesNames(GenericUtils.split(names, ','));
     }
-    default void setCipherFactoriesNames(String ... names) {
+    default void setCipherFactoriesNames(String... names) {
         setCipherFactoriesNames(GenericUtils.isEmpty((Object[]) names) ? Collections.emptyList() : Arrays.asList(names));
     }
     default void setCipherFactoriesNames(Collection<String> names) {
@@ -97,7 +97,7 @@ public interface KexFactoryManager extends KeyPairProviderHolder, SignatureFacto
     default void setCompressionFactoriesNameList(String names) {
         setCompressionFactoriesNames(GenericUtils.split(names, ','));
     }
-    default void setCompressionFactoriesNames(String ... names) {
+    default void setCompressionFactoriesNames(String... names) {
         setCompressionFactoriesNames(GenericUtils.isEmpty((Object[]) names) ? Collections.emptyList() : Arrays.asList(names));
     }
     default void setCompressionFactoriesNames(Collection<String> names) {
@@ -127,7 +127,7 @@ public interface KexFactoryManager extends KeyPairProviderHolder, SignatureFacto
     default void setMacFactoriesNameList(String names) {
         setMacFactoriesNames(GenericUtils.split(names, ','));
     }
-    default void setMacFactoriesNames(String ... names) {
+    default void setMacFactoriesNames(String... names) {
         setMacFactoriesNames(GenericUtils.isEmpty((Object[]) names) ? Collections.emptyList() : Arrays.asList(names));
     }
     default void setMacFactoriesNames(Collection<String> names) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/22dc7c3a/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/FileKeyPairProvider.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/FileKeyPairProvider.java b/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/FileKeyPairProvider.java
index 9d3ac50..c4aae97 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/FileKeyPairProvider.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/FileKeyPairProvider.java
@@ -52,7 +52,7 @@ public class FileKeyPairProvider extends AbstractResourceKeyPairProvider<Path> {
         this(Collections.singletonList(Objects.requireNonNull(path, "No path provided")));
     }
 
-    public FileKeyPairProvider(Path ... files) {
+    public FileKeyPairProvider(Path... files) {
         this(Arrays.asList(files));
     }
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/22dc7c3a/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/KeyIdentityProvider.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/KeyIdentityProvider.java b/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/KeyIdentityProvider.java
index 70d436c..c8cddfa 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/KeyIdentityProvider.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/KeyIdentityProvider.java
@@ -134,7 +134,7 @@ public interface KeyIdentityProvider {
      * @return The wrapping provider
      * @see #multiProvider(Collection)
      */
-    static KeyIdentityProvider multiProvider(KeyIdentityProvider ... providers) {
+    static KeyIdentityProvider multiProvider(KeyIdentityProvider... providers) {
         return multiProvider(GenericUtils.asList(providers));
     }
 
@@ -169,7 +169,7 @@ public interface KeyIdentityProvider {
      * {@link #EMPTY_KEYS_PROVIDER}).
      * @return The provider wrapper
      */
-    static KeyIdentityProvider wrap(KeyPair ... pairs) {
+    static KeyIdentityProvider wrap(KeyPair... pairs) {
         return wrap(GenericUtils.asList(pairs));
     }
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/22dc7c3a/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/KeyPairProvider.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/KeyPairProvider.java b/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/KeyPairProvider.java
index e7d2b7d..a816304 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/KeyPairProvider.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/KeyPairProvider.java
@@ -129,7 +129,7 @@ public interface KeyPairProvider extends KeyIdentityProvider {
      * @return The provider wrapper
      * @see #wrap(Iterable)
      */
-    static KeyPairProvider wrap(KeyPair ... pairs) {
+    static KeyPairProvider wrap(KeyPair... pairs) {
         return GenericUtils.isEmpty(pairs) ? EMPTY_KEYPAIR_PROVIDER : wrap(Arrays.asList(pairs));
     }
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/22dc7c3a/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/MappedKeyPairProvider.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/MappedKeyPairProvider.java b/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/MappedKeyPairProvider.java
index bc4772d..bf3ec8b 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/MappedKeyPairProvider.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/MappedKeyPairProvider.java
@@ -48,7 +48,7 @@ public class MappedKeyPairProvider implements KeyPairProvider {
 
     private final Map<String, KeyPair> pairsMap;
 
-    public MappedKeyPairProvider(KeyPair ... pairs) {
+    public MappedKeyPairProvider(KeyPair... pairs) {
         this(GenericUtils.isEmpty(pairs) ? Collections.emptyList() : Arrays.asList(pairs));
     }
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/22dc7c3a/sshd-core/src/main/java/org/apache/sshd/common/session/Session.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/session/Session.java b/sshd-core/src/main/java/org/apache/sshd/common/session/Session.java
index d9fca41..2e7e27f 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/session/Session.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/session/Session.java
@@ -189,7 +189,7 @@ public interface Session
      * @throws IOException if an error occurred when encoding sending the packet
      * @see <A HREF="https://tools.ietf.org/html/rfc4253#section-11.2">RFC 4253 - section 11.2</A>
      */
-    IoWriteFuture sendIgnoreMessage(byte ... data) throws IOException;
+    IoWriteFuture sendIgnoreMessage(byte... data) throws IOException;
 
     /**
      * Encode and send the given buffer.

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/22dc7c3a/sshd-core/src/main/java/org/apache/sshd/common/signature/SignatureFactoriesManager.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/signature/SignatureFactoriesManager.java b/sshd-core/src/main/java/org/apache/sshd/common/signature/SignatureFactoriesManager.java
index 2509a39..3b2d712 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/signature/SignatureFactoriesManager.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/signature/SignatureFactoriesManager.java
@@ -50,7 +50,7 @@ public interface SignatureFactoriesManager {
     default void setSignatureFactoriesNameList(String names) {
         setSignatureFactoriesNames(GenericUtils.split(names, ','));
     }
-    default void setSignatureFactoriesNames(String ... names) {
+    default void setSignatureFactoriesNames(String... names) {
         setSignatureFactoriesNames(GenericUtils.isEmpty((Object[]) names) ? Collections.emptyList() : Arrays.asList(names));
     }
     default void setSignatureFactoriesNames(Collection<String> names) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/22dc7c3a/sshd-core/src/main/java/org/apache/sshd/common/util/GenericUtils.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/GenericUtils.java b/sshd-core/src/main/java/org/apache/sshd/common/util/GenericUtils.java
index 852cba6..82d78d1 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/GenericUtils.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/GenericUtils.java
@@ -430,7 +430,7 @@ public final class GenericUtils {
     }
 
     @SafeVarargs
-    public static <T> List<T> unmodifiableList(T ... values) {
+    public static <T> List<T> unmodifiableList(T... values) {
         return unmodifiableList(asList(values));
     }
 
@@ -447,17 +447,17 @@ public final class GenericUtils {
     }
 
     @SafeVarargs
-    public static <T> List<T> asList(T ... values) {
+    public static <T> List<T> asList(T... values) {
         return isEmpty(values) ? Collections.emptyList() : Arrays.asList(values);
     }
 
     @SafeVarargs
-    public static <T> Set<T> asSet(T ... values) {
+    public static <T> Set<T> asSet(T... values) {
         return new HashSet<>(asList(values));
     }
 
     @SafeVarargs
-    public static <V extends Comparable<V>> SortedSet<V> asSortedSet(V ... values) {
+    public static <V extends Comparable<V>> SortedSet<V> asSortedSet(V... values) {
         return asSortedSet(Comparator.naturalOrder(), values);
     }
 
@@ -473,7 +473,7 @@ public final class GenericUtils {
      * using the provided comparator
      */
     @SafeVarargs
-    public static <V> SortedSet<V> asSortedSet(Comparator<? super V> comp, V ... values) {
+    public static <V> SortedSet<V> asSortedSet(Comparator<? super V> comp, V... values) {
         return asSortedSet(comp, isEmpty(values) ? Collections.emptyList() : Arrays.asList(values));
     }
 
@@ -520,7 +520,7 @@ public final class GenericUtils {
 
     @SafeVarargs
     public static <K, V> Map<K, V> mapValues(
-            Function<? super V, ? extends K> keyMapper, Supplier<? extends Map<K, V>> mapCreator, V ... values) {
+            Function<? super V, ? extends K> keyMapper, Supplier<? extends Map<K, V>> mapCreator, V... values) {
         return mapValues(keyMapper, mapCreator, isEmpty(values) ? Collections.emptyList() : Arrays.asList(values));
     }
 
@@ -556,7 +556,7 @@ public final class GenericUtils {
     }
 
     @SafeVarargs
-    public static <T> T findFirstMatchingMember(Predicate<? super T> acceptor, T ... values) {
+    public static <T> T findFirstMatchingMember(Predicate<? super T> acceptor, T... values) {
         return findFirstMatchingMember(acceptor, isEmpty(values) ? Collections.emptyList() : Arrays.asList(values));
     }
 
@@ -574,7 +574,7 @@ public final class GenericUtils {
      * @return A {@link List} of all the values that were accepted by the predicate
      */
     @SafeVarargs
-    public static <T> List<T> selectMatchingMembers(Predicate<? super T> acceptor, T ... values) {
+    public static <T> List<T> selectMatchingMembers(Predicate<? super T> acceptor, T... values) {
         return selectMatchingMembers(acceptor, isEmpty(values) ? Collections.emptyList() : Arrays.asList(values));
     }
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/22dc7c3a/sshd-core/src/main/java/org/apache/sshd/common/util/NumberUtils.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/NumberUtils.java b/sshd-core/src/main/java/org/apache/sshd/common/util/NumberUtils.java
index a808d5d..b1aed93 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/NumberUtils.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/NumberUtils.java
@@ -77,15 +77,15 @@ public final class NumberUtils {
         return j;
     }
 
-    public static int hashCode(long ... values) {
+    public static int hashCode(long... values) {
         return Arrays.hashCode(values);
     }
 
-    public static int hashCode(int ... values) {
+    public static int hashCode(int... values) {
         return Arrays.hashCode(values);
     }
 
-    public static int hashCode(byte ... values) {
+    public static int hashCode(byte... values) {
         return Arrays.hashCode(values);
     }
 
@@ -149,7 +149,7 @@ public final class NumberUtils {
         }
     }
 
-    public static String join(CharSequence separator, long ... values) {
+    public static String join(CharSequence separator, long... values) {
         if (NumberUtils.isEmpty(values)) {
             return "";
         }
@@ -165,7 +165,7 @@ public final class NumberUtils {
         return sb.toString();
     }
 
-    public static String join(char separator, long ... values) {
+    public static String join(char separator, long... values) {
         if (NumberUtils.isEmpty(values)) {
             return "";
         }
@@ -181,7 +181,7 @@ public final class NumberUtils {
         return sb.toString();
     }
 
-    public static String join(CharSequence separator, boolean unsigned, byte ... values) {
+    public static String join(CharSequence separator, boolean unsigned, byte... values) {
         if (NumberUtils.isEmpty(values)) {
             return "";
         }
@@ -197,7 +197,7 @@ public final class NumberUtils {
         return sb.toString();
     }
 
-    public static String join(char separator, boolean unsigned, byte ... values) {
+    public static String join(char separator, boolean unsigned, byte... values) {
         if (NumberUtils.isEmpty(values)) {
             return "";
         }
@@ -213,7 +213,7 @@ public final class NumberUtils {
         return sb.toString();
     }
 
-    public static String join(CharSequence separator, int ... values) {
+    public static String join(CharSequence separator, int... values) {
         if (NumberUtils.isEmpty(values)) {
             return "";
         }
@@ -229,7 +229,7 @@ public final class NumberUtils {
         return sb.toString();
     }
 
-    public static String join(char separator, int ... values) {
+    public static String join(char separator, int... values) {
         if (NumberUtils.isEmpty(values)) {
             return "";
         }
@@ -269,7 +269,7 @@ public final class NumberUtils {
         return a == null ? 0 : a.length;
     }
 
-    public static List<Integer> asList(int ... values) {
+    public static List<Integer> asList(int... values) {
         int len = length(values);
         if (len <= 0) {
             return Collections.emptyList();

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/22dc7c3a/sshd-core/src/main/java/org/apache/sshd/common/util/buffer/BufferUtils.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/buffer/BufferUtils.java b/sshd-core/src/main/java/org/apache/sshd/common/util/buffer/BufferUtils.java
index b0b6681..e04da4d 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/buffer/BufferUtils.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/buffer/BufferUtils.java
@@ -66,7 +66,7 @@ public final class BufferUtils {
         throw new UnsupportedOperationException("No instance allowed");
     }
 
-    public static void dumpHex(SimplifiedLog logger, Level level, String prefix, PropertyResolver resolver, char sep, byte ... data) {
+    public static void dumpHex(SimplifiedLog logger, Level level, String prefix, PropertyResolver resolver, char sep, byte... data) {
         dumpHex(logger, level, prefix, resolver, sep, data, 0, NumberUtils.length(data));
     }
 
@@ -74,7 +74,7 @@ public final class BufferUtils {
         dumpHex(logger, level, prefix, sep, PropertyResolverUtils.getIntProperty(resolver, HEXDUMP_CHUNK_SIZE, DEFAULT_HEXDUMP_CHUNK_SIZE), data, offset, len);
     }
 
-    public static void dumpHex(SimplifiedLog logger, Level level, String prefix, char sep, int chunkSize, byte ... data) {
+    public static void dumpHex(SimplifiedLog logger, Level level, String prefix, char sep, int chunkSize, byte... data) {
         dumpHex(logger, level, prefix, sep, chunkSize, data, 0, NumberUtils.length(data));
     }
 
@@ -148,7 +148,7 @@ public final class BufferUtils {
         }
     }
 
-    public static <A extends Appendable> A appendHex(A sb, char sep, byte ... array) throws IOException {
+    public static <A extends Appendable> A appendHex(A sb, char sep, byte... array) throws IOException {
         return appendHex(sb, array, 0, NumberUtils.length(array), sep);
     }
 
@@ -573,7 +573,7 @@ public final class BufferUtils {
         return value;
     }
 
-    public static long validateInt32Value(long value, String format, Object ... args) {
+    public static long validateInt32Value(long value, String format, Object... args) {
         ValidateUtils.checkTrue(isValidInt32Value(value), format, args);
         return value;
     }
@@ -592,7 +592,7 @@ public final class BufferUtils {
         return value;
     }
 
-    public static long validateUint32Value(long value, String format, Object ... args) {
+    public static long validateUint32Value(long value, String format, Object... args) {
         ValidateUtils.checkTrue(isValidUint32Value(value), format, args);
         return value;
     }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/22dc7c3a/sshd-core/src/main/java/org/apache/sshd/common/util/buffer/keys/AbstractBufferPublicKeyParser.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/buffer/keys/AbstractBufferPublicKeyParser.java b/sshd-core/src/main/java/org/apache/sshd/common/util/buffer/keys/AbstractBufferPublicKeyParser.java
index 547f8b8..aaf9641 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/buffer/keys/AbstractBufferPublicKeyParser.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/buffer/keys/AbstractBufferPublicKeyParser.java
@@ -41,7 +41,7 @@ public abstract class AbstractBufferPublicKeyParser<PUB extends PublicKey> imple
     private final Class<PUB> keyClass;
     private final Collection<String> supported;
 
-    protected AbstractBufferPublicKeyParser(Class<PUB> keyClass, String ... supported) {
+    protected AbstractBufferPublicKeyParser(Class<PUB> keyClass, String... supported) {
         this(keyClass, GenericUtils.isEmpty(supported) ? Collections.emptyList() : Arrays.asList(supported));
     }
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/22dc7c3a/sshd-core/src/main/java/org/apache/sshd/common/util/io/FileInfoExtractor.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/io/FileInfoExtractor.java b/sshd-core/src/main/java/org/apache/sshd/common/util/io/FileInfoExtractor.java
index 3e84470..feafd18 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/io/FileInfoExtractor.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/io/FileInfoExtractor.java
@@ -48,6 +48,6 @@ public interface FileInfoExtractor<T> {
 
     FileInfoExtractor<FileTime> LASTMODIFIED = Files::getLastModifiedTime;
 
-    T infoOf(Path file, LinkOption ... options) throws IOException;
+    T infoOf(Path file, LinkOption... options) throws IOException;
 
 }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/22dc7c3a/sshd-core/src/main/java/org/apache/sshd/common/util/io/der/ASN1Object.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/io/der/ASN1Object.java b/sshd-core/src/main/java/org/apache/sshd/common/util/io/der/ASN1Object.java
index a5f54a8..1d32a40 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/io/der/ASN1Object.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/io/der/ASN1Object.java
@@ -60,11 +60,11 @@ public class ASN1Object implements Serializable, Cloneable {
      *-------------------------------------------------
      * </pre>
      */
-    public ASN1Object(byte tag, int len, byte ... data) {
+    public ASN1Object(byte tag, int len, byte... data) {
         this(ASN1Class.fromDERValue(tag), ASN1Type.fromDERValue(tag), (tag & CONSTRUCTED) == CONSTRUCTED, len, data);
     }
 
-    public ASN1Object(ASN1Class c, ASN1Type t, boolean ctored, int len, byte ... data) {
+    public ASN1Object(ASN1Class c, ASN1Type t, boolean ctored, int len, byte... data) {
         objClass = c;
         objType = t;
         constructed = ctored;

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/22dc7c3a/sshd-core/src/main/java/org/apache/sshd/server/ServerAuthenticationManager.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/ServerAuthenticationManager.java b/sshd-core/src/main/java/org/apache/sshd/server/ServerAuthenticationManager.java
index 66ea9ff..87e7fcd 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/ServerAuthenticationManager.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/ServerAuthenticationManager.java
@@ -168,7 +168,7 @@ public interface ServerAuthenticationManager {
     default void setUserAuthFactoriesNameList(String names) {
         setUserAuthFactoriesNames(GenericUtils.split(names, ','));
     }
-    default void setUserAuthFactoriesNames(String ... names) {
+    default void setUserAuthFactoriesNames(String... names) {
         setUserAuthFactoriesNames(GenericUtils.isEmpty((Object[]) names) ? Collections.emptyList() : Arrays.asList(names));
     }
     default void setUserAuthFactoriesNames(Collection<String> names) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/22dc7c3a/sshd-core/src/main/java/org/apache/sshd/server/config/keys/AuthorizedKeysAuthenticator.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/config/keys/AuthorizedKeysAuthenticator.java b/sshd-core/src/main/java/org/apache/sshd/server/config/keys/AuthorizedKeysAuthenticator.java
index 9bce5bc..0cdf191 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/config/keys/AuthorizedKeysAuthenticator.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/config/keys/AuthorizedKeysAuthenticator.java
@@ -163,7 +163,7 @@ public class AuthorizedKeysAuthenticator extends ModifiableFileWatcher implement
      * or empty if file does not exist
      * @throws IOException If failed to read keys from file
      */
-    public static List<AuthorizedKeyEntry> readDefaultAuthorizedKeys(OpenOption ... options) throws IOException {
+    public static List<AuthorizedKeyEntry> readDefaultAuthorizedKeys(OpenOption... options) throws IOException {
         Path keysFile = getDefaultAuthorizedKeysFile();
         if (Files.exists(keysFile, IoUtils.EMPTY_LINK_OPTIONS)) {
             return AuthorizedKeyEntry.readAuthorizedKeys(keysFile);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/22dc7c3a/sshd-core/src/main/java/org/apache/sshd/server/session/AbstractServerSession.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/session/AbstractServerSession.java b/sshd-core/src/main/java/org/apache/sshd/server/session/AbstractServerSession.java
index c34a5a8..29c29e8 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/session/AbstractServerSession.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/session/AbstractServerSession.java
@@ -168,7 +168,7 @@ public abstract class AbstractServerSession extends AbstractSession implements S
      * identification data being written successfully or failing
      * @see <A HREF="https://tools.ietf.org/html/rfc4253#section-4.2">RFC 4253 - section 4.2</A>
      */
-    protected IoWriteFuture sendServerIdentification(String ... headerLines) {
+    protected IoWriteFuture sendServerIdentification(String... headerLines) {
         serverVersion = resolveIdentificationString(ServerFactoryManager.SERVER_IDENTIFICATION);
 
         String ident = serverVersion;

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/22dc7c3a/sshd-core/src/main/java/org/apache/sshd/server/shell/ProcessShell.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/shell/ProcessShell.java b/sshd-core/src/main/java/org/apache/sshd/server/shell/ProcessShell.java
index f4b5717..2b4a023 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/shell/ProcessShell.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/shell/ProcessShell.java
@@ -57,7 +57,7 @@ public class ProcessShell extends AbstractLoggingBean implements InvertedShell,
      * @param command    The command components which when joined (with space separator)
      *                   create the full command to be executed by the shell
      */
-    public ProcessShell(String ... command) {
+    public ProcessShell(String... command) {
         this(GenericUtils.isEmpty(command) ? Collections.emptyList() : Arrays.asList(command));
     }
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/22dc7c3a/sshd-core/src/main/java/org/apache/sshd/server/shell/ProcessShellFactory.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/shell/ProcessShellFactory.java b/sshd-core/src/main/java/org/apache/sshd/server/shell/ProcessShellFactory.java
index c10c5ec..1bd34cd 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/shell/ProcessShellFactory.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/shell/ProcessShellFactory.java
@@ -42,7 +42,7 @@ public class ProcessShellFactory extends AbstractLoggingBean implements Factory<
         this(Collections.emptyList());
     }
 
-    public ProcessShellFactory(String ... command) {
+    public ProcessShellFactory(String... command) {
         this(GenericUtils.isEmpty(command) ? Collections.emptyList() : Arrays.asList(command));
     }
 
@@ -54,7 +54,7 @@ public class ProcessShellFactory extends AbstractLoggingBean implements Factory<
         return command;
     }
 
-    public void setCommand(String ... command) {
+    public void setCommand(String... command) {
         setCommand(GenericUtils.isEmpty(command) ? Collections.emptyList() : Arrays.asList(command));
     }
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/22dc7c3a/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/SftpSubsystem.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/SftpSubsystem.java b/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/SftpSubsystem.java
index fb41d33..c10bcce 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/SftpSubsystem.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/SftpSubsystem.java
@@ -2832,7 +2832,7 @@ public class SftpSubsystem
      * @throws IOException If failed to access the file
      * @see #resolveMissingFileAttributes(Path, int, Map, LinkOption...)
      */
-    protected Map<String, Object> getAttributes(Path file, int flags, LinkOption ... options) throws IOException {
+    protected Map<String, Object> getAttributes(Path file, int flags, LinkOption... options) throws IOException {
         FileSystem           fs = file.getFileSystem();
         Collection<String>   supportedViews = fs.supportedFileAttributeViews();
         Map<String, Object>  attrs = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
@@ -2881,7 +2881,7 @@ public class SftpSubsystem
      * an <U>error</U> is returned to the SFTP client
      * @see #FILEATTRS_RESOLVERS
      */
-    protected Map<String, Object> resolveMissingFileAttributes(Path file, int flags, Map<String, Object> current, LinkOption ... options) throws IOException {
+    protected Map<String, Object> resolveMissingFileAttributes(Path file, int flags, Map<String, Object> current, LinkOption... options) throws IOException {
         Map<String, Object> attrs = null;
         // Cannot use forEach because the attrs variable is not effectively final
         for (Map.Entry<String, FileInfoExtractor<?>> re : FILEATTRS_RESOLVERS.entrySet()) {
@@ -2923,7 +2923,7 @@ public class SftpSubsystem
         }
     }
 
-    protected Object resolveMissingFileAttributeValue(Path file, String name, Object value, FileInfoExtractor<?> x, LinkOption ... options) throws IOException {
+    protected Object resolveMissingFileAttributeValue(Path file, String name, Object value, FileInfoExtractor<?> x, LinkOption... options) throws IOException {
         if (value != null) {
             return value;
         } else {
@@ -2931,7 +2931,7 @@ public class SftpSubsystem
         }
     }
 
-    protected Map<String, Object> addMissingAttribute(Path file, Map<String, Object> current, String name, FileInfoExtractor<?> x, LinkOption ... options) throws IOException {
+    protected Map<String, Object> addMissingAttribute(Path file, Map<String, Object> current, String name, FileInfoExtractor<?> x, LinkOption... options) throws IOException {
         Object value = GenericUtils.isEmpty(current) ? null : current.get(name);
         if (value != null) {    // already have the value
             return current;
@@ -2951,7 +2951,7 @@ public class SftpSubsystem
         return current;
     }
 
-    protected Map<String, Object> readFileAttributes(Path file, String view, LinkOption ... options) throws IOException {
+    protected Map<String, Object> readFileAttributes(Path file, String view, LinkOption... options) throws IOException {
         try {
             return Files.readAttributes(file, view, options);
         } catch (IOException e) {
@@ -2994,7 +2994,7 @@ public class SftpSubsystem
         listener.modifiedAttributes(session, file, attributes, null);
     }
 
-    protected void setFileAttributes(Path file, Map<String, ?> attributes, LinkOption ... options) throws IOException {
+    protected void setFileAttributes(Path file, Map<String, ?> attributes, LinkOption... options) throws IOException {
         Set<String> unsupported = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
         // Cannot use forEach because of the potential IOException being thrown
         for (Map.Entry<String, ?> ae : attributes.entrySet()) {
@@ -3079,7 +3079,7 @@ public class SftpSubsystem
         }
     }
 
-    protected void setFileAttribute(Path file, String view, String attribute, Object value, LinkOption ... options) throws IOException {
+    protected void setFileAttribute(Path file, String view, String attribute, Object value, LinkOption... options) throws IOException {
         if (log.isTraceEnabled()) {
             log.trace("setFileAttribute({})[{}] {}:{}={}", getServerSession(), file, view, attribute, value);
         }
@@ -3105,7 +3105,7 @@ public class SftpSubsystem
         }
     }
 
-    protected void setFileTime(Path file, String view, String attribute, FileTime value, LinkOption ... options) throws IOException {
+    protected void setFileTime(Path file, String view, String attribute, FileTime value, LinkOption... options) throws IOException {
         if (value == null) {
             return;
         }
@@ -3117,7 +3117,7 @@ public class SftpSubsystem
         Files.setAttribute(file, view + ":" + attribute, value, options);
     }
 
-    protected void setFileOwnership(Path file, String attribute, Principal value, LinkOption ... options) throws IOException {
+    protected void setFileOwnership(Path file, String attribute, Principal value, LinkOption... options) throws IOException {
         if (value == null) {
             return;
         }
@@ -3160,7 +3160,7 @@ public class SftpSubsystem
         }
     }
 
-    protected void setFileExtensions(Path file, Map<String, byte[]> extensions, LinkOption ... options) throws IOException {
+    protected void setFileExtensions(Path file, Map<String, byte[]> extensions, LinkOption... options) throws IOException {
         if (GenericUtils.isEmpty(extensions)) {
             return;
         }
@@ -3181,7 +3181,7 @@ public class SftpSubsystem
         }
     }
 
-    protected void setFilePermissions(Path file, Set<PosixFilePermission> perms, LinkOption ... options) throws IOException {
+    protected void setFilePermissions(Path file, Set<PosixFilePermission> perms, LinkOption... options) throws IOException {
         if (OsUtils.isWin32()) {
             IoUtils.setPermissionsToFile(file.toFile(), perms);
             return;
@@ -3198,7 +3198,7 @@ public class SftpSubsystem
         view.setPermissions(perms);
     }
 
-    protected void setFileAccessControl(Path file, List<AclEntry> acl, LinkOption ... options) throws IOException {
+    protected void setFileAccessControl(Path file, List<AclEntry> acl, LinkOption... options) throws IOException {
         AclFileAttributeView view = Files.getFileAttributeView(file, AclFileAttributeView.class, options);
         if (view == null) {
             throw new UnsupportedOperationException("ACL view not supported for " + file);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/22dc7c3a/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpVersionsTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpVersionsTest.java b/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpVersionsTest.java
index ce911c1..4ae153a 100644
--- a/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpVersionsTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpVersionsTest.java
@@ -213,7 +213,7 @@ public class SftpVersionsTest extends AbstractSftpClientTestSupport {
                     }
 
                     @Override
-                    protected void setFileAccessControl(Path file, List<AclEntry> aclActual, LinkOption ... options) throws IOException {
+                    protected void setFileAccessControl(Path file, List<AclEntry> aclActual, LinkOption... options) throws IOException {
                         if (aclActual != null) {
                             assertListEquals("Mismatched ACL set for file=" + file, aclExpected, aclActual);
                             numInvocations.incrementAndGet();
@@ -331,7 +331,7 @@ public class SftpVersionsTest extends AbstractSftpClientTestSupport {
                     }
 
                     @Override
-                    protected void setFileExtensions(Path file, Map<String, byte[]> extensions, LinkOption ... options) throws IOException {
+                    protected void setFileExtensions(Path file, Map<String, byte[]> extensions, LinkOption... options) throws IOException {
                         assertExtensionsMapEquals("setFileExtensions(" + file + ")", expExtensions, extensions);
                         numInvocations.incrementAndGet();
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/22dc7c3a/sshd-core/src/test/java/org/apache/sshd/common/config/keys/AuthorizedKeysTestSupport.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/config/keys/AuthorizedKeysTestSupport.java b/sshd-core/src/test/java/org/apache/sshd/common/config/keys/AuthorizedKeysTestSupport.java
index 6d580b8..ab77bf3 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/config/keys/AuthorizedKeysTestSupport.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/config/keys/AuthorizedKeysTestSupport.java
@@ -51,7 +51,7 @@ public abstract class AuthorizedKeysTestSupport extends BaseTestSupport {
         super();
     }
 
-    protected List<String> writeDefaultSupportedKeys(Path file, OpenOption ... options) throws IOException {
+    protected List<String> writeDefaultSupportedKeys(Path file, OpenOption... options) throws IOException {
         List<String> keyLines = loadDefaultSupportedKeys();
         if (Files.exists(file)) {
             Files.delete(file);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/22dc7c3a/sshd-core/src/test/java/org/apache/sshd/common/util/security/SecurityProviderRegistrarTestSupport.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/util/security/SecurityProviderRegistrarTestSupport.java b/sshd-core/src/test/java/org/apache/sshd/common/util/security/SecurityProviderRegistrarTestSupport.java
index cf955dc..a845e06 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/util/security/SecurityProviderRegistrarTestSupport.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/util/security/SecurityProviderRegistrarTestSupport.java
@@ -46,7 +46,7 @@ public abstract class SecurityProviderRegistrarTestSupport extends BaseTestSuppo
     }
 
     public static void assertSecurityEntitySupportState(
-            String prefix, SecurityProviderRegistrar registrar, boolean expected, String name, Class<?> ... entities) {
+            String prefix, SecurityProviderRegistrar registrar, boolean expected, String name, Class<?>... entities) {
         assertSecurityEntitySupportState(prefix, registrar, expected, name, Arrays.asList(entities));
     }
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/22dc7c3a/sshd-core/src/test/java/org/apache/sshd/server/shell/InvertedShellWrapperTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/server/shell/InvertedShellWrapperTest.java b/sshd-core/src/test/java/org/apache/sshd/server/shell/InvertedShellWrapperTest.java
index 2d7e0cf..93945ed 100644
--- a/sshd-core/src/test/java/org/apache/sshd/server/shell/InvertedShellWrapperTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/server/shell/InvertedShellWrapperTest.java
@@ -243,7 +243,7 @@ public class InvertedShellWrapperTest extends BaseTestSupport {
         return newDelayedInputStream(callsCount, data.getBytes(StandardCharsets.UTF_8));
     }
 
-    private static InputStream newDelayedInputStream(final int callsCount, byte ... data) {
+    private static InputStream newDelayedInputStream(final int callsCount, byte... data) {
         return new ByteArrayInputStream(data) {
             private int delayCount;
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/22dc7c3a/sshd-core/src/test/java/org/apache/sshd/util/test/BaseTestSupport.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/util/test/BaseTestSupport.java b/sshd-core/src/test/java/org/apache/sshd/util/test/BaseTestSupport.java
index 49a535f..07c4e84 100644
--- a/sshd-core/src/test/java/org/apache/sshd/util/test/BaseTestSupport.java
+++ b/sshd-core/src/test/java/org/apache/sshd/util/test/BaseTestSupport.java
@@ -136,7 +136,7 @@ public abstract class BaseTestSupport extends Assert {
      * @see #TEMP_SUBFOLDER_NAME
      * @see #getTargetRelativeFile(Collection)
      */
-    protected Path getTempTargetRelativeFile(String ... comps) {
+    protected Path getTempTargetRelativeFile(String... comps) {
         return getTempTargetRelativeFile(GenericUtils.isEmpty(comps) ? Collections.emptyList() : Arrays.asList(comps));
     }
 
@@ -175,7 +175,7 @@ public abstract class BaseTestSupport extends Assert {
      * @param comps The path components - ignored if {@code null}/empty
      * @return The {@link Path} representing the result - same as target folder if no components
      */
-    protected Path getTargetRelativeFile(String ... comps) {
+    protected Path getTargetRelativeFile(String... comps) {
         return getTargetRelativeFile(GenericUtils.isEmpty(comps) ? Collections.emptyList() : Arrays.asList(comps));
     }
 
@@ -561,7 +561,7 @@ public abstract class BaseTestSupport extends Assert {
         return false;
     }
 
-    public static void outputDebugMessage(String format, Object ... args) {
+    public static void outputDebugMessage(String format, Object... args) {
         if (OUTPUT_DEBUG_MESSAGES) {
             outputDebugMessage(String.format(format, args));
         }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/22dc7c3a/sshd-ldap/src/test/java/org/apache/sshd/server/auth/BaseAuthenticatorTest.java
----------------------------------------------------------------------
diff --git a/sshd-ldap/src/test/java/org/apache/sshd/server/auth/BaseAuthenticatorTest.java b/sshd-ldap/src/test/java/org/apache/sshd/server/auth/BaseAuthenticatorTest.java
index 2af8455..d7ed83c 100644
--- a/sshd-ldap/src/test/java/org/apache/sshd/server/auth/BaseAuthenticatorTest.java
+++ b/sshd-ldap/src/test/java/org/apache/sshd/server/auth/BaseAuthenticatorTest.java
@@ -76,7 +76,7 @@ public abstract class BaseAuthenticatorTest extends BaseTestSupport {
         return getHost((ldapServer == null) ? null : ldapServer.getTransports());
     }
 
-    public static String getHost(Transport ... transports) {
+    public static String getHost(Transport... transports) {
         return GenericUtils.isEmpty(transports) ? null : transports[0].getAddress();
     }
 
@@ -88,7 +88,7 @@ public abstract class BaseAuthenticatorTest extends BaseTestSupport {
         return getPort((ldapServer == null) ? null : ldapServer.getTransports());
     }
 
-    public static int getPort(Transport ... transports) {
+    public static int getPort(Transport... transports) {
         return GenericUtils.isEmpty(transports) ? -1 : transports[0].getPort();
     }