1

我正在尝试使用 DBMS_CRYPTO。从系统写入:

  DECLARE
        l_key      VARCHAR2 (2000) := '1234567890123456';
        l_in_val   VARCHAR2 (2000) := 'Confidential Data';
        l_mod      NUMBER
           :=   DBMS_CRYPTO.encrypt_aes128
              + DBMS_CRYPTO.chain_cbc
              + DBMS_CRYPTO.pad_pkcs5;
        l_enc      RAW (2000);
    BEGIN
       l_enc :=
          DBMS_CRYPTO.encrypt (utl_i18n.string_to_raw (l_in_val, 'AL32UTF8'),
                               l_mod,
                               utl_i18n.string_to_raw (l_key, 'AL32UTF8')
                              );
       DBMS_OUTPUT.put_line ('Encrypted=' || l_enc);
   END;

回答:

Error report -
ORA-06550: string 5, столбец 17:
PLS-00201: identifier 'DBMS_CRYPTO' must be declared

select * from dba_objects where object_name = 'DBMS_CRYPTO';答案: введите сюда описание изображения

我试图创建用户并给他特权grant execute on sys.dbms_crypto to VICE_SYS;答案:

Error starting at line : 1 in command -
grant execute on sys.dbms_crypto to VICE_SYS
Error report -
ORA-00942: table or view does not exist
00942. 00000 -  "table or view does not exist"
*Cause:

我应该怎么办?

4

1 回答 1

0
SQL>  grant execute on sys.dbms_crypto to testuser;
   
   Grant succeeded.
   
   SQL> connect testuser/testuser Connected. SQL> set serveroutput on

   SQL> DECLARE
           l_key      VARCHAR2 (2000) := '1234567890123456';
           l_in_val   VARCHAR2 (2000) := 'Confidential Data';
           l_mod      NUMBER
              :=   DBMS_CRYPTO.encrypt_aes128
                 + DBMS_CRYPTO.chain_cbc
                 + DBMS_CRYPTO.pad_pkcs5;
           l_enc      RAW (2000);
       BEGIN
          l_enc :=
             DBMS_CRYPTO.encrypt (utl_i18n.string_to_raw (l_in_val, 'AL32UTF8'),
                                  l_mod,
                                  utl_i18n.string_to_raw (l_key, 'AL32UTF8')
                                 );
          DBMS_OUTPUT.put_line ('Encrypted=' || l_enc);    END;  3    4    5    6    7    8    9   10   11   12   13   14   15   16  17  /
   Encrypted=32617FCF7AB54676BEBE201360DD2C83A07A34084D30A92A9FF1F6B774240A35
于 2020-11-06T21:54:35.567 回答