Java jar package Encryption and use

Source: Internet
Author: User

Because of the project requirements (although I think the code I wrote is not technically advanced ...) ), a well-written jar package requires some encryption

There are two ways to do this, a wonderful flower, a universal

1. Modify the jar file directly:

Specific steps:

Inserting code into code that does not run

1     Private class invalid{2         Private Invalid () {3             4         }5     }

Use Eclipse to package files, right-click Export > Java > JAR file > Finish

Open the jar package using the decompression software. Notepad opens ... $Invalid. class file, remove the D inside

  # Best to save the outside, and then the inside of the deletion and then dragged in, seemingly cannot be saved directly

Encryption Effect:

It seems that after unpacking the class file can still be cracked

Method defects:

Above

2. Using the Proguard clutter tool

Specific steps:

  Download Proguard

Recommended Download 5. x version, which is more compatible with JAVA8, and 4. x version and JAVA7 compatible

  # Otherwise there will be an error unsupported class version number [52.0]

can be downloaded on csdn (http://download.csdn.net/download/kong_gu_you_lan/9637131)

  # because the next one has done a long reward mission. There is a mailbox verification success out of the two words is what, directly filled out "login", haha

Unzip after download, open Proguard5.x>bin>proguardgui.bat.

  Using Proguard

on the left input/output, add input on the right adds the need to encrypt the jar package, add output to name an export jar package, below the library, there is a default Rt.jar, if not introduced what custom jar file, directly this default is good

Left obfuscation, select these items in the diagram, where the 2nd, 3 tick corresponding file a.txt is a confusing function name, B.txt is confusing the class name

  # In fact, it's just a couple of class names and function names, one row for a name

  

   Left shrinking, top shrink removed.

  # Otherwise the error will be as follows, the output jar is empty. Did you specify the proper '-keep ' options?

Other default, click left process > Process encryption complete

Encryption Effect:

It's OK

Method defects:

Unable to fight against more powerful anti-compilation software

===================================================================

Supplement: Just know that the partner uses. NET programming, jar package can not be used, need to convert to DLL format, here also by the way.

Conversion steps:

Download IKVM Conversion Tool http://www.ikvm.net/download.html

Unzip, and set System > Advanced system Settings > Environment variables > System Variables Path: Add bin file paths in IKVM

Conversion command:ikvmc-out:xxxx.dll Xxx.jar

Reference blog:

http://blog.csdn.net/a351945755/article/details/21953651 jar converted to DLL

Java jar package Encryption and use

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.