对jar包加密

1. 背景

需要对jar包加密,防止反编译

2. 步骤

pom

    <!-- 设置 jitpack.io 仓库 -->
    <repositories>
        <repository>
            <id>jitpack.io</id>
            <url>https://jitpack.io</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
            <version>1.10</version>
        </dependency>

        <dependency>
            <groupId>com.github.core-lib</groupId>
            <artifactId>xjar</artifactId>
            <version>v2.0.6</version>
        </dependency>
<!--        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-compress</artifactId>
            <version>1.18</version>
        </dependency>
        <dependency>
            <groupId>com.github.core-lib</groupId>
            <artifactId>loadkit</artifactId>
            <version>v1.0.0</version>
        </dependency>-->
    </dependencies>

测试代码

        String password = "123456";
        XKey xKey = XKit.key(password);

        XBoot.encrypt("D:\\encryption-0.0.1.jar", "D:\\xjar-encryption-0.0.1.jar", xKey);

3. 引用

实际使用方案:使用xjar 对Spring-Boot JAR 包加密运行工具,避免源码泄露以及反编译
java对一个jar包加密
jar包加密方案分享
jar包加密方案

4.拓展

“限制用户的使用时间,按时间付费”则涉及license技术

posted @ 2022-10-17 15:16  钱塘江畔  阅读(333)  评论(0编辑  收藏  举报