-
Notifications
You must be signed in to change notification settings - Fork 6
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
Register com.jcraft.jsch.jbcrypt.JBCrypt
for reflection
#106
Register com.jcraft.jsch.jbcrypt.JBCrypt
for reflection
#106
Conversation
Can you create a test using the snippet you provided in the issue description? var keyPair = KeyPair.load(new JSch(), privateKeyBytes, null);
keyPair.decrypt(passphrase.getBytes(StandardCharsets.UTF_8)): |
I'll try. Problem is that code runs in Quarkus and only fails in native mode, not Java mode. Do you have any existing tests that run in native mode, that I can use as a starting point? (I'll look around). |
@erik-wramner I have a test that invokes that snippet of yours, let me push to your PR |
I also added a test, but your test is nicer. Shall I revert mine? I haven't been able to actually test that it works. I had Visual Studio installed when this computer crashed and since then I can't reinstall it, so I can't compile native code without doing it in Docker. Can't find a way to run the integration tests in Docker, unfortunately. I have verified with the real Quarkus release that adding com.jcraft.jsch.jbcrypt.JBCrypt to reflection-config.json helps. |
Sure, I think it's better if we don't store any RSA keys in the repository :)
That's great to hear. For some reason my test passes even without your fix, but I'll investigate what's going on |
Reverted. As for the RSA key, it is harmless, it was created for these tests, but it is still nicer to do without it. |
com.jcraft.jsch.jbcrypt.JBCrypt
for reflection
PR Merged. Thanks! Can you build and try this extension locally and see if that resolves your problem? |
Yes, I'll give it a try. |
I found out how to reproduce the issue in the test, it happens with OpenSSL keys only. I'll update it |
@all-contributors add @erik-wramner for code |
I've put up a pull request to add @erik-wramner! 🎉 |
@gastaldi I can confirm that the new version solves the issue when I build locally. I have a question though. To make it work, I need to depend on quarkus-jsch-deployment. However, if I follow the installation docs and run Are the installation instructions wrong, so that the correct dependency is quarkus-jsch-deployment, or have I missed something? |
The |
Hm, I thought so. Weird - but then perhaps the Maven plugin finds the released version, so I needed to depend on the deployment artifact explicitly to get 999-SNAPSHOT? |
No, the resolver should pick from the local repository first. That sounds like a bug, we've been doing some changes in the Maven integration recently and I wonder if this is a new bug. Can you open an issue in https://github.com/quarkusio/quarkus/issues with a small reproducer project? |
I'll see if it is reasonably easy to reproduce. My real project is complex with multiple Maven projects. Stripping it to a small reproducer is not trivial, but if the problem appears in a single Maven project I'll create an issue for it. |
@gastaldi I created a single-project reproducer, but it didn't have the problem. It (correctly) uses the local version without having to drag in the deployment project. It could be one of the many other dependencies that creates a conflict or it may be something with the multiple Maven projects. I could keep adding things, trying to make the example project even more like the real one, but given how long time a single build takes and how many variables there are to tweak I'm afraid I don't have the time. |
@erik-wramner I've been trying to reproduce your use case and haven't seen it fail. Perhaps you could output the logs with |
I'd prefer not to upload the full trace to the world as it contains a bit too much that may be sensitive. However, I think this is where it goes wrong:
For some reason it decides that the version from Quarkus BOM is better than the one in the pom file. I'll move things around a bit to see if I can find out why. |
Funny, because this extension is not listed in the Quarkus BOM (none of the |
Indeed, plus further down in the trace I get:
That looks correct. I'm building again with a few changes, perhaps Maven gets confused as the library is pulled in from two sub-projects. |
Actually, if you check the bom for 3.2.1 you'll find:
|
Perhaps you already know, but it's important to mention that Maven resolves to the version that is nearest to the resolved dependency tree. Better use |
Oh that's news to me, I was looking at https://github.com/quarkusio/quarkus/blob/main/bom/application/pom.xml but it looks like some preprocessing is run before the artifact is deployed |
Well, since the dependency is in the Quarkus BOM, it is already present in the parent's dependencyManagement section. If that is supposed to win, we have found the problem? |
Right, so declaring the extension AND the deployment with the new version BEFORE the quarkus-bom should fix the problem. You don't need to declare the |
Fix issue #105 (hopefully, not tested) by registering JBCrypt for reflection.