|
@@ -1,48 +0,0 @@
|
|
|
-package com.fdkankan.manage_jp.util;
|
|
|
-
|
|
|
-
|
|
|
-import org.jasypt.encryption.pbe.PooledPBEStringEncryptor;
|
|
|
-import org.jasypt.encryption.pbe.StandardPBEByteEncryptor;
|
|
|
-import org.jasypt.encryption.pbe.StandardPBEStringEncryptor;
|
|
|
-import org.jasypt.encryption.pbe.config.SimpleStringPBEConfig;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.beans.factory.annotation.Value;
|
|
|
-import org.springframework.stereotype.Component;
|
|
|
-
|
|
|
-/**
|
|
|
- * @author ys
|
|
|
- * @create 2021/9/22
|
|
|
- * @desc Jasypt安全框架加密类工具包
|
|
|
- **/
|
|
|
-public class EncryptDecrypt {
|
|
|
-
|
|
|
- public static void main(String[] args) {
|
|
|
- StandardPBEStringEncryptor standardPBEStringEncryptor = new StandardPBEStringEncryptor();
|
|
|
- //配置文件中配置如下的算法
|
|
|
- standardPBEStringEncryptor.setAlgorithm("PBEWithMD5AndDES");
|
|
|
- //配置文件中配置的password
|
|
|
- standardPBEStringEncryptor.setPassword("4dage168...");
|
|
|
- //要加密的文本
|
|
|
- String password = standardPBEStringEncryptor.encrypt("JK20220120%JIK");
|
|
|
- String name = standardPBEStringEncryptor.encrypt("LTAI5tJZBJwP5qazE6b3b4Gr");
|
|
|
- String redisPassword = standardPBEStringEncryptor.encrypt("zSQCG0yyvRJISPokNZGhbhaAfh4hGX");
|
|
|
- String redisPassword1 = standardPBEStringEncryptor.encrypt("admin");
|
|
|
- String redisPassword2 = standardPBEStringEncryptor.encrypt("admin1231");
|
|
|
- //将加密的文本写到配置文件中
|
|
|
- System.out.println("name=" + name);
|
|
|
- System.out.println("password=" + password);
|
|
|
- System.out.println("redisPassword=" + redisPassword);
|
|
|
- System.out.println("redisPassword=" + redisPassword1);
|
|
|
- System.out.println("redisPassword=" + redisPassword2);
|
|
|
-
|
|
|
- //要解密的文本
|
|
|
- //String name2 = standardPBEStringEncryptor.decrypt("FarrmxSQX5uwtH/NZRxy+g==");
|
|
|
- //String password2 = standardPBEStringEncryptor.decrypt("vhiaYB1gl9zPj16yu7uMkA==");
|
|
|
- // String redisPassword2 = standardPBEStringEncryptor.decrypt("ZII7UphhbVuJ8c3oxPUeyw==");
|
|
|
- //解密后的文本
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-}
|
|
|
-
|