如何在Spring Boot中配置数据库密码加密

embedded/2024/9/23 9:43:30/

如何在Spring Boot中配置数据库密码加密? · alibaba/druid Wiki · GitHub

使用ConfigFilter · alibaba/druid Wiki · GitHub

巧用Druid数据源实现数据库连接密码的加密解密功能

import com.alibaba.druid.filter.config.ConfigTools;public class Testttt {public static void main(String[] args) throws Exception {String password = "123456";System.out.println("明文密码: " + password);String[] keyPair = ConfigTools.genKeyPair(512);//私钥String privateKey = keyPair[0];System.out.println("privateKey:" + privateKey);//公钥String publicKey = keyPair[1];System.out.println("publicKey:" + publicKey);//用私钥加密后的密文password = ConfigTools.encrypt(privateKey, password);System.out.println("password:" + password);String decryptPassword = ConfigTools.decrypt(publicKey, password);System.out.println("解密后:" + decryptPassword);}
}


http://www.ppmy.cn/embedded/26112.html

相关文章

LeetCode 刷题 -- Day 6

今日题目 题目难度备注102. 二叉树的层序遍历 中等一招鲜吃遍天107. 二叉树的层序遍历 II )中等199. 二叉树的右视图 中等637. 二叉树的层平均值简单429. N 叉树的层序遍历中等515. 在每个树行中找最大值中等116. 填充每个节点的下一个右侧节点指针中等104. 二叉树…

【Kotlin】Channel简介

1 前言 Channel 是一个并发安全的阻塞队列,可以通过 send 函数往队列中塞入数据,通过 receive 函数从队列中取出数据。 当队列被塞满时,send 函数将被挂起,直到队列有空闲缓存;当队列空闲时,receive 函数将…

CLIP论文笔记:Learning Transferable Visual Models From Natural Language Supervision

导语 会议:ICML 2021链接:https://proceedings.mlr.press/v139/radford21a/radford21a.pdf 当前的计算机视觉系统通常只能识别预先设定的对象类别,这限制了它们的广泛应用。为了突破这一局限,本文探索了一种新的学习方法&#x…

Java图搜索算法详解:探索图论中的奥秘

图搜索算法是图论领域的重要内容,它在解决各种实际问题中起着关键作用。本文将详细介绍几种常见的Java图搜索算法,包括深度优先搜索(DFS)、广度优先搜索(BFS)以及Dijkstra算法,帮助读者深入理解…

ES6之rest参数、扩展运算符

文章目录 前言一、rest参数二、扩展运算符 1.将数组转化为逗号分隔的参数序列2.应用总结 前言 rest参数与arguments变量相似。ES6引入rest参数代替arguments,获取函数实参。扩展运算符能将数组转化为参数序列。 一、rest参数 function namelist1() {console.log(ar…

Nginx从入门到精通

第一章> 1、概述 2、正反向代理 3、负载均衡 4、Nginx安装 第二章> 5、常用命令 6、实战总结 7、前端部署 ***************************************…

cartographer问题处理

问题1 : CMake Error: The following variables are used in this project, but they are set to NOTFOUND. Please set them or make sure they are set and tested correctly in the CMake files: GMOCK_LIBRARY (ADVANCED)linked by target "time_conversion_test&quo…

Android Studio的settings.gradle配置

pluginManagement { repositories { maven { url ‘https://maven.aliyun.com/nexus/content/groups/public/’} maven { url ‘https://maven.aliyun.com/nexus/content/repositories/gradle-plugin’} maven { url ‘https://maven.aliyun.com/nexus/content/repositories/ap…