christian-schlichtherle / truelicense

An open source engine for license management on the Java Virtual Machine.
https://truelicense.namespace.global
Apache License 2.0
319 stars 66 forks source link

Loading V1 license from de.schlichtherle.truelicense:truelicense-core:1.33 in v4.0.1 #7

Closed nikolakurtic closed 4 years ago

nikolakurtic commented 4 years ago

Hi, I'm trying to migrate from 1.33 to 4.0.1 without changing license files. I tried archetype code from keymgr and keymgr-service for loading but I get "java.util.zip.ZipException: Not in GZIP format" when I try to install license.

What's the minimal running code to do this? Thanks!

christian-schlichtherle commented 4 years ago

This error usually indicates that the encryption password is wrong. Please check all the archetype parameters to match the original code and also you need to import the key stores from the old code to the new code. The new code will auto generate key stores on the first build so you need to replace these. The are in the */src/main/resources folder.

nikolakurtic commented 4 years ago

I double checked passwords and keystores. But there's something else, static LicenseManagementContextBuilder builder() has .compression(gzip()) flag, I guess it expects gzipped license bytes?

nikolakurtic commented 4 years ago

Thanks for the quick answer, I forgot to mention :)

christian-schlichtherle commented 4 years ago

Yes, that’s expected and as far as I remember it has always been this way. It would surprise me if your license key filed would not be compressed. You should be able to override the compression with something like .compression(identity()) or so (I’m recollecting my memory here, so I may be wrong).

nikolakurtic commented 4 years ago

Ok, got it. Now I get "org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog." fro somewhere deep in lib.

christian-schlichtherle commented 4 years ago

When processing a license key file, the first step is to decrypt it, then it gets decompressed, then it gets deserialized from XML (for the V1 license key format) and then a lot more steps (they are documented in the Javadoc for the package if you care). So if the third step fails for a valid license key file, then the configuration of the first two steps must be wrong. Please check all the parameters again. Sorry for the inconvenience.

christian-schlichtherle commented 4 years ago

Is this issue resolved?

nikolakurtic commented 4 years ago

No, I cannot pass the decryption step. I tried everything.

nikolakurtic commented 4 years ago

I can show you v1.33 loading code.

christian-schlichtherle commented 4 years ago

Please provide an example to reproduce the issue.

nikolakurtic commented 4 years ago

There's interesting thing that might be the issue. When I list my key in store it says that it's SHA1withDSA algo, but TrueLicense for V1 licenses only supports PBEWithMD5AndDES.

christian-schlichtherle commented 4 years ago

These are different things. SHAwithDSA is the signature algorithm while PBEWithMD5AndDES is for the encryption.

nikolakurtic commented 4 years ago

Truelicense.zip

I have uploaded 2 projects. First is using 1.29 lib version for generating a license and the other is using 4.0.1 version to verify. Verifying is failing. If you can take a look. Thanks!

christian-schlichtherle commented 4 years ago

I tested your code. There are some minor bugs in your code, which I will fix and upload. However, there also seems to be a non-trivial bug in TrueLicense or Fun I/O. I will get back to you with more details.

nikolakurtic commented 4 years ago

Ok, thanks!

christian-schlichtherle commented 4 years ago

There is a bug in Fun I/O which affects TrueLicense and your code. It will take a while to fix it.

nikolakurtic commented 4 years ago

Hi, I saw that you are working on Fun I/O. If I can help with testing or any other way?

christian-schlichtherle commented 4 years ago

I have already updated Fun I/O and now I need to update TrueLicense, which is the trickier part because I must not break the compatibility with existing license keys.

christian-schlichtherle commented 4 years ago

First of all, thank you very much for your posting! Indeed, you found a critical bug in TrueLicense, which has been addressed in version 4.0.3. I have also fixed the issues in your demo code - please refer to this attachment: Truelicense.zip