Skip to content
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

BouncyCastle NoSuchMethodError #77

Closed
Fabio1988 opened this issue Sep 13, 2021 · 11 comments
Closed

BouncyCastle NoSuchMethodError #77

Fabio1988 opened this issue Sep 13, 2021 · 11 comments

Comments

@Fabio1988
Copy link

Hey, I switched from latest com.jcraft:jsch to your repo.
I read of the missing config for older servers but I receive a different error.

java.lang.NoSuchMethodError: org.bouncycastle.crypto.params.X25519PublicKeyParameters.<init>([B)V

	at com.jcraft.jsch.bc.XDH.getSecret(XDH.java:71)
	at com.jcraft.jsch.DHXEC.next(DHXEC.java:144)
	at com.jcraft.jsch.Session.connect(Session.java:330)

I use JSch inside Spring Application to provide SSH command executions. I tried #37 and #40, but those settings doesn't help. Any hint?

@Fabio1988
Copy link
Author

session.setConfig("kex", "diffie-hellman-group1-sha1");

Maybe only this config worked... There is also a second config-line, which doesn't work...

So with this fix it will support old ssh connections.. But also the new ones?

@norrisjeremy
Copy link
Contributor

Hi @Fabio1988,

What version of Bouncy Castle (bcprov-jdk15on) are you utilizing?

Thanks,
Jeremy

@Fabio1988
Copy link
Author

Fabio1988 commented Sep 13, 2021

bcprov-jdk15on version 1.69
:)

@norrisjeremy
Copy link
Contributor

Hi @Fabio1988,

Are you sure? The exception you posted seems to indicate that the class org.bouncycastle.crypto.params.X25519PublicKeyParameters lacks the constructor type public X25519PublicKeyParameters(byte[] buf). This particular constructor appears to have only been added in version 1.69. Perhaps you have somehow pulled in an older release onto your classpath? I can attempt to address this in the next JSch release, to add some amount of backwards compatibility for older Bouncy Castle releases.

Thanks,
Jeremy

@Fabio1988
Copy link
Author

Hi @norrisjeremy
thanks for your answer. I'm pretty sure I use 1.69 since July :)

The exception is away after adding session.setConfig("kex", "diffie-hellman-group1-sha1"); Hopefully it will work, have to test it properly.
But I think some backwards compatibility would be nice too :)

@norrisjeremy
Copy link
Contributor

Hi @Fabio1988,

What version of Java are you utilizing?

Thanks,
Jeremy

@Fabio1988
Copy link
Author

Java 8.. Will update this year to latest LTS 17 👍

@Fabio1988
Copy link
Author

Is it possible to use those minor updates PR with gradle build? not really I think?! :)

@mwiede
Copy link
Owner

mwiede commented Sep 13, 2021

I will quickly release changes of #70 since there are enough intergration tests which covers the functionality.

@norrisjeremy
Copy link
Contributor

Hi @Fabio1988,

Can you confirm if the new 0.1.67 release fixes the java.lang.NoSuchMethodError you were receiving?

Thanks,
Jeremy

@Fabio1988
Copy link
Author

Hi @norrisjeremy

Thanks a lot, that fixed the Exception :)

@mwiede mwiede closed this as completed Sep 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants