The ENCRYPT function encrypts RAW data using a stream cipher or a block cipher. The cipher uses the key provided by the user and an optional initialization vector (IV).
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition does not support this feature.
Syntax
DBMS_CRYPTO.ENCRYPT(
src IN RAW,
typ IN PLS_INTEGER,
key IN RAW,
iv IN RAW DEFAULT NULL)
RETURN RAW;
Parameters
| Parameter | Description |
|---|---|
| src | The RAW data to be encrypted. |
| typ | The cipher stream and cipher block chaining algorithm to be used. |
| key | The key used for encryption. |
| iv | The optional initialization vector for the cipher block. The default value is NULL. |
Considerations
Cipher blocks can be modified using chaining and padding algorithms. Chaining and padding algorithms are added to the cipher block to generate a cipher combination. Cipher block chaining (CBC) is the most commonly used chaining type. For information about the cipher block chaining and padding algorithms supported by this package, see Overview of DBMS_CRYPTO.
To encrypt VARCHAR2 data, you must first convert it to the AL32UTF8 character set.
