sshtools / maverick-synergy

Next Generation Java SSH API
https://jadaptive.com
GNU Lesser General Public License v3.0
96 stars 26 forks source link

SshPrivateKeyFileFactory.OPENSSL_FORMAT is failing to find class #29

Closed dandalf closed 3 years ago

dandalf commented 3 years ago

I am using v3.0.3-FINAL and its SshPrivateKeyFileFactory to extract a private key from a key pair like so:

SshKeyPair pair = SshKeyPairGenerator.generateKeyPair("ssh-rsa", 2048);

SshPrivateKeyFile prvfile = SshPrivateKeyFileFactory.create(pair, "", SshPrivateKeyFileFactory.OPENSSL_FORMAT);

It fails with a message saying: java.lang.ClassNotFoundException: com.sshtools.common.publickey.OpenSSHPrivateKeyFileBC

I have included the com.sshtools:maverick-bc library in my imports.

Looking at the code, it looks like the tryBc method on line 176 of the SshPrivateKeyFileFactory is looking for a class named: "com.sshtools.common.publickey.OpenSSHPrivateKeyFileBC" but the maverick-bc class is at: "com.sshtools.common.publickey.bc.OpenSSHPrivateKeyFileBC"

The missing "bc" in the package path seems to be the problem.

dandalf commented 3 years ago

Oh wow, it looks like this issue was taken care of a couple hours ago in 3.0.4-SNAPSHOT with commit f754cacfc2394cc7303ffdbd248eb68e60b3f416

I will confirm once that library version is available.