The ENCRYPT function encrypts RAW data by using a stream or block cipher. The cipher uses a key that you provide and an optional initialization vector (IV).
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition provides only the MySQL mode.
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 encrypt. |
| typ | The type of the stream or block cipher. |
| key | The key that is used for encryption. |
| iv | The initialization vector for the cipher block. This parameter is optional. The default value is NULL. |
Considerations
You can modify block ciphers by using chaining and padding algorithms. The chaining and padding algorithms are added to the block cipher to generate a cipher suite. Cipher Block Chaining (CBC) is the most widely used type of chaining. For more information about the block cipher chaining and padding algorithms that this package supports, see Overview.
To encrypt data of the VARCHAR2 type, you must first convert it to the AL32UTF8 character set.