DBMS_CRYPTO v15
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 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. |
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, EDB Postgres Advanced Server doesn't return error ORA-28233
if you reencrypt previously encrypted information.
RAW
and BLOB
are synonyms for the PostgreSQL BYTEA
data type. CLOB
is a synonym for TEXT
.
decrypt encrypt hash mac randombytes randominteger randomnumber