-
Notifications
You must be signed in to change notification settings - Fork 599
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
org.bouncycastle.jcajce.provider.asymmetric.ec.BCECPrivateKey cannot be cast to java.security.interfaces.ECPublicKey #356
Comments
THanks for the carefully described issue! Which version of SSHJ are you using? (Just to check :)) |
That was fast :). sshj-0.22.0.jar |
I did not build this myself, but used the jar from http://repo1.maven.org/maven2/com/hierynomus/sshj/0.22.0/ |
Fixed it ;) |
Nice. Thanks a lot! |
CCLiu
added a commit
to CCLiu/sshj
that referenced
this issue
Jan 11, 2018
* Check whether filename is a child of the current file (Fixes hierynomus#341) * Fixed codacy * Updated README release notes * Removed oraclejdk7 as that is no longer supported on trusty, added openjdk * Added gradle caching to travis config * Removed use of DataTypeConverter as that is no longer in default JDK9 * Removed build of broken openJDK7 in favour of using animal-sniffer to detect java 1.6 compatibility * Improved test stability * Correctly determine KeyType for ECDSA public key (Fixes hierynomus#356) * fixed build * Fixed Java9 build? * Disambiguated signature initialization * Removed deprecated method * Organised imports * Added 'out/' to gitignore * Added support for new-style fingerprints (hierynomus#365) * Added support for new-style fingerprints * Fixed codacy warnings * Fix decoding signature bytes (Fixes hierynomus#355, hierynomus#354) (hierynomus#361) * Fix for signature verify in DSA * Cleaned up signature verification * Fixed import * Ignored erroneous pmd warnings * Updated JavaDoc * Extracted ASN.1/DER encoding to method (hierynomus#368) * Update net.i2p.crypto:eddsa to 0.2.0 (hierynomus#372) * Update net.i2p.crypto:eddsa to 0.2.0 * Update net.i2p.crypto.eddsa to 0.2.0 * Update net.i2p.crypto.eddsa to 0.2.0 * Update net.i2p.crypto.eddsa to 0.2.0 * Log security provider registration failures (hierynomus#374) * Migrate remaining block ciphers * Updated README for v0.23.0 release * Using new release plugin * Updated build plugins * Fix escaping in WildcardHostMatcher (hierynomus#382) * Escape '[' and ']' in WildcardHostMatcher * Anchoring regex to match entire string (Fixes hierynomus#381) * Updated builds to include CodeCov * - Experimenting with travis * - fix ip for online testing * - account for different working dir * - yaml-yaml * - double before_install * - still -d * - try common format * - Fixed server keys - Use sshj branding * - grr, ip * - minor improvements * - eh? * - switch username back * - orly? * - desperation * - One more time * Upgraded gradle to cope with java9 * Separated out integration tests * Fixed length bug in putString (Fixes hierynomus#187) * Removed docker from travis yml as it is included in gradle build now * Added integration test to travis * Update AndroidConfig (hierynomus#389) * Add EdDSA signature for AndroidConfig. * Initialize KeyExchange- and FileKeyProviderFactories with registered "bouncyCastle" (in fact, SpongyCastle is registered). See hierynomus#308 for discussion. * Added integration test for append scenario (Fixes hierynomus#390) * Fixed headers
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
I have a problem with SSJ when I connect to an OpenSSH server (6.6.1) with ECDSA keys (ecdsa-sha2-nistp256). While RSA and DSA keys work without any problems, ECDSA keys fail to authenticate a user. OpenSSH is well configured; using the very same keys with other tools (e.g. putty) I can successfully connect with ECDSA as well. Therefore I think its an SSHJ issue.
The problem is a bad cast from a private key to a public key in KeyType.java:133
which results in the folloing error message.
Root cause is that in KeyedAuthMethod.java:64 a call to KeyType.fromKey() uses a private key as parameter (created in KeyedAuthMethod.java:59), which basically leads to the ClassCastException later on.
There is a good change that I am using your API incorrectly here, since I have not found anything about this issue online and I somehow doubt that I would be the first to stumble across this.
If so please advise how to connect with a given private ECDSA key. But even if there is something wrong with the keys themselves (encoding etc), the code path that causes the exception is at least dubious, or am I wrong?
The keys in the sample below have been created for this issue and can be thrown away. I have locally updated java.security for BC and replaced local_policy.jar and US_export_policy.jar with their unlimited version.
I am using JRE1.8.0_144, SSHJ-0.22.0 and BC-158.
Here is a minimal sample that illustrates the problem.
Thanks for your time
Thomas
The text was updated successfully, but these errors were encountered: