tomaswolf commented on a change in pull request #194:
URL: https://github.com/apache/mina-sshd/pull/194#discussion_r631895469



##########
File path: sshd-core/pom.xml
##########
@@ -105,8 +105,25 @@
             <artifactId>ganymed-ssh2</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.testcontainers</groupId>
+            <artifactId>testcontainers</artifactId>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.testcontainers</groupId>
+                <artifactId>testcontainers-bom</artifactId>
+                <type>pom</type>
+                <version>${testcontainers.version}</version>
+                <scope>import</scope>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+

Review comment:
       mvn build fails for me with testcontainers/testcontainers-java#3308
   ```
   [INFO] --- maven-enforcer-plugin:3.0.0-M3:enforce (enforce-maven-version) @ 
sshd-core ---
   [WARNING] 
   Dependency convergence error for net.java.dev.jna:jna:5.2.0 paths to 
dependency are:
   +-org.apache.sshd:sshd-core:2.7.1-SNAPSHOT
     +-org.testcontainers:testcontainers:1.15.3
       +-org.rnorth.visible-assertions:visible-assertions:2.1.2
         +-net.java.dev.jna:jna:5.2.0
   and
   +-org.apache.sshd:sshd-core:2.7.1-SNAPSHOT
     +-org.testcontainers:testcontainers:1.15.3
       +-com.github.docker-java:docker-java-transport-zerodep:3.2.8
         +-net.java.dev.jna:jna:5.8.0
   
   [WARNING] Rule 3: org.apache.maven.plugins.enforcer.DependencyConvergence 
failed with message:
   Failed while enforcing releasability. See above detailed error message.
   ```
   (Even though its a warning, the build stops there, failing the sshd-core 
module.)
   
   Can be worked around by pinning the jna version to 5.8.0 here.

##########
File path: 
sshd-core/src/test/java/org/apache/sshd/client/opensshcerts/ClientOpenSSHCertificatesTest.java
##########
@@ -0,0 +1,152 @@
+package org.apache.sshd.client.opensshcerts;
+
+import org.apache.sshd.client.SshClient;
+import org.apache.sshd.client.session.ClientSession;
+import org.apache.sshd.common.config.keys.PublicKeyEntry;
+import org.apache.sshd.common.keyprovider.FileKeyPairProvider;
+import org.apache.sshd.common.keyprovider.KeyIdentityProvider;
+import org.apache.sshd.common.session.SessionContext;
+import org.apache.sshd.common.util.GenericUtils;
+import org.apache.sshd.common.util.io.IoUtils;
+import org.apache.sshd.util.test.BaseTestSupport;
+import org.apache.sshd.util.test.CommonTestSupportUtils;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.testcontainers.containers.GenericContainer;
+import org.testcontainers.images.builder.ImageFromDockerfile;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
+import java.security.GeneralSecurityException;
+import java.security.KeyPair;
+import java.security.PrivateKey;
+import java.security.PublicKey;
+import java.util.ArrayList;
+import java.util.Arrays;
+
+@RunWith(Parameterized.class) // see 
https://github.com/junit-team/junit/wiki/Parameterized-tests
+public class ClientOpenSSHCertificatesTest {
+
+    private static final String USER_KEY_PATH = 
"org/apache/sshd/client/opensshcerts/user/";
+
+    @Parameterized.Parameters(name = "key: {0}, cert: {0}-cert.pub")
+    public static Iterable<? extends String> privateKeyParams() {
+        return Arrays.asList(
+            "user01_rsa_sha2_256_2048",
+            "user01_rsa_sha2_512_2048",
+            "user01_rsa_sha2_256_4096",
+            "user01_rsa_sha2_512_4096",
+            "user01_ed25519",
+            "user01_ecdsa_256",
+            "user01_ecdsa_384",
+            "user01_ecdsa_521"
+        );
+    }
+
+    @Parameterized.Parameter
+    public String privateKeyName;
+
+    private String getPrivateKeyResource() {
+        return USER_KEY_PATH + privateKeyName;
+    }
+
+    private String getCertificateResource() {
+        return getPrivateKeyResource() + "-cert.pub";
+    }
+
+    /**
+     * This will build a new Docker image once per test class instance
+     * <br/><br/>
+     * The {@link ImageFromDockerfile#withFileFromClasspath} calls will build 
up an in-memory tar filesystem that is sent to the
+     * docker daemon for image building from assets on the classpath, making 
this all JVM classpath friendly.
+     * <br/><br/>
+     * The Docker image built will run a sshd instance managed by supervisord 
that has:
+     *
+     * <ul>
+     *   <li>
+     *     Two users: user01, user02 with:
+     *     <ul>
+     *       <li>Passwords "password01" and "password02"</li>
+     *       <li>An authorized_keys file with a pub key for the included suite 
of keypairs (all current variants)</li>
+     *     </ul>
+     *   </li>
+     *   <li>A CA public key configured in sshd_config for the 
TrustedUserCAKeys option (for client cert publickey auth)</li>
+     *   <li>Two available host keypairs host01 and host02 (selected by env 
var SSH_HOST_KEY)</li>
+     * </ul>
+     **/
+    @ClassRule
+    public static GenericContainer<?> sshdContainer = new GenericContainer<>(
+        new ImageFromDockerfile("clientopensshcertificatestest", true)
+            .withFileFromClasspath("entrypoint.sh", 
"org/apache/sshd/client/opensshcerts/docker/entrypoint.sh")
+            .withFileFromClasspath("sshd_config", 
"org/apache/sshd/client/opensshcerts/docker/sshd_config")
+            .withFileFromClasspath("supervisord.conf", 
"org/apache/sshd/client/opensshcerts/docker/supervisord.conf")
+            .withFileFromClasspath("user01_authorized_keys", 
"org/apache/sshd/client/opensshcerts/user/user01_authorized_keys")
+            .withFileFromClasspath("user02_authorized_keys", 
"org/apache/sshd/client/opensshcerts/user/user02_authorized_keys")
+            .withFileFromClasspath("host01", 
"org/apache/sshd/client/opensshcerts/host/host01")
+            .withFileFromClasspath("host01.pub", 
"org/apache/sshd/client/opensshcerts/host/host01.pub")
+            .withFileFromClasspath("host02", 
"org/apache/sshd/client/opensshcerts/host/host02")
+            .withFileFromClasspath("host02.pub", 
"org/apache/sshd/client/opensshcerts/host/host02.pub")
+            .withFileFromClasspath("ca.pub", 
"org/apache/sshd/client/opensshcerts/ca/ca.pub")
+            .withFileFromClasspath("Dockerfile", 
"org/apache/sshd/client/opensshcerts/docker/Dockerfile")
+    )
+        // must be set to "/keys/host/host01" or "/keys/host/host02"
+        .withEnv("SSH_HOST_KEY", "/keys/host/host01")
+        .withExposedPorts(22);
+
+    @Test
+    public void clientCertAuth() throws Exception {
+
+        try (final InputStream certInputStream =
+               
Thread.currentThread().getContextClassLoader().getResourceAsStream(getCertificateResource())
+        ) {
+
+            final byte[] certBytes = IoUtils.toByteArray(certInputStream);
+            final String certLine = GenericUtils.replaceWhitespaceAndTrim(new 
String(certBytes, StandardCharsets.UTF_8));
+
+            final PublicKeyEntry certPublicKeyEntry = 
PublicKeyEntry.parsePublicKeyEntry(certLine);
+            final PublicKey certPublicKey = 
certPublicKeyEntry.resolvePublicKey(null, null, null);
+
+            final FileKeyPairProvider keyPairProvider = 
CommonTestSupportUtils.createTestKeyPairProvider(getPrivateKeyResource());
+
+            final KeyPair keypair = 
keyPairProvider.loadKeys(null).iterator().next();
+
+            final PrivateKey privateKey = keypair.getPrivate();
+
+            final SshClient client = SshClient.setUpDefaultClient();
+
+            client.setKeyIdentityProvider(new KeyIdentityProvider() {
+                @Override
+                public Iterable<KeyPair> loadKeys(SessionContext session) 
throws IOException, GeneralSecurityException {
+
+                    // build a keypair with the PrivateKey and the certificate 
as the PublicKey
+                    final KeyPair certKeypair = new KeyPair(certPublicKey, 
privateKey);
+
+                    final ArrayList<KeyPair> list = new ArrayList<>();
+                    list.add(certKeypair);
+
+                    return list;
+                }
+            });
+
+            client.start();
+
+            final Integer actualPort = sshdContainer.getMappedPort(22);
+
+            try (final ClientSession session = client.connect("user01", 
"localhost", actualPort).verify().getSession()) {

Review comment:
       No "final" needed here (flagged by checkstyle).
   
   I also think this should be `client.connect("user01", 
sshdContainer.getHost(), actualPort)`. With "localhost" I get a "connection 
refused" on Mac. (Docker container running in a VM -- the "default" docker 
machine. Evidently this is not localhost.)
   
   However, the container logs showed
   ```
   Connection from 192.168.99.1 port 59228 on 172.17.0.3 port 22 rdomain ""
   debug1: Local version string SSH-2.0-OpenSSH_8.4
   kex_exchange_identification: Connection closed by remote host
   Connection closed by 192.168.99.1 port 59228
   ```
   
   Maybe I'm doing something wrong... using sshdContainer.getHost() instead of 
localhost at least I can connect. But even then it fails just after KEX 
negotiation because of the shaded and apparently unsigned BouncyCastle copy 
inside testcontainers:
   ```
   java.security.NoSuchProviderException: JCE cannot authenticate the provider 
BC
        at javax.crypto.JceSecurity.getInstance(JceSecurity.java:105)
        at javax.crypto.KeyAgreement.getInstance(KeyAgreement.java:230)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at 
org.apache.sshd.common.util.security.SecurityEntityFactory$2.getInstance(SecurityEntityFactory.java:130)
        at 
org.apache.sshd.common.util.security.SecurityUtils.getKeyAgreement(SecurityUtils.java:766)
        at org.apache.sshd.common.kex.ECDH.<init>(ECDH.java:63)
        at org.apache.sshd.common.kex.ECDH.<init>(ECDH.java:58)
        at 
org.apache.sshd.common.kex.BuiltinDHFactories$12.create(BuiltinDHFactories.java:238)
        at 
org.apache.sshd.common.kex.BuiltinDHFactories$12.create(BuiltinDHFactories.java:1)
        at org.apache.sshd.client.kex.DHGClient.getDH(DHGClient.java:112)
        at org.apache.sshd.client.kex.DHGClient.init(DHGClient.java:95)
        at 
org.apache.sshd.common.session.helpers.AbstractSession.doKexNegotiation(AbstractSession.java:721)
        at 
org.apache.sshd.common.session.helpers.AbstractSession.handleKexInit(AbstractSession.java:693)
        at 
org.apache.sshd.common.session.helpers.AbstractSession.doHandleMessage(AbstractSession.java:478)
        at 
org.apache.sshd.common.session.helpers.AbstractSession.handleMessage(AbstractSession.java:429)
        at 
org.apache.sshd.common.session.helpers.AbstractSession.decode(AbstractSession.java:1466)
        at 
org.apache.sshd.common.session.helpers.AbstractSession.messageReceived(AbstractSession.java:389)
        at 
org.apache.sshd.common.session.helpers.AbstractSessionIoHandler.messageReceived(AbstractSessionIoHandler.java:64)
        at 
org.apache.sshd.common.io.nio2.Nio2Session.handleReadCycleCompletion(Nio2Session.java:359)
        at 
org.apache.sshd.common.io.nio2.Nio2Session$1.onCompleted(Nio2Session.java:336)
        at 
org.apache.sshd.common.io.nio2.Nio2Session$1.onCompleted(Nio2Session.java:1)
        at 
org.apache.sshd.common.io.nio2.Nio2CompletionHandler.lambda$0(Nio2CompletionHandler.java:38)
        at java.security.AccessController.doPrivileged(Native Method)
        at 
org.apache.sshd.common.io.nio2.Nio2CompletionHandler.completed(Nio2CompletionHandler.java:37)
        at sun.nio.ch.Invoker.invokeUnchecked(Invoker.java:126)
        at sun.nio.ch.Invoker$2.run(Invoker.java:218)
        at 
sun.nio.ch.AsynchronousChannelGroupImpl$1.run(AsynchronousChannelGroupImpl.java:112)
        at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
   Caused by: java.util.jar.JarException: file:<path to 
.m2>/repository/org/testcontainers/testcontainers/1.15.3/testcontainers-1.15.3.jar
 has unsigned entries - 
org/testcontainers/dockerclient/AuthDelegatingDockerClientConfig$DelegateExclusions.class
        at javax.crypto.JarVerifier.verifySingleJar(JarVerifier.java:502)
        at javax.crypto.JarVerifier.verifyJars(JarVerifier.java:363)
        at javax.crypto.JarVerifier.verify(JarVerifier.java:289)
        at javax.crypto.JceSecurity.verifyProviderJar(JceSecurity.java:164)
        at javax.crypto.JceSecurity.getVerificationResult(JceSecurity.java:190)
        at javax.crypto.JceSecurity.getInstance(JceSecurity.java:102)
        at javax.crypto.KeyAgreement.getInstance(KeyAgreement.java:230)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at 
org.apache.sshd.common.util.security.SecurityEntityFactory$2.getInstance(SecurityEntityFactory.java:130)
        at 
org.apache.sshd.common.util.security.SecurityUtils.getKeyAgreement(SecurityUtils.java:766)
        at org.apache.sshd.common.kex.ECDH.<init>(ECDH.java:63)
        at org.apache.sshd.common.kex.ECDH.<init>(ECDH.java:58)
        at 
org.apache.sshd.common.kex.BuiltinDHFactories$12.create(BuiltinDHFactories.java:238)
        at 
org.apache.sshd.common.kex.BuiltinDHFactories$12.create(BuiltinDHFactories.java:1)
        at org.apache.sshd.client.kex.DHGClient.getDH(DHGClient.java:112)
        at org.apache.sshd.client.kex.DHGClient.init(DHGClient.java:95)
        at 
org.apache.sshd.common.session.helpers.AbstractSession.doKexNegotiation(AbstractSession.java:721)
        at 
org.apache.sshd.common.session.helpers.AbstractSession.handleKexInit(AbstractSession.java:693)
        at 
org.apache.sshd.common.session.helpers.AbstractSession.doHandleMessage(AbstractSession.java:478)
        at 
org.apache.sshd.common.session.helpers.AbstractSession.handleMessage(AbstractSession.java:429)
        at 
org.apache.sshd.common.session.helpers.AbstractSession.decode(AbstractSession.java:1466)
        at 
org.apache.sshd.common.session.helpers.AbstractSession.messageReceived(AbstractSession.java:389)
        at 
org.apache.sshd.common.session.helpers.AbstractSessionIoHandler.messageReceived(AbstractSessionIoHandler.java:64)
        at 
org.apache.sshd.common.io.nio2.Nio2Session.handleReadCycleCompletion(Nio2Session.java:359)
        at 
org.apache.sshd.common.io.nio2.Nio2Session$1.onCompleted(Nio2Session.java:336)
        at 
org.apache.sshd.common.io.nio2.Nio2Session$1.onCompleted(Nio2Session.java:1)
        at 
org.apache.sshd.common.io.nio2.Nio2CompletionHandler.lambda$0(Nio2CompletionHandler.java:38)
        at java.security.AccessController.doPrivileged(Native Method)
        at 
org.apache.sshd.common.io.nio2.Nio2CompletionHandler.completed(Nio2CompletionHandler.java:37)
        at sun.nio.ch.Invoker.invokeUnchecked(Invoker.java:126)
        at sun.nio.ch.Invoker.invokeDirect(Invoker.java:157)
        at 
sun.nio.ch.UnixAsynchronousSocketChannelImpl.implRead(UnixAsynchronousSocketChannelImpl.java:553)
        at 
sun.nio.ch.AsynchronousSocketChannelImpl.read(AsynchronousSocketChannelImpl.java:276)
        at 
sun.nio.ch.AsynchronousSocketChannelImpl.read(AsynchronousSocketChannelImpl.java:297)
        at 
org.apache.sshd.common.io.nio2.Nio2Session.doReadCycle(Nio2Session.java:430)
        at 
org.apache.sshd.common.io.nio2.Nio2Session.doReadCycle(Nio2Session.java:328)
        at 
org.apache.sshd.common.io.nio2.Nio2Session.startReading(Nio2Session.java:321)
        at 
org.apache.sshd.common.io.nio2.Nio2Session.startReading(Nio2Session.java:317)
        at 
org.apache.sshd.common.io.nio2.Nio2Session.startReading(Nio2Session.java:313)
        at 
org.apache.sshd.common.io.nio2.Nio2Session.startReading(Nio2Session.java:309)
        at 
org.apache.sshd.common.io.nio2.Nio2Session.startReading(Nio2Session.java:305)
        at 
org.apache.sshd.common.io.nio2.Nio2Connector$ConnectionCompletionHandler.onCompleted(Nio2Connector.java:162)
        at 
org.apache.sshd.common.io.nio2.Nio2Connector$ConnectionCompletionHandler.onCompleted(Nio2Connector.java:1)
        ... 9 common frames omitted
   ```
   So far I have not succeeded to make it pick up the standard BC provider 
instead...

##########
File path: 
sshd-core/src/test/java/org/apache/sshd/client/opensshcerts/ClientOpenSSHCertificatesTest.java
##########
@@ -0,0 +1,152 @@
+package org.apache.sshd.client.opensshcerts;

Review comment:
       Missing license header fails the mvn build.

##########
File path: 
sshd-core/src/test/java/org/apache/sshd/client/opensshcerts/ClientOpenSSHCertificatesTest.java
##########
@@ -0,0 +1,152 @@
+package org.apache.sshd.client.opensshcerts;
+
+import org.apache.sshd.client.SshClient;
+import org.apache.sshd.client.session.ClientSession;
+import org.apache.sshd.common.config.keys.PublicKeyEntry;
+import org.apache.sshd.common.keyprovider.FileKeyPairProvider;
+import org.apache.sshd.common.keyprovider.KeyIdentityProvider;
+import org.apache.sshd.common.session.SessionContext;
+import org.apache.sshd.common.util.GenericUtils;
+import org.apache.sshd.common.util.io.IoUtils;
+import org.apache.sshd.util.test.BaseTestSupport;
+import org.apache.sshd.util.test.CommonTestSupportUtils;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.testcontainers.containers.GenericContainer;
+import org.testcontainers.images.builder.ImageFromDockerfile;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
+import java.security.GeneralSecurityException;
+import java.security.KeyPair;
+import java.security.PrivateKey;
+import java.security.PublicKey;
+import java.util.ArrayList;
+import java.util.Arrays;
+
+@RunWith(Parameterized.class) // see 
https://github.com/junit-team/junit/wiki/Parameterized-tests
+public class ClientOpenSSHCertificatesTest {
+
+    private static final String USER_KEY_PATH = 
"org/apache/sshd/client/opensshcerts/user/";
+
+    @Parameterized.Parameters(name = "key: {0}, cert: {0}-cert.pub")
+    public static Iterable<? extends String> privateKeyParams() {
+        return Arrays.asList(
+            "user01_rsa_sha2_256_2048",
+            "user01_rsa_sha2_512_2048",
+            "user01_rsa_sha2_256_4096",
+            "user01_rsa_sha2_512_4096",
+            "user01_ed25519",
+            "user01_ecdsa_256",
+            "user01_ecdsa_384",
+            "user01_ecdsa_521"
+        );
+    }
+
+    @Parameterized.Parameter
+    public String privateKeyName;
+
+    private String getPrivateKeyResource() {
+        return USER_KEY_PATH + privateKeyName;
+    }
+
+    private String getCertificateResource() {
+        return getPrivateKeyResource() + "-cert.pub";
+    }
+
+    /**
+     * This will build a new Docker image once per test class instance
+     * <br/><br/>
+     * The {@link ImageFromDockerfile#withFileFromClasspath} calls will build 
up an in-memory tar filesystem that is sent to the
+     * docker daemon for image building from assets on the classpath, making 
this all JVM classpath friendly.
+     * <br/><br/>
+     * The Docker image built will run a sshd instance managed by supervisord 
that has:
+     *
+     * <ul>
+     *   <li>
+     *     Two users: user01, user02 with:
+     *     <ul>
+     *       <li>Passwords "password01" and "password02"</li>
+     *       <li>An authorized_keys file with a pub key for the included suite 
of keypairs (all current variants)</li>
+     *     </ul>
+     *   </li>
+     *   <li>A CA public key configured in sshd_config for the 
TrustedUserCAKeys option (for client cert publickey auth)</li>
+     *   <li>Two available host keypairs host01 and host02 (selected by env 
var SSH_HOST_KEY)</li>
+     * </ul>
+     **/
+    @ClassRule
+    public static GenericContainer<?> sshdContainer = new GenericContainer<>(
+        new ImageFromDockerfile("clientopensshcertificatestest", true)
+            .withFileFromClasspath("entrypoint.sh", 
"org/apache/sshd/client/opensshcerts/docker/entrypoint.sh")
+            .withFileFromClasspath("sshd_config", 
"org/apache/sshd/client/opensshcerts/docker/sshd_config")
+            .withFileFromClasspath("supervisord.conf", 
"org/apache/sshd/client/opensshcerts/docker/supervisord.conf")
+            .withFileFromClasspath("user01_authorized_keys", 
"org/apache/sshd/client/opensshcerts/user/user01_authorized_keys")
+            .withFileFromClasspath("user02_authorized_keys", 
"org/apache/sshd/client/opensshcerts/user/user02_authorized_keys")
+            .withFileFromClasspath("host01", 
"org/apache/sshd/client/opensshcerts/host/host01")
+            .withFileFromClasspath("host01.pub", 
"org/apache/sshd/client/opensshcerts/host/host01.pub")
+            .withFileFromClasspath("host02", 
"org/apache/sshd/client/opensshcerts/host/host02")
+            .withFileFromClasspath("host02.pub", 
"org/apache/sshd/client/opensshcerts/host/host02.pub")
+            .withFileFromClasspath("ca.pub", 
"org/apache/sshd/client/opensshcerts/ca/ca.pub")
+            .withFileFromClasspath("Dockerfile", 
"org/apache/sshd/client/opensshcerts/docker/Dockerfile")
+    )
+        // must be set to "/keys/host/host01" or "/keys/host/host02"
+        .withEnv("SSH_HOST_KEY", "/keys/host/host01")
+        .withExposedPorts(22);
+
+    @Test
+    public void clientCertAuth() throws Exception {
+
+        try (final InputStream certInputStream =

Review comment:
       No "final" needed here (flagged by checkstyle).

##########
File path: 
sshd-core/src/test/java/org/apache/sshd/client/opensshcerts/ClientOpenSSHCertificatesTest.java
##########
@@ -0,0 +1,152 @@
+package org.apache.sshd.client.opensshcerts;
+
+import org.apache.sshd.client.SshClient;
+import org.apache.sshd.client.session.ClientSession;
+import org.apache.sshd.common.config.keys.PublicKeyEntry;
+import org.apache.sshd.common.keyprovider.FileKeyPairProvider;
+import org.apache.sshd.common.keyprovider.KeyIdentityProvider;
+import org.apache.sshd.common.session.SessionContext;
+import org.apache.sshd.common.util.GenericUtils;
+import org.apache.sshd.common.util.io.IoUtils;
+import org.apache.sshd.util.test.BaseTestSupport;
+import org.apache.sshd.util.test.CommonTestSupportUtils;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.testcontainers.containers.GenericContainer;
+import org.testcontainers.images.builder.ImageFromDockerfile;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
+import java.security.GeneralSecurityException;
+import java.security.KeyPair;
+import java.security.PrivateKey;
+import java.security.PublicKey;
+import java.util.ArrayList;
+import java.util.Arrays;
+
+@RunWith(Parameterized.class) // see 
https://github.com/junit-team/junit/wiki/Parameterized-tests
+public class ClientOpenSSHCertificatesTest {
+
+    private static final String USER_KEY_PATH = 
"org/apache/sshd/client/opensshcerts/user/";
+
+    @Parameterized.Parameters(name = "key: {0}, cert: {0}-cert.pub")
+    public static Iterable<? extends String> privateKeyParams() {
+        return Arrays.asList(
+            "user01_rsa_sha2_256_2048",
+            "user01_rsa_sha2_512_2048",
+            "user01_rsa_sha2_256_4096",
+            "user01_rsa_sha2_512_4096",
+            "user01_ed25519",
+            "user01_ecdsa_256",
+            "user01_ecdsa_384",
+            "user01_ecdsa_521"
+        );
+    }
+
+    @Parameterized.Parameter
+    public String privateKeyName;
+

Review comment:
       Checkstyle has trouble with that, and wants a constructor anyway. So 
change to
   ```
   private String privateKeyName;
   
   public ClientOpenSSHCertificatesTest(String keyName) {
     privateKeyName = keyName;
   }
   ```
   Order of fields must be public static, private static, public, private. 
Methods (also static ones) are supposed to follow the constructor according to 
the project's checkstyle rules.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org

Reply via email to