001package io.ebean.config.dbplatform;
002
003/**
004 * Defines DB encryption support for encrypting and decrypting data using DB
005 * encryption features.
006 * <p>
007 * As an alternative to using DB encryption you can encrypt/decrypt in java via
008 * a special ScalarType but this has the limitation that you can't include that
009 * property in query where clauses.
010 * </p>
011 *
012 * @author rbygrave
013 */
014public interface DbEncrypt {
015
016  // /**
017  // * Return the SQL for decrypting a column returning a VARCHAR.
018  // */
019  // String getDecryptSql(String columnWithTableAlias);
020  //
021  // /**
022  // * Return the DB function with bind variables used to encrypt a VARCHAR
023  // * value.
024  // */
025  // String getEncryptBindSql();
026
027  DbEncryptFunction getDbEncryptFunction(int jdbcType);
028
029  /**
030   * Return the DB type that encrypted Strings are stored in.
031   * <p>
032   * This is VARCHAR for MySql and VARBINARY for most others.
033   * </p>
034   */
035  int getEncryptDbType();
036
037  /**
038   * Return true if the DB encrypt function binds the data before the key.
039   */
040  boolean isBindEncryptDataFirst();
041}