DBMS_CRYPTO v11
The DBMS_CRYPTO
package provides functions and procedures that allow you to encrypt or decrypt RAW, BLOB
or CLOB
data. You can also use DBMS_CRYPTO
functions to generate cryptographically strong random values.
The following table lists the DBMS_CRYPTO
Functions and Procedures.
Function/Procedure | Return Type | Description |
---|---|---|
DECRYPT(src, typ, key, iv) | RAW | Decrypts RAW data. |
DECRYPT(dst INOUT, src, typ, key, iv) | N/A | Decrypts BLOB data. |
DECRYPT(dst INOUT, src, typ, key, iv) | N/A | Decrypts CLOB data. |
ENCRYPT(src, typ, key, iv) | RAW | Encrypts RAW data. |
ENCRYPT(dst INOUT, src, typ, key, iv) | N/A | Encrypts BLOB data. |
ENCRYPT(dst INOUT, src, typ, key, iv) | N/A | Encrypts CLOB data. |
HASH(src, typ) | RAW | Applies a hash algorithm to RAW data. |
HASH(src) | RAW | Applies a hash algorithm to CLOB data. |
MAC(src, typ, key) | RAW | Returns the hashed MAC value of the given RAW data using the specified hash algorithm and key. |
MAC(src, typ, key) | RAW | Returns the hashed MAC value of the given CLOB data using the specified hash algorithm and key. |
RANDOMBYTES(number_bytes) | RAW | Returns a specified number of cryptographically strong random bytes. |
RANDOMINTEGER() | INTEGER | Returns a random INTEGER . |
RANDOMNUMBER() | NUMBER | Returns a random NUMBER. |
DBMS_CRYPTO
functions and procedures support the following error messages:
ORA-28239 - DBMS_CRYPTO.KeyNull
ORA-28829 - DBMS_CRYPTO.CipherSuiteNull
ORA-28827 - DBMS_CRYPTO.CipherSuiteInvalid
Unlike Oracle, Advanced Server will not return error ORA-28233
if you re-encrypt previously encrypted information.
Please note that RAW
and BLOB
are synonyms for the PostgreSQL BYTEA
data type, and CLOB
is a synonym for TEXT
.
decrypt encrypt hash mac randombytes randominteger randomnumber