kettlle9.3 密码加解密
kettle cmd
encr.sh -kettle 123
kettle 客户端 javascript 组件
- 核心对象->新建->javascript 脚本->获取变量->限制 1 ->生成记录1
//Script here
//加密
var setValue;
setValue = Packages.org.pentaho.di.core.encryption.Encr.encryptPassword('123456');
java
import org.pentaho.di.core.KettleEnvironment;
import org.pentaho.di.core.encryption.Encr;
KettleEnvironment.init();
System.out.println(Encr.encryptPassword("123"));
源码简化版本
- Kettle 会查找 kettle.properties ENC_PREFIX 和 ENC_SUFFIX
- 但是默认为空 envSeed 是固定值 也可以环境变量 KETTLE_TWO_WAY_PASSWORD_ENCODER_SEED 指定
- 参考源码 /src/main/resources/libs/pentaho-encryption-support-9.3.0.0-428.jar!/org/pentaho/support/encryption/KettleTwoWayPasswordEncoder.class
String password = "123";
String envSeed = "0933910847463829827159347601486730416058";
String password_encode = ((new BigInteger(envSeed)).xor(new BigInteger(password.getBytes()))).toString(16);
System.out.println(password_encode);
本文来自博客园,作者:vx_guanchaoguo0,转载请注明原文链接:https://www.cnblogs.com/guanchaoguo/p/17435437.html