Spring+mysql+druid对数据库连接的用户名密码加密

时间:2024-04-04 08:24:55


1.首先进入到druid-1.0.26.jar这个jar包所在的位置,然后打开cmd,运行命令:java -cp druid-1.0.26.jar com.alibaba.druid.filter.config.ConfigTools 123456

Spring+mysql+druid对数据库连接的用户名密码加密

2.分别得到:privateKey、publicKey、password:

privateKey:MIIBVQIBADANBgkqhkiG9w0BAQEFAASCAT8wggE7AgEAAkEAhL1ZBSEb+NIarn0/ZMWZT
ieBJV3l2x3EHB4xHQ0ldn/Nk5odL3LsKw8OQyKUfp+bkqZLBg9U2T4AuLchly1pqwIDAQABAkBLIG+Vu
5t9REzdnP2YJ04RMcKiR3akgUBRObVKX/poCiusJvvrdLIP4adfRRv40sw0tgaSktR6shDwefF/5ayBA
iEA91jBjWxE6sj/rOp7SurrhHTFkPjH041kjD3AX62wuDsCIQCJYirpsHU4l9ctcE8y19GKNryC444vg
4PnQLiEgFZtUQIhANdRuXR+auQkQ4ZovRmztYCiEpaoK3Q7Iut+mifwUOWfAiA3mojdznKTNjl8BZG4d
Us00pSXsTwSFPuk9Df6QOs6EQIhAIO163hfYMiyjEJLcent6mINAexO9yC2ZKu5BQx2Z79n


publicKey:MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAIS9WQUhG/jSGq59P2TFmU4ngSVd5dsdxBweMR
0NJXZ/zZOaHS9y7CsPDkMilH6fm5KmSwYPVNk+ALi3IZctaasCAwEAAQ==


password:eezigWTr+zZO1t4+N5O3cmhaSPxChEuhApBFg1JoBDJSwnfplMJlFBAKIgY3Oq8qdo+/nF6
TLFUUTPSpmPgNow==

3.在spring内填写如图:

Spring+mysql+druid对数据库连接的用户名密码加密

3.这个config.decrypt.key对应的值是publicKey。

Spring+mysql+druid对数据库连接的用户名密码加密