Class OracleDbEncrypt

  • All Implemented Interfaces:
    DbEncrypt

    public class OracleDbEncrypt
    extends AbstractDbEncrypt
    Oracle encryption support.

    You will typically need to create your own encryption and decryption functions similar to the example ones below.

    
      // Remember your DB user needs execute privilege on DBMS_CRYPTO
      // as well as your encryption and decryption functions
    
    
      // This is an Example Encryption function only - please create your own.
    
     CREATE OR REPLACE FUNCTION eb_encrypt(data IN VARCHAR, key in VARCHAR) RETURN RAW IS
    
         encryption_mode NUMBER := DBMS_CRYPTO.ENCRYPT_AES128 + DBMS_CRYPTO.CHAIN_CBC  + DBMS_CRYPTO.PAD_PKCS5;
    
         BEGIN
              RETURN DBMS_CRYPTO.ENCRYPT(UTL_I18N.STRING_TO_RAW (data, 'AL32UTF8'),
                encryption_mode, UTL_I18N.STRING_TO_RAW(key, 'AL32UTF8') );
         END;
         /
    
    
    
      // This is an Example Decryption function only - please create your own.
    
     CREATE OR REPLACE FUNCTION eb_decrypt(data IN RAW, key IN VARCHAR) RETURN VARCHAR IS
    
         encryption_mode NUMBER := DBMS_CRYPTO.ENCRYPT_AES128 + DBMS_CRYPTO.CHAIN_CBC  + DBMS_CRYPTO.PAD_PKCS5;
    
         BEGIN
              RETURN UTL_RAW.CAST_TO_VARCHAR2(DBMS_CRYPTO.DECRYPT
                (data, encryption_mode, UTL_I18N.STRING_TO_RAW(key, 'AL32UTF8')));
         END;
         /
     
    • Constructor Detail

      • OracleDbEncrypt

        public OracleDbEncrypt()
        Constructs the Oracle10DbEncrypt with default encrypt and decrypt stored procedures.
      • OracleDbEncrypt

        public OracleDbEncrypt​(String encryptFunction,
                               String decryptFunction)
        Constructs the Oracle10DbEncrypt specifying encrypt and decrypt stored procedures.
        Parameters:
        encryptFunction - the encrypt stored procedure
        decryptFunction - the decrypt stored procedure