使用SpringBoot项目使用jasypt进行加密解密

public class TestMain {

    public static void main(String[] args) {
        BasicTextEncryptor textEncryptor = new BasicTextEncryptor();
        textEncryptor.setPassword("123");//放置密钥
        String password = textEncryptor.encrypt("asd");//具体密码
        System.out.println(password);
        String x = "ENC("+password+")";
        System.out.println(x);
        if (PropertyValueEncryptionUtils.isEncryptedValue(x)){
            System.out.println(PropertyValueEncryptionUtils.decrypt(x,textEncryptor));
        }
    }
}

 

你可能感兴趣的:(java)