Package com.avaje.ebeaninternal.server.type

Examples of com.avaje.ebeaninternal.server.type.SimpleAesEncryptor


public class TestSimpleEncryptor extends BaseTestCase {

  @Test
  public void test() {

    SimpleAesEncryptor e = new SimpleAesEncryptor();

    EncryptKey key = new BasicEncryptKey("hello");

    byte[] data = "test123".getBytes();

    byte[] ecData = e.encrypt(data, key);
    System.out.println(Arrays.toString(ecData));

    byte[] deData = e.decrypt(ecData, key);

    String s = new String(deData);

    System.out.println(s);

    Timestamp t = new Timestamp(System.currentTimeMillis());
    byte[] ecTimestamp = e.encryptString(t.toString(), key);
    System.out.println(t + " encrypted -> " + Arrays.toString(ecTimestamp));

    String tsFormat = e.decryptString(ecTimestamp, key);
    Timestamp t1 = Timestamp.valueOf(tsFormat);
    Assert.assertEquals(t, t1);

  }
View Full Code Here


        this.dbPlatform = serverConfig.getDatabasePlatform();
        this.encryptDeployManager = serverConfig.getEncryptDeployManager();
        this.encryptKeyManager = serverConfig.getEncryptKeyManager();
       
        Encryptor be = serverConfig.getEncryptor();
        this.bytesEncryptor = be != null ? be : new SimpleAesEncryptor();
   
    // this alias is used for ManyToMany lazy loading queries
    this.manyToManyAlias = "zzzzzz";
  }
View Full Code Here

TOP

Related Classes of com.avaje.ebeaninternal.server.type.SimpleAesEncryptor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.