content: package com.alibaba.druid.bvt.filter.config;
  
  import com.alibaba.druid.filter.config.ConfigTools;
  import junit.framework.TestCase;
  
  import java.util.Random;
  
  public class ConfigToolsTest extends TestCase {
      public void test_0() throws Exception {
          String plainText = "abcdef";
          String cipherText = ConfigTools.encrypt(plainText);
          String decipherText = ConfigTools.decrypt(cipherText);
  
          assertEquals(plainText, decipherText);
      }
  
      public void test_genKeys() throws Exception {
          String plainText = Long.toString(new Random().nextLong());
          String[] keys = ConfigTools.genKeyPair(512);
  
          String cipherText = ConfigTools.encrypt(keys[0], plainText);
          assertEquals(plainText, ConfigTools.decrypt(keys[1], cipherText));
      }
  
      public void test_genKeys1024() throws Exception {
          String plainText = Long.toString(new Random().nextLong());
          String[] keys = ConfigTools.genKeyPair(1024);
  
          String cipherText = ConfigTools.encrypt(keys[0], plainText);
          assertEquals(plainText, ConfigTools.decrypt(keys[1], cipherText));
      }
  }
  