OceanBase logo

OceanBase

A unified distributed database ready for your transactional, analytical, and AI workloads.

Product Overview
DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Resources

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS

OceanBase Cloud

OceanBase Database

Tools

Connectors and Middleware

QUICK START

OceanBase Cloud

OceanBase Database

BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Company

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

International - English
中国站 - 简体中文
日本 - 日本語
Sign In
Start on Cloud

OceanBase

A unified distributed database ready for your transactional, analytical, and AI workloads.

Product Overview
DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS
OceanBase CloudOceanBase Database
ToolsConnectors and Middleware
QUICK START
OceanBase CloudOceanBase Database
BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

Start on Cloud
编组
All Products
    • Databases
    • iconOceanBase Database
    • iconOceanBase Cloud
    • iconOceanBase Tugraph
    • iconInteractive Tutorials
    • iconOceanBase Best Practices
    • Tools
    • iconOceanBase Cloud Platform
    • iconOceanBase Migration Service
    • iconOceanBase Developer Center
    • iconOceanBase Migration Assessment
    • iconOceanBase Admin Tool
    • iconOceanBase Loader and Dumper
    • iconOceanBase Deployer
    • iconKubernetes operator for OceanBase
    • iconOceanBase Diagnostic Tool
    • iconOceanBase Binlog Service
    • Connectors and Middleware
    • iconOceanBase Database Proxy
    • iconEmbedded SQL in C for OceanBase
    • iconOceanBase Call Interface
    • iconOceanBase Connector/C
    • iconOceanBase Connector/J
    • iconOceanBase Connector/ODBC
    • iconOceanBase Connector/NET
icon

OceanBase Database

SQL - V4.6.0

    Download PDF

    OceanBase logo

    The Unified Distributed Database for the AI Era.

    Follow Us
    Products
    OceanBase CloudOceanBase EnterpriseOceanBase Community EditionOceanBase seekdb
    Resources
    DocsBlogLive DemosTraining & CertificationTicket
    Company
    About OceanBaseTrust CenterLegalPartnerContact Us
    Follow Us

    © OceanBase 2026. All rights reserved

    Cloud Service AgreementPrivacy PolicySecurity
    Contact Us
    Document Feedback
    1. Documentation Center
    2. OceanBase Database
    3. SQL
    4. V4.6.0
    iconOceanBase Database
    SQL - V 4.6.0
    SQL
    KV
    • V 4.6.0
    • V 4.4.2
    • V 4.3.5
    • V 4.3.3
    • V 4.3.1
    • V 4.3.0
    • V 4.2.5
    • V 4.2.2
    • V 4.2.1
    • V 4.2.0
    • V 4.1.0
    • V 4.0.0
    • V 3.1.4 and earlier

    Overview of DBMS_CRYPTO

    Last Updated:2026-05-07 11:26:25  Updated
    share
    What is on this page
    Data types of DBMS_CRYPTO
    Algorithms of DBMS_CRYPTO
    Limitations of DBMS_CRYPTO
    Subprograms of DBMS_CRYPTO

    folded

    share

    The DBMS_CRYPTO package provides basic functions and stored procedures for encryption and decryption.

    Applicability

    This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition does not support this feature.

    DBMS_CRYPTO supports various industry-standard encryption and hashing algorithms, including the Advanced Encryption Standard (AES). AES has been recognized by the National Institute of Standards and Technology (NIST) as a replacement for the Data Encryption Standard (DES).

    DBMS_CRYPTO supports encryption and decryption of common data types, including RAW and large objects (LOBs) such as images and audio. Additionally, DBMS_CRYPTO provides globalization support, enabling data encryption and decryption across databases with different character sets.

    Data types of DBMS_CRYPTO

    The following table lists the data types used as parameters for the subprograms of the DBMS_CRYPTO package.

    Data type Description
    BLOB The source or destination binary LOB.
    CLOB The source or destination character LOB.
    PLS_INTEGER The encryption algorithm type (used with BLOB, CLOB, and RAW data types).
    RAW The source or destination RAW buffer.

    Algorithms of DBMS_CRYPTO

    The DBMS_CRYPTO package contains predefined encryption algorithms, cipher block chaining algorithms, and cipher block padding algorithms.

    • The following encryption hash algorithms are supported:

      Name Description
      HASH_MD4 Generates a 128-bit hash or message digest for the input message.
      HASH_MD5 Also generates a 128-bit hash, but it is more complex than MD4.
      HASH_SH1 Secure Hash Algorithm (SHA-1). Generates a 160-bit hash.
      HASH_SH256 SHA-2, generates a 256-bit hash.
      HASH_SH384 SHA-2, generates a 384-bit hash.
      HASH_SH512 SHA-2, generates a 512-bit hash.
      HASH_SM3 National Cryptography Algorithm, generates a 256-bit hash.
    • The following encryption algorithms are supported:

      Name Description
      ENCRYPT_AES128 Advanced Encryption Standard (AES) in cipher block mode. Uses a 128-bit key.
      ENCRYPT_AES192 Advanced Encryption Standard (AES) in cipher block mode. Uses a 192-bit key.
      ENCRYPT_AES256 Advanced Encryption Standard (AES) in cipher block mode. Uses a 256-bit key.
      ENCRYPT_DES Data Encryption Standard (DES) in cipher block mode. Uses a 56-bit key.
      ENCRYPT_3DES_2KEY Triple Data Encryption Standard (3DES) with two keys. Encrypts the same block three times using two keys. The effective key length is 112 bits.
      ENCRYPT_3DES Triple Data Encryption Standard (3DES) in cipher block mode. Encrypts the same block three times.
      ENCRYPT_SM4 National Cryptography Algorithm, with a block size and key size of 128 bits.
    • The following cipher block chaining algorithms are supported:

      Name Description
      CHAIN_ECB Electronic Codebook (ECB) mode. Divides the entire plaintext into several equal segments and encrypts each segment.
      CHAIN_CBC Cipher Block Chaining (CBC) mode. Divides the plaintext into several segments, then XORs each segment with the initial block or the ciphertext of the previous segment, and encrypts it with the key.
      CHAIN_CFB Cipher Feedback (CFB) mode. Enables encryption of data units smaller than the block size.
      CHAIN_OFB Output Feedback (OFB) mode. Allows the block cipher to run as a synchronous stream cipher. Similar to CFB, but the n bits of the previous output block are moved to the right end of the waiting encryption data queue.
    • The following cipher block padding algorithms are supported:

      Name Description
      PAD_PKCS5 The padding algorithm conforms to PKCS #5, which is based on password-based cryptography.
      PAD_NONE Specifies the option for no padding algorithm. The caller must ensure that the block size is correct; otherwise, the package returns an error.

    Limitations of DBMS_CRYPTO

    The DBMS_CRYPTO package does not directly support the VARCHAR2 data type. Before encrypting data of the VARCHAR2 type, you must convert it to the unified database character set AL32UTF8 and then to the RAW data type. After these conversions, you can use the DBMS_CRYPTO package to encrypt the data.

    Subprograms of DBMS_CRYPTO

    The following table lists the DBMS_CRYPTO subprograms supported in the current OceanBase Database version and their brief descriptions.

    Subprogram Description
    ENCRYPT Encrypts RAW data using a stream or block cipher with a user-provided key and an optional initialization vector (IV).
    DECRYPT Decrypts RAW data using a stream or block cipher with a user-provided key and an optional initialization vector (IV).
    HASH Applies one of the supported encryption hash algorithms (MD4, MD5, SHA-1, or SHA-2) to the data.

    Previous topic

    TRIGGER_PARTITION_BALANCE
    Last

    Next topic

    ENCRYPT
    Next
    What is on this page
    Data types of DBMS_CRYPTO
    Algorithms of DBMS_CRYPTO
    Limitations of DBMS_CRYPTO
    Subprograms of DBMS_CRYPTO