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

Question: Backward binary compatibility of licenses #26

Open cliviu opened 2 years ago

cliviu commented 2 years ago

Hi,

I have some licenses generated with this library:

    <groupId>de.schlichtherle.truelicense</groupId>
    <artifactId>truelicense-core</artifactId>
    <version>1.33</version>

are they still compatible (can the licenses still be verified) with the License Manager from


    <groupId>global.namespace.truelicense</groupId>
    <artifactId>truelicense-core</artifactId>
    <version>4.0.3</version>

``` ?
Thanks !
cliviu commented 2 years ago

The reason why I'm asking this is that I always get this exception when trying to install an old license: java.util.zip.ZipException: Not in GZIP format at java.base/java.util.zip.GZIPInputStream.readHeader(GZIPInputStream.java:165) at java.base/java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:79) at global.namespace.fun.io.bios.GZIPFilter.lambda$input$1(GZIPFilter.java:39) at global.namespace.fun.io.api.Socket.lambda$map$0(Socket.java:138) at global.namespace.fun.io.api.Socket.lambda$map$0(Socket.java:136) at global.namespace.fun.io.api.Socket.lambda$map$0(Socket.java:136) at global.namespace.truelicense.core.Filters$1.lambda$input$1(Filters.java:52) at global.namespace.fun.io.api.Socket.lambda$map$0(Socket.java:136) at global.namespace.fun.io.api.Socket.apply(Socket.java:123) at global.namespace.fun.io.bios.XMLCodec$1.decode(XMLCodec.java:62) at global.namespace.truelicense.core.TrueLicenseManagementContext$TrueLicenseManagerParameters$TrueLicenseManager.repositoryModel(TrueLicenseManagementContext.java:829) at global.namespace.truelicense.core.TrueLicenseManagementContext$TrueLicenseManagerParameters$TrueLicenseManager.repositoryController(TrueLicenseManagementContext.java:820) at global.namespace.truelicense.core.TrueLicenseManagementContext$TrueLicenseManagerParameters$TrueLicenseManager.authenticate(TrueLicenseManagementContext.java:813) at global.namespace.truelicense.core.TrueLicenseManagementContext$TrueLicenseManagerParameters$CachingLicenseManager.authenticate(TrueLicenseManagementContext.java:677) at global.namespace.truelicense.core.TrueLicenseManagementContext$TrueLicenseManagerParameters$TrueLicenseManager.decodeLicense(TrueLicenseManagementContext.java:808) at global.namespace.truelicense.core.TrueLicenseManagementContext$TrueLicenseManagerParameters$TrueLicenseManager.lambda$install$1(TrueLicenseManagementContext.java:757) at global.namespace.truelicense.core.TrueLicenseManagementContext.callChecked(TrueLicenseManagementContext.java:79) at global.namespace.truelicense.core.TrueLicenseManagementContext.access$800(TrueLicenseManagementContext.java:37) at global.namespace.truelicense.core.TrueLicenseManagementContext$TrueLicenseManagerParameters$TrueLicenseManager.install(TrueLicenseManagementContext.java:752) at global.namespace.truelicense.core.TrueLicenseManagementContext$TrueLicenseManagerParameters$CachingLicenseManager.install(TrueLicenseManagementContext.java:629)

christian-schlichtherle commented 2 years ago

It's possible if you configure the V1 license key format.

christian-schlichtherle commented 2 years ago

You can look the details up in the test code.

cliviu commented 2 years ago

Sure, is already done <licenseKeyFormat>V1</licenseKeyFormat>. Then I had to set this also <pbeAlgorithm>PBEWithMD5AndDES</pbeAlgorithm> in order to compile the archetype.

But the problem occurs also with the V1 format set in the pom.xml of the archetype.

cliviu commented 2 years ago

I still have the same problem ... The existing tests from the artifact are generating a license and then installing, loading, verifying and uninstalling. But there is no test which uses a legacy license generated with the old version 1.XX of the truelicense to install/load ... My test fails when using a legacy license generated with version 1.33. Any ideas ?

cliviu commented 2 years ago

Any updates on this? here is my test:

        public void myTestV1() throws Exception { 
              mycompany.keygen.LicenseManager[] licenseManagers = mycompany.keygen.LicenseManager.values();
              int allLicenseManagers = licenseManagers.length;

                for(int i = 0; i < allLicenseManagers; ++i) {
                        LicenseManager manager = licenseManagers[i];                        
                        String edition = manager.name();

                        File licenseKey = new File("/home/tmp/licenseV1.lic" );

                        String licenseKeyPath = licenseKey.getPath();

                        mycompany.keymgr.Main.process(new String[]{"install", licenseKeyPath});

                        try {
                                mycompany.keymgr.Main.process(new String[]{"load"});
                                mycompany.keymgr.Main.process(new String[]{"verify"});
                        } finally {
                                mycompany.keymgr.Main.process(new String[]{"uninstall"});
                        }
                }

The test throws the exception from the previous post when using a version generated with version 1.33 of the license but is ok with a license generated with the latest program version.