Skip to content

Commit

Permalink
Merge pull request alibaba#938 from lstoars/master
Browse files Browse the repository at this point in the history
1.修复自定义加密key的bug;2.修改生成加密密码的main方法。
  • Loading branch information
wenshao committed Aug 21, 2015
2 parents 17e1587 + f2f2479 commit 9007375
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ public void decrypt(DruidDataSource dataSource, Properties info) {
public PublicKey getPublicKey(Properties connectinProperties, Properties configFileProperties) {
String key = null;
if (configFileProperties != null) {
configFileProperties.getProperty(CONFIG_KEY);
key = configFileProperties.getProperty(CONFIG_KEY);
}

if (StringUtils.isEmpty(key) && connectinProperties != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,11 @@ public class ConfigTools {
public static final String DEFAULT_PUBLIC_KEY_STRING = "MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAKHGwq7q2RmwuRgKxBypQHw0mYu4BQZ3eMsTrdK8E6igRcxsobUC7uT0SoxIjl1WveWniCASejoQtn/BY6hVKWsCAwEAAQ==";

public static void main(String[] args) throws Exception {
String password = args[0];
System.out.println(encrypt(password));
String password = args[0];
String[] arr = genKeyPair(512);
System.out.println("privateKey:" + arr[0]);
System.out.println("publicKey:" + arr[1]);
System.out.println("password:" + encrypt(arr[0], password));
}

public static String decrypt(String cipherText) throws Exception {
Expand Down

0 comments on commit 9007375

Please sign in to comment.