使用kettle转换中的JavaScript对密码进行加密和解密


日常开发中,为了确保账号和密码的安全,时常要对密码进行加密和解密。然而kettle是怎么对密码进行加密和解密的呢?

下面的代码需要再转换中的JavaScript中运行。

var encrypted_password = 'not encrypted';

加密(js中调用):
encrypted_password = "Encrypted " + Packages.org.pentaho.di.core.encryption.Encr.encryptPassword(clear_password);

命令行生成密码:F:\pdi-open-3.1.0-826/Encr.bat

F:\pdi-open-3.1.0-826>encr -kettle abc
Encrypted 2be98afc86aa7f2e4cb79ce10be93add9
F:\pdi-open-3.1.0-826>

解密:
if(value.startsWith("Encrypted ")){
      setValue = org.pentaho.di.core.encryption.Encr.decryptPasswordOptionallyEncrypted(value);
}

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM