Home » SQL & PL/SQL » SQL & PL/SQL » Encryption problem while using Dbms_Crypto
Encryption problem while using Dbms_Crypto [message #190106] Tue, 29 August 2006 05:12
agrawal_vaibhao
Messages: 20
Registered: May 2006
Junior Member

Hi all,
I am using Dbms_Crypto package of Oracle 10g for encryption and decryption of clob data.
For that i have wrote the procedure as follows :-

CREATE OR REPLACE Function Encrypt_Clobdata(i_password Clob) Return Blob Is
v_outputdata Blob;
v_inputdata Clob;
c_encrypt_key varchar2(Cool := NULL;
DES_CBC_PKCS5 CONSTANT PLS_INTEGER := DBMS_CRYPTO.ENCRYPT_DES +
DBMS_CRYPTO.CHAIN_CBC +
DBMS_CRYPTO.PAD_PKCS5;
Begin
-- Input data must have a length divisible by eight
/* v_inputdata := RPAD(i_password,
(TRUNC(LENGTH(i_password) / Cool + 1) * 8,
CHR(0));*/
v_inputdata := i_password;
BEGIN
SELECT key INTO c_encrypt_key FROM encrypt_key WHERE ROWNUM < 2;
EXCEPTION
WHEN NO_DATA_FOUND THEN
RAISE_APPLICATION_ERROR(-20000, 'Encryption Key is Not Available');
c_encrypt_key := NULL;
END;
Dbms_Crypto.Encrypt(v_outputdata,
v_inputdata,
DES_CBC_PKCS5,
UTL_RAW.CAST_TO_RAW(CONVERT(c_encrypt_key, 'AL32UTF8')));
Return v_outputdata;
End;

But while executing the procedure i got error as follows :-
SQL> Select Encrypt_Clobdata('vaibhao') from dual;

Select Encrypt_Clobdata('vaibhao') from dual

ORA-01405: fetched column value is NULL

Can any tell me the solution for this.

Thanks In Advance.

Vaibhao
Previous Topic: DECODE function
Next Topic: Inserting a PL/SQL block
Goto Forum:
  


Current Time: Wed Dec 07 09:05:58 CST 2016

Total time taken to generate the page: 0.13332 seconds