kosprov / jargon2-api

Fluent Java API for Argon2 password hashing
Apache License 2.0
65 stars 5 forks source link

Jargon2 fails in module envrioment #10

Open realkarmakun opened 2 years ago

realkarmakun commented 2 years ago

So I'm making a plugin for Minecraft server that supports Argon2id as hashing algorithm. The issue is that in my environment i have main app that can be customize by adding plugins. I'm putting jargon2 into a plugin and it does not make use of my plugins classloader as it just a jar with built .class files. It has it's own classloader which loads classes from my jar. No SPI or anything else will be loaded. All of this can be mitigated by rebuilding app bundling jargon2 in parent classloader but that pretty invasive and against best practices.

I can't get my head around this. Since other libraries that use JNA/JNI can be bundled in plugins just fine without any issue but Jargon2:

  1. Backend SPI is out of scope of parent classloader
  2. Argument specification doesn't work as well. I get ClassNotFound exception
  3. Programmatic backend spec fails silently

What can be done about this? I was told that SPI is actually considered legacy, would it be possible to move jargon2 backend to java modules? Would it help in my case? Is there a way just to bundle backend how it is without the hassle?

I rushed and already moved my db to jargon2 hashes using my site backend (I like how salt is handled). Maybe there is a way to migrate jagron2 hashes to let's say lazysodium?