XJar
Spring Boot JAR 安全加密运行工具,同时支持的原生JAR。
基于对JAR包内资源的加密以及拓展ClassLoader来构建的一套程序加密启动,动态解密运行的方案,避免源码泄露或反编译。
功能特性
无需侵入代码,只需要把编译好的JAR包通过工具加密即可。
完全内存解密,杜绝源码以及字节码泄露或反编译。
支持所有JDK内置加解密算法。
可选择需要加解密的字节码或其他资源文件,避免计算资源浪费。
环境依赖
JDK 1.7 +
使用步骤
jitpack.io
https://jitpack.io
com.github.core-lib
xjar
v2.0.5
// Spring-Boot Jar包加密
String password = "io.xjar";
XKey xKey = XKit.key(password);
XBoot.encrypt("/path/to/read/plaintext.jar", "/path/to/save/encrypted.jar", xKey);
// 危险加密模式,即不需要输入密码即可启动的加密方式,这种方式META-INF/MANIFEST.MF中会保留密钥,请谨慎使用!
String password = "io.xjar";
XKey xKey = XKit.key(password);
XBoot.encrypt("/path/to/read/plaintext.jar", "/path/to/save/encrypted.jar", xKey, XConstants.MODE_DANGER);
// Spring-Boot Jar包解密
String password = "io.xjar";
XKey xKey = XKit.key(password);
XBoot.decrypt("/path/to/read/encrypted.jar", "/path/to/save/decrypted.jar", xKey);
// Jar包加密
String password = "io.xjar";
XKey xKey = XKit.key(password);
XJar.encrypt("/path/to/read/plaintext.jar", "/path/to/save/encrypted.jar", xKey);
// 危险加密模式,即不需要输入密码即可启动的加密方式,这种方式META-INF/MANIFEST.MF中会保留密钥,请谨慎使用!
String password = "io.xjar";
XKey xKey = XKit.key(password);
XJar.encrypt("/path/to/read/plaintext.jar", "/path/to/save/encrypted.jar", xKey, XConstants.MODE_DANGER);
// Jar包解密
String password = "io.xjar";
XKey xKey = XKit.key(password);
XJar.decrypt("/path/to/read/encrypted.jar", "/path/to/save/decrypted.jar", xKey);
启动命令
// 命令行运行JAR 然后在提示输入密码的时候输入密码后按回车即可正常启动
java -jar /path/to/encrypted.jar
// 也可以通过传参的方式直接启动,不太推荐这种方式,因为泄露的可能性更大!
java -jar /path/to/encrypted.jar --xjar.password=PASS