paseto4j icon indicating copy to clipboard operation
paseto4j copied to clipboard

Tuweni project appears to be unmaintained, switch to other options?

Open rogu-beta opened this issue 1 year ago • 10 comments

Is your feature request related to a problem? Please describe. The Tuweni project appears to be abandoned, with the Apache Incubator repository being archived. A fork by the original author exists, but besides one version it has also not seen any updates. Without maintenance of the library this could lead to bugs and vulnerabilities not getting addressed.

Describe the solution you'd like Perhaps switching to BouncyCastle or other libraries might be an option.

Describe alternatives you've considered None

Additional context

rogu-beta avatar Oct 14 '24 11:10 rogu-beta

Thanks for submitting your first issue, we will have a look as quickly as possible.

github-actions[bot] avatar Oct 14 '24 11:10 github-actions[bot]

@ghsa-retrieval correct we need to move away from Tuweni. Do you have interest in picking this up?

nbaars avatar Oct 26 '24 17:10 nbaars

@nbaars I would be interested in this. Replacing the library could be challenging though, as we need to ensure that it remains fully compatible with how libsodium works.

robertguetzkow avatar Nov 04 '24 17:11 robertguetzkow

@robertguetzkow would be great if you can pick this up! let me know if you need any help.

nbaars avatar Nov 04 '24 19:11 nbaars

@nbaars I'll give it a try. What would be your preferred approach, should we use a specific provider (like Bouncy Castle) or just implement generically against JCA? The decision may have impact on the minimum required Java version to support all cryptographic algorithms.

robertguetzkow avatar Nov 04 '24 20:11 robertguetzkow

Using a specific provider is fine. Bouncycastle is already used in the project.

nbaars avatar Nov 06 '24 23:11 nbaars

Will do. Currently quite busy at work though, so it might take a bit until I can implement it.

robertguetzkow avatar Nov 08 '24 18:11 robertguetzkow

I'm starting to map out what changes are needed and in particular how libsodium and Bouncy Castle implement their Ed25519. I need to check whether or not we can ensure that the validation rejects the same inputs, e.g. libsodium performs small-order checks.

robertguetzkow avatar Nov 18 '24 23:11 robertguetzkow

Sorry for the long delay. Seems that Bouncy Castle performs comparable checks to libsodium. Since both v2 and v4 have an overlap in cryptographic primitives, would it be ok if we move them to commons? I would also like to add the test vectors that libsodium uses, so we can be sure that our Bouncy Castle based implementation works as intended and accepts/rejects the same inputs.

Edit: The implementation can be nearly identical to v4. The only aspect that I'm still unsure about is the encoding of the private key. Libsodium expects 64 bytes that contain a concatenation of private and public key. The current implementation of tests for v4 seems to convert from this format using JcaPEMKeyConverter and passes the object containing the 32 bytes key (+2 bytes in internal representation). I might be missing something, but it seems that the private key format handling is not consistent as v2 takes the 64 bytes as-is.

robertguetzkow avatar Jan 05 '25 09:01 robertguetzkow

I will let you know once the PR is ready. Unfortunately, work is keeping me busy so I did not get around to it during the week and I currently have other obligations.

If you do have requirements regarding the organization of cryptographic functions and expected input format for v2 vs. v4, please let me know.

robertguetzkow avatar Jan 18 '25 15:01 robertguetzkow

Tuweni has been removed.

nbaars avatar Aug 07 '25 18:08 nbaars

@nbaars Thank you for fixing this and apologies for not following up. Unfortunately work has kept me more busy than anticipated and I didn't have time to work on this.

robertguetzkow avatar Aug 08 '25 16:08 robertguetzkow