I have problem with using dbms_crypto.hash()
function in Oracle.
I connected to database server using sqlplus as "sys/passwd as sysdba",
then I installed dbms_crypto
package:
@/home/oracle/app/oracle/product/11.2.0/dbhome_1/rdbms/admin/dbmsobtk.sql
@/home/oracle/app/oracle/product/11.2.0/dbhome_1/rdbms/admin/prvtobtk.plb
Grant execute on dbms_crypto to public;
Grant execute on dbms_sqlhash to public;
Grant execute on dbms_obfuscation_toolkit to public;
Grant execute on dbms_obfuscation_toolkit_ffi to public;
Grant execute on dbms_crypto_ffi to public;
Everything looks good, so I tested hash()
function:
SQL> select dbms_crypto.hash(utl_raw.cast_to_raw('zorg'), 3) from dual;
DBMS_CRYPTO.HASH(UTL_RAW.CAST_TO_RAW('ZORG'),3)
--------------------------------------------------------------------------------
60C440F9954CA4744204CDA9CC93567059C1EC82
I disconnected and connected to that database as regular user, but then I got error:
SQL> select dbms_crypto.hash(utl_raw.cast_to_raw('zorg'), 3) from dual;
select dbms_crypto.hash(utl_raw.cast_to_raw('zorg'), 3) from dual
*
ERROR at line 1:
ORA-06521: PL/SQL: Error mapping function
ORA-06512: at "MN.DBMS_CRYPTO_FFI", line 131
ORA-06512: at "MN.DBMS_CRYPTO", line 72
Why I cannot use this function as regular user? How to allow other users to use it?
I work with:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
I think dbms_crypto is not installed by default, you might have to install it using $ORACLE_HOME/rdbms/admin/dbmsoctk. sql and $ORACLE_HOME/rdbms/admin/prvtobtk. plb scripts.
DBMS_CRYPTO provides an interface to encrypt and decrypt stored data, and can be used in conjunction with PL/SQL programs running network communications. It provides support for several industry-standard encryption and hashing algorithms, including the Advanced Encryption Standard (AES) encryption algorithm.
You can return an encrypted database to an unencrypted state by specifying attributes on the connection URL. To decrypt an encrypted database, specify the decryptDatabase=true attribute in conjunction with either the bootPassword=key attribute or the encryptionKey=key attribute.
To decrypt an existing column in a table in the database, ALTER TABLE customer MODIFY (cust_name decrypt); To add SALT to an encrypted column in a table in the database, ALTER TABLE customer MODIFY (cust_email encrypt salt);
Problem solved. I created package as wrong user. Proper way:
connect using:
sqlplus / as sysdba
Install packages:
@/home/oracle/app/oracle/product/11.2.0/dbhome_1/rdbms/admin/dbmsobtk.sql
@/home/oracle/app/oracle/product/11.2.0/dbhome_1/rdbms/admin/prvtobtk.plb
Connect as regular user and use functions from dbms_crypto
package.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With