001package com.avaje.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 * </p> 008 * 009 * @author rbygrave 010 * 011 */ 012public interface Encryptor { 013 014 /** 015 * Encrypt the data using the key. 016 */ 017 byte[] encrypt(byte[] data, EncryptKey key); 018 019 /** 020 * Decrypt the data using the key. 021 */ 022 byte[] decrypt(byte[] data, EncryptKey key); 023 024 /** 025 * Encrypt the formatted string value using a key. 026 */ 027 byte[] encryptString(String formattedValue, EncryptKey key); 028 029 /** 030 * Decrypt the data returning a formatted string value using a key. 031 */ 032 String decryptString(byte[] data, EncryptKey key); 033 034}