001package io.ebean.config;
002
003/**
004 * Used for Java side encryption of properties when DB encryption is not used.
005 * <p>
006 * By default this is used on non-varchar types such as Blobs.
007 */
008public interface Encryptor {
009
010  /**
011   * Encrypt the data using the key.
012   */
013  byte[] encrypt(byte[] data, EncryptKey key);
014
015  /**
016   * Decrypt the data using the key.
017   */
018  byte[] decrypt(byte[] data, EncryptKey key);
019
020  /**
021   * Encrypt the formatted string value using a key.
022   */
023  byte[] encryptString(String formattedValue, EncryptKey key);
024
025  /**
026   * Decrypt the data returning a formatted string value using a key.
027   */
028  String decryptString(byte[] data, EncryptKey key);
029
030}