public static void testEncryption(){
StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor();
EnvironmentStringPBEConfig config = new EnvironmentStringPBEConfig();
config.setAlgorithm("PBEWithMD5AndDES");
config.setPassword("1145305c67154b5b9e2a13cdddab39e3");
encryptor.setConfig(config);
String plaintext="root";
String encrypttext=encryptor.encrypt(plaintext);
System.out.println(plaintext + " : " + encrypttext);
}
public static void testDecryption(){
StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor();
EnvironmentStringPBEConfig config = new EnvironmentStringPBEConfig();
config.setAlgorithm("PBEWithMD5AndDES");
config.setPassword("1145305c67154b5b9e2a13cdddab39e3");
encryptor.setConfig(config);
String encrypttext="CfptaIDXbPWKa9kvAAvDWg==";
String plaintext=encryptor.decrypt(encrypttext);
System.out.println(encrypttext + " : " + plaintext);
}