我在包中有以下功能,我试图解密加密密码,但收到以下错误信息:
ORA-28817: PL/SQL function returned an error.
ORA-06512: at "SYS.DBMS_CRYPTO_FFI",
ORA-06512: at "SYS.DBMS_CRYPTO",
ORA-06512: at "RATOR_MONITORING_CONFIGURATION.ENCRYPT_DECRYPT_PASSWORD", line 11
28817. 00000 - "PL/SQL function returned an error."
*Cause: A PL/SQL function returned an error unexpectedly.
*Action: This is an internal error. Enable tracing to find more
information. Contact Oracle customer support if needed.
*Document: NO
当我在不同的服务器和机器上运行此程序包时,我能够执行程序包并能够使用相同的查询解密密码。
以下是我的包裹:
create or replace PACKAGE BODY "ENCRYPT_DECRYPT_PASSWORD"
AS
l_key RAW(128) := utl_raw.cast_to_raw('abcdefgh');
FUNCTION decrypt_val( p_val IN varchar2 ) RETURN VARCHAR2
IS
l_decrypted RAW(2048);
l_val RAW(2048) := utl_raw.cast_to_raw(p_val);
BEGIN
l_decrypted := dbms_crypto.decrypt
( src => l_val,
typ => dbms_crypto.des_cbc_pkcs5,
key => l_key );
return utl_raw.cast_to_varchar2(l_decrypted);
END decrypt_val;
FUNCTION get_decrypted_password( table_name IN varchar2,column_name IN varchar2,table_id IN varchar2,table_id_val IN varchar2 ) RETURN VARCHAR2
IS
encrypted_pas varchar2(100);
decrypted_pas varchar2(100);
BEGIN
EXECUTE IMMEDIATE 'select ' || column_name || ' from ' || table_name || ' where ' || table_id || ' = ' || table_id_val
INTO encrypted_pas;
Select decrypt_val(encrypted_pas) into decrypted_pas from dual;
return decrypt_val(encrypted_pas);
END get_decrypted_password;
END encrypt_decrypt_password;
我也尝试向用户提供DBMS_CRYPTO
权限,我的包也已经编译但是当我尝试运行以下命令来解密密码时,我收到了错误。
Select ENCRYPT_DECRYPT_PASSWORD.get_decrypted_password('DB_CONNECTION','PASSWORD','DB_CONNECTION_ID',11) from dual;