package juint;

import com.alibaba.druid.filter.config.ConfigTools;

public class DruidTest {

    public static void main(String[] args) throws Exception {
        // 密码明文
        String password = "1q2w3e4r";

        System.out.println("密码[ " + password + " ]的加密信息如下:\n");

        String[] keyPair = ConfigTools.genKeyPair(512);
        // 私钥
        String privateKey = keyPair[0];
        // 公钥
        String publicKey = keyPair[1];
        // 用私钥加密后的密文
        password = ConfigTools.encrypt(privateKey, password);

        System.out.println("privateKey:" + privateKey);
        System.out.println("publicKey:" + publicKey);
        System.out.println("password:" + password);
        String decryptPassword = ConfigTools.decrypt(publicKey, password);
        System.out.println("decryptPassword:" + decryptPassword);

    }
}

 

相关文章:

  • 2022-02-10
  • 2021-06-17
  • 2021-10-07
  • 2021-11-02
  • 2022-12-23
  • 2022-12-23
  • 2021-08-31
猜你喜欢
  • 2021-08-06
  • 2021-08-09
  • 2022-12-23
  • 2022-12-23
  • 2021-07-16
  • 2021-07-30
相关资源
相似解决方案