add configTool

This commit is contained in:
wenshao
2012-08-16 14:52:48 +08:00
parent f3d655e5df
commit 85d6db123d
2 changed files with 162 additions and 0 deletions
@@ -0,0 +1,29 @@
package com.alibaba.druid.bvt.filter.config;
import java.util.Map;
import junit.framework.Assert;
import junit.framework.TestCase;
import com.alibaba.druid.filter.config.ConfigTool;
public class ConfigToolTest extends TestCase {
public void test_configTool() throws Exception {
Map<String, String> result = ConfigTool.gen(1024);
String publicKey = result.get("publicKey");
String privateKey = result.get("privateKey");
System.out.println("publicKey : " + publicKey);
System.out.println("privateKey : " + privateKey);
String cipher = ConfigTool.encrypt(privateKey, "abcdef").get("result");
System.out.println("cipher : " + cipher);
String plain = ConfigTool.decrypt(publicKey, cipher).get("result");
System.out.println("plain : " + plain);
Assert.assertEquals("abcdef", plain);
}
}