Druid-1.0.16.jar Alibaba's open source data connection pool Jar pack
PlainText password + private key (Privatekey) encryption = encrypted password
Encryption password + Public key (publickey) decryption = plaintext password
The program code is as follows:
Package com.t1;
Import Com.alibaba.druid.filter.config.ConfigTools;
public class Druidtest {public
static void Main (string[] args) throws Exception {
//password plaintext
String password = "1 2345 ";
The encrypted information of SYSTEM.OUT.PRINTLN ("Password [" +password+ "] is as follows: \ n");
String [] KeyPair = Configtools.genkeypair (a);
Private key
String privatekey = keypair[0];
Public key
String publickey = keypair[1];
Ciphertext
password = configtools.encrypt (privatekey, password) encrypted with the private key;
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);
}