Invalid licence signature

Hello,
I have a licence file for ASPOSE TOTAL, which is working fine with aspose-pdf: 23.8 or aspose-words:23.8:jdk16, but does not work with aspose-imaging:23.8:jdk16.

With this code :

byte[] license = Files.readAllBytes(Paths.get(“Aspose.Total.Java.lic”));

com.aspose.imaging.License imagingLicense = new com.aspose.imaging.License();
try (ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(license)) {
    imagingLicense.setLicense(byteArrayInputStream);
}

I obtain this error :

class com.aspose.imaging.coreexceptions.FrameworkException: Invalid license signature. Please make sure the license file was not modified.

What is wrong vs others aspose products ?

1 Like

@gbe

The error message “Invalid license signature” typically indicates that there is an issue with the license file being used for Aspose.Imaging. Here are some steps you can take to troubleshoot and resolve this issue:

  1. Verify License File: Ensure that the license file you are using is not corrupted or modified. You can do this by comparing the size of the license file on disk with the length of the byte array you read in your code. They should match.

  2. Correct License Usage: Make sure you are using the correct method to set the license. In your case, you are using License.setLicense(InputStream), which is correct. However, ensure that the ByteArrayInputStream is positioned at the start before calling setLicense.

  3. Check for Compatibility: Since the license works with other Aspose products like Aspose.PDF and Aspose.Words, confirm that the license is indeed valid for Aspose.Imaging as well. Sometimes, licenses are specific to certain products or versions.

  4. Test with a Simple Example: You can test the license setting with a minimal example to isolate the issue. Here’s a simple code snippet to verify if the license can be set correctly:

    import com.aspose.imaging.License;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    import java.io.ByteArrayInputStream;
    
    public class LicenseTest {
        public static void main(String[] args) {
            try {
                byte[] license = Files.readAllBytes(Paths.get("C:\\GBO\\devs\\tmp\\gbo\\Aspose.Total.Java.lic"));
                License imagingLicense = new License();
                try (ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(license)) {
                    imagingLicense.setLicense(byteArrayInputStream);
                }
                System.out.println("License set successfully.");
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
    
  5. Contact Support: If the issue persists after checking the above points, consider reaching out to Aspose support for further assistance. They can provide more specific guidance based on your license and product version.

By following these steps, you should be able to identify the cause of the “Invalid license signature” error and resolve it.

Sources:
[1]: Error in startup
[2]: Invalid license signature after updating to Aspose.Imaging 23.6

1 Like

That’s exactly what I have done, and this does not work. Is there something different in signature part of licence file, from ASPOSE TOTAL vs ASPOSE IMAGING ?

@gbe, We will study your question and respond as soon as possible.

Hello, @gbe
We are sorry that you faced such a difficulty.
Please, let me know the following information about your license.
OrderID
SerialNumber
SubscriptionExpiry

And just for a test, please try to use the license the following way

com.aspose.imaging.License imagingLicense = new com.aspose.imaging.License();
imagingLicense.setLicense("Aspose.Total.Java.lic");

Thank you in advance and wait for your reply.

Hello evgeniy,

Even with using the following code :

com.aspose.imaging.License imagingLicense = new com.aspose.imaging.License();
imagingLicense.setLicense("Aspose.Total.Java.lic");

the is the same :

class com.aspose.imaging.coreexceptions.FrameworkException: Invalid license signature. Please make sure the license file was not modified.
com.aspose.imaging.License$a.a(Unknown Source)
com.aspose.imaging.License.setLicense(Unknown Source)
com.aspose.imaging.License$setLicense$0.call(Unknown Source)

Here are required informations about my license :
OrderID: 220912125804
SerialNumber: f909097e-1512-4c7a-82f2-b7fcba10a980
SubscriptionExpiry: 20230912

Regards

Hi, @gbe
Thank you for providing the information.
Unfortunately, we can’t find any reason for such a behavior. :frowning:
Could you provide the Product value from your license?

Hello evgeniy,

Sure, here it is :

<Product>Aspose.Total for Java</Product>

Regards

Hello @gbe,
I still can’t reproduce the issue :frowning:
Could you provide your license as compressed and protected by a password file placed on your cloud drive? I fear this is the only way to understand what’s going on.

Hello,

Please, could you send me an email to my email address (the one in my account settings) to set up the transfer of the zip file ?

Regards

Hello, @gbe
I still can’t reproduce the issue even with your license file. :frowning:
Could you provide the output of the following code

import com.aspose.imaging.BuildVersionInfo;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.io.ByteArrayInputStream;
import java.io.IOException;

public class TestLicense
{
	public static void main(String[] args) throws IOException
	{
		System.out.println("Product: " + BuildVersionInfo.PRODUCT);
		System.out.println("Version: " + BuildVersionInfo.ASSEMBLY_VERSION);
		System.out.println("Release date: " + BuildVersionInfo.RELEASE_DATE);
		System.out.println("OS: " + System.getProperty("os.name"));
		
	        new License().setLicense("Aspose.Total.Java.lic");
		
		System.out.println("\nLicense is OK!");
	}
}

It’s very weird…

The output of the execution of this TestLicense class is the following :

> Task :TestLicense.main() FAILED
Product: Aspose.Imaging for Java
Version: 23.8.0
Release date: 2023.08.25
OS: Windows 11
Exception in thread "main" class com.aspose.imaging.coreexceptions.FrameworkException: Invalid license signature. Please make sure the license file was not modified.
com.aspose.imaging.License$a.a(Unknown Source)
com.aspose.imaging.License.setLicense(Unknown Source)
TestLicense.main(TestLicense.java:17)
	at com.aspose.imaging.License$a.a(Unknown Source)
	at com.aspose.imaging.License.setLicense(Unknown Source)
	at TestLicense.main(TestLicense.java:17)

Execution failed for task ':TestLicense.main()'.
> Process 'command 'C:/GBO/outils/Java/Coretto/jdk17.0.7_7/bin/java.exe'' finished with non-zero exit value 1

image.png (38.4 KB)

@evgeniy.sidenko : for your information, it seems the license file is working until aspose-imaging-23.5-jdk16, and i get the license file error from version 23.6…

@gbe
Thank you for the details.
I have tried to reproduce the issue on my side but still can’t. I even tried to use Amazon Corretto 1.7 JDK and there is no expectable result.
Could you send me your aspose-imaging-23.8-jdk16.jar ?

I have reproduced the issue with aspose-imaging 23.6 and 23.7… that i have retrieved here : Aspose Repository Browser /java/repo/com/aspose/aspose-imaging/

As a work around, the previous version (23.5) is working with my license file, and it’s doing what i need to do, so it’s OK. I just don’t understand why there is a bug from 23.6…

@gbe

I just don’t understand why there is a bug from 23.6…

Me either :expressionless:
Thank you for the additional information, I will continue analyzing the issue.