pyarmor icon indicating copy to clipboard operation
pyarmor copied to clipboard

Invalid license file when the license is generated on a x86_64 machine and uploaded to arm based machine

Open pikonek opened this issue 3 years ago • 11 comments

So I have a system that supports x86_64 and ARM. I obfuscated my script using an outer license. I generated a license file on my x86_64 machine and uploaded it to my ARM-based machine, but I got an error Check license failed, Invalid input packet.

Does the generation of a license, platform specific?

Thank you.

pikonek avatar Jul 29 '22 01:07 pikonek

The generated license is platform independent. Make sure the same pyarmor version and same PyArmor License is used in both of 2 platforms.

jondy avatar Jul 29 '22 08:07 jondy

Yes I have same pyarmor on x86-64 and arm64 hardware, but when i generate an outer license on my x86-64 machine and copy the generated outer license to my arm64 machine it fails, says Invalid License, invalid packet.

pikonek avatar Aug 02 '22 12:08 pikonek

Or because I run pyarmor register <Regcode> on both machine?

pikonek avatar Aug 02 '22 13:08 pikonek

Check the output log carefully to find the problem.

jondy avatar Aug 02 '22 23:08 jondy

Here is the log:

Check license failed, Invalid input packet.

pikonek avatar Aug 04 '22 07:08 pikonek

That's all the log, after using the license generated from my laptop It's a hassle when you support two different architectures you need to login on both architectures to generate each licenses.

pikonek avatar Aug 04 '22 07:08 pikonek

I'm sure the license file generated by pyarmor is platform-independent.

jondy avatar Aug 04 '22 13:08 jondy

Make sure arm64 scripts are obfuscated by feature 3. I said checking the log means the output log of pyarmor command. It will show which feature dll is used and more other informations. About the feature of each platform, please refer to the online document in chapter support platforms

jondy avatar Aug 04 '22 13:08 jondy

Here is the logs:

INFO PyArmor Version 7.5.1 INFO Python 3.6.9 INFO Target platforms: Native INFO Source path is "/root/test" INFO Entry scripts are ['test.py'] INFO Use cached capsule /root/.pyarmor/.pyarmor_capsule.zip INFO Search scripts mode: Normal INFO Save obfuscated scripts to "dist" INFO Read product key from capsule INFO Obfuscate module mode is 2 INFO Obfuscate code mode is 1 INFO Wrap mode is 1 INFO Restrict mode is 1 INFO Advanced value is 0 INFO Super mode is False INFO Super plus mode is not enabled INFO Generating runtime files to dist/pytransform INFO Extract pytransform.key INFO Use outer license file INFO Copying /root/.pyarmor/platforms/linux/aarch64/3/_pytransform.so INFO Patch library dist/pytransform/_pytransform.so INFO Patch library file OK INFO Copying /usr/local/lib/python3.6/dist-packages/pyarmor/pytransform.py INFO Rename it to pytransform/init.py INFO Generate runtime files OK INFO Start obfuscating the scripts... INFO test.py -> dist/test.py INFO Insert bootstrap code to entry script dist/test.py INFO Obfuscate 1 scripts OK.

pikonek avatar Aug 10 '22 11:08 pikonek

This is the log when I generate the license on arm64

INFO PyArmor Version 7.5.1 INFO Python 3.6.9 INFO Generate licenses with capsule /root/.pyarmor/.pyarmor_capsule.zip ... INFO Output path of licenses: /home/licenses/ INFO The license file is generated in restrict mode INFO The license file is generated in period mode disabled INFO Generate license: CODE:TESTACTIVE;;;0;;; INFO Write license file: /home/licenses/TESTACTIVE/license.lic INFO Write information to /home/licenses/TESTACTIVE/license.lic.txt INFO Generate 1 licenses OK.

This is the log when I generate the license on amd64

INFO PyArmor Version 7.5.1 INFO Python 3.6.9 INFO Generate licenses for ... INFO Output path of licenses: /home/licenses/ INFO The license file is generated in restrict mode INFO The license file is generated in period mode disabled INFO Generate license: CODE:TESTACTIVE;;;0;;; INFO Write license file: /home/licenses/TESTACTIVE/license.lic INFO Write information to /home/licenses/TESTACTIVE/license.lic.txt INFO Generate 1 licenses OK.

The difference is on amd64 the line says "Generate licenses for ..." not "Generate licenses with capsule /root/.pyarmor/.pyarmor_capsule.zip ..."

pikonek avatar Aug 10 '22 11:08 pikonek

Use option -d, for example, pyarmor -d licenses r001

The key is that feature 0 isn't compatible with other features not zero.

jondy avatar Aug 10 '22 13:08 jondy

Please refer to https://pyarmor.readthedocs.io/en/latest/advanced.html#obfuscating-scripts-with-different-features

jondy avatar Aug 11 '22 03:08 jondy

Specifying --platform linux.aarch64 solved my problem even on native linux.aarch64 machine

pikonek avatar Aug 11 '22 04:08 pikonek