zoukankan      html  css  js  c++  java
  • Jasypt加解密

    package com.xingyi.bos.utils;
    
    import com.xingyi.bos.ZjBosApplication;
    import org.jasypt.encryption.StringEncryptor;
    import org.junit.Test;
    import org.junit.runner.RunWith;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.boot.test.context.SpringBootTest;
    import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
    import org.springframework.test.context.junit4.SpringRunner;
    
    /**
     * Created by Administrator on 2021/9/2.
     */
    @RunWith(SpringRunner.class)
    @SpringBootTest(classes = {ZjBosApplication.class})
    public class JasyptApplicationTests {
        @Autowired
        private StringEncryptor stringEncryptor;
    
        @Test
        public void contextLoads() {
            //加密方法
    //        System.out.println(stringEncryptor.encrypt("123456"));
    //        System.out.println(stringEncryptor.encrypt("123456"));
    
            //解密方法 ENC(c/Y2PZMYWlFjx7IbNCt8rhsuwLYVWhMI)中的c/Y2PZMYWlFjx7IbNCt8rhsuwLYVWhMI
            System.out.println(stringEncryptor.decrypt("H+u9Bhik38B+UdPZDMLz/BXksIb3KplomVWN/JvQOZI="));
        }
    
        /*
        4n8hBnSULbLF5FJrC/kMxA==
        MWzRCtyFK0AXpH6g99GOTA==
        RXy31IPONj1nwV01P0+TaA==
        a6EH3950mQYTHtWAop6wDw==
         */
    }
  • 相关阅读:
    SQL
    第九章
    第三章 表单
    第二章 表格,列表,媒体元素
    HTML5基础
    Java第一本书总复习
    字符串
    人机猜拳
    类的无参方法
    类和对象
  • 原文地址:https://www.cnblogs.com/super-chao/p/15241942.html
Copyright © 2011-2022 走看看