DBMS_CRYPTO error

Hi
I have problem using dbms_crypto package.
If I execute this code:
declare
  c_text clob := to_clob('TEST TEXT');
  b_result blob;
  function crypt (ac_text clob) return blob as
     secret_key   RAW (32) := utl_raw.cast_to_raw('12345678901234567890123456789012');
     crypt_type   PLS_INTEGER := DBMS_CRYPTO.ENCRYPT_AES256 + DBMS_CRYPTO.CHAIN_CBC + DBMS_CRYPTO.PAD_PKCS5;
     crypted_text blob;
  BEGIN
     DBMS_CRYPTO.ENCRYPT(crypted_text, ac_text, crypt_type, secret_key, null);
     return crypted_text;
  END crypt;
begin
  b_result := crypt(c_text);
end;
/it would return error:
ORA-01405: fetched column value is NULL
My database is 10.2.0.4 64bit...
Any idea what might be wrong?

I am pasting you real-life application encrypt procedure (slightly modified) that may help you (you will need first to convert your CLOB data to VARCHAR2)
FUNCTION encrypt(text IN VARCHAR2, secretKey IN VARCHAR2) RETURN RAW IS
encryptedText RAW(2000);
BEGIN
encryptedText := DBMS_CRYPTO.ENCRYPT(UTL_I18N.STRING_TO_RAW(text, 'AL32UTF8'), dbms_crypto.AES_CBC_PKCS5, UTL_I18N.STRING_TO_RAW(secretKey));
RETURN encryptedText;
END encrypt;

Similar Messages

  • Error when useing DBMS_CRYPTO package in reports 10g

    hi all,
    i wrote a package which use dbms_crypto, there are functions to crypto userid and decrypo userid.
    in report 6i it work fine it cryptos and decrpts. when i use in reports 10g it gives this error.
    -28817 ORA-28817: PL/SQL function returned an error.
    ora-06512: at "SYS.DBMS_CRYPTO_FFI", line 67
    ORA-06512: at "SYS.DBMS_CRYPTO", line 41
    ora-06512: at "YBS.SIFRELE", line 26
    the packege like this;
    PACKAGE BODY SIFRELE
    IS
    function sicil_sifrele (p_sicil_no IN varchar2) RETURN varchar2
    IS
    p_key RAW(128);
    p_sicil_raw RAW(128);
    p_encrypted_raw RAW(128);
    BEGIN
    p_key := utl_raw.cast_to_raw(to_char(sysdate,'mmyyyydd'));
    p_sicil_raw := utl_raw.cast_to_raw(p_sicil_no);
    p_encrypted_raw := dbms_crypto.encrypt(src => p_sicil_raw,
    typ => dbms_crypto.des_cbc_pkcs5, key => p_key);
    return (utl_raw.cast_to_varchar2(p_encrypted_raw));
    END;
    FUNCTION sicil_coz ( p_encrypted_raw IN RAW) RETURN varchar2
    IS
    p_key RAW(128);
    p_decrypted_raw RAW(128);
    sicil_donen VARCHAR2(250);
    BEGIN
    p_key := utl_raw.cast_to_raw(to_char(sysdate,'mmyyyydd'));
    p_decrypted_raw := dbms_crypto.decrypt(src => p_encrypted_raw,
    typ => dbms_crypto.des_cbc_pkcs5, key => p_key);
    sicil_donen := utl_raw.cast_to_varchar2(p_decrypted_raw);
    return (sicil_donen);
    END;
    END;
    thanks.
    eser

    Hello,
    You should create a "wrapper function"
    Create a function in the database that will call dbms_crypto.encrypt / dbms_crypto.decrypt and call this function in Reports.
    (The problem here seems to be the reference to dbms_crypto.des_cbc_pkcs5)
    Regards

  • Error when using DBMS_CRYPTO package in reports 10g

    hi all,
    i wrote a package which use dbms_crypto, there are functions to crypto userid and decrypo userid.
    the packege like this;
    PACKAGE BODY SIFRELE
    IS
    function sicil_sifrele (p_sicil_no IN varchar2) RETURN varchar2
    IS
    p_key RAW(128);
    p_sicil_raw RAW(128);
    p_encrypted_raw RAW(128);
    BEGIN
    p_key := utl_raw.cast_to_raw(to_char(sysdate,'mmyyyydd'));
    p_sicil_raw := utl_raw.cast_to_raw(p_sicil_no);
    p_encrypted_raw := dbms_crypto.encrypt(src => p_sicil_raw,
    typ => dbms_crypto.des_cbc_pkcs5, key => p_key);
    return (utl_raw.cast_to_varchar2(p_encrypted_raw));
    END;
    FUNCTION sicil_coz ( p_encrypted_raw IN RAW) RETURN varchar2
    IS
    p_key RAW(128);
    p_decrypted_raw RAW(128);
    sicil_donen VARCHAR2(250);
    BEGIN
    p_key := utl_raw.cast_to_raw(to_char(sysdate,'mmyyyydd'));
    p_decrypted_raw := dbms_crypto.decrypt(src => p_encrypted_raw,
    typ => dbms_crypto.des_cbc_pkcs5, key => p_key);
    sicil_donen := utl_raw.cast_to_varchar2(p_decrypted_raw);
    return (sicil_donen);
    END;
    END;
    in report 6i it work fine cryptos and decrpts. when i use in reports 10g it gives this error.
    -28817 ORA-28817: PL/SQL function returned an error.
    ora-06512: at "SYS.DBMS_CRYPTO_FFI", line 67
    ORA-06512: at "SYS.DBMS_CRYPTO", line 41
    ora-06512: at "YBS.SIFRELE", line 26
    thanks...

    Hello,
    You should create a "wrapper function"
    Create a function in the database that will call dbms_crypto.encrypt / dbms_crypto.decrypt and call this function in Reports.
    (The problem here seems to be the reference to dbms_crypto.des_cbc_pkcs5)
    Regards

  • Dbms_crypto - avoid error when using different key in lower environment

    Hello Experts,
    We are using Oracle 11.2.0.2. We are planning to implement dbms_crypto to encrypt few columns. We clone the data from production to lower environment ( DEV, QC).
    For the lower environments, we do not want to get the sensitive data from production and do not plan to use same key. Rather than getting an error when using differnt key, is it possible to get a different resultset back.
    In other words, we want the implementation to be same across environments but want to use a diffent key in lower environment and get different result (or garbage).
    Any suggestions would be greatly appreciated.
    While testing this logic, I am getting following error when using differnt key to decrypt. It works fine if I use same key.
    Error at line 1
    ORA-28817: PL/SQL function returned an error.
    ORA-06512: at "SYS.DBMS_CRYPTO_FFI", line 67
    ORA-06512: at "SYS.DBMS_CRYPTO", line 44
    ORA-06512: at line 19
    DECLARE
      l_credit_card_no    VARCHAR2(19) := '1234 5678 9012 3456';
      l_ccn_raw           RAW(128) := UTL_RAW.cast_to_raw(l_credit_card_no);
    l_key               RAW(128) := UTL_RAW.cast_to_raw('abcdefgh');
       l2_key               RAW(128) := UTL_RAW.cast_to_raw('12345678');
      l_encrypted_raw     RAW(2048);
      l_decrypted_raw     RAW(2048);
    BEGIN
      DBMS_OUTPUT.put_line('Original  : ' || l_credit_card_no);
      l_encrypted_raw := DBMS_CRYPTO.encrypt(src => l_ccn_raw,
                                             typ => DBMS_CRYPTO.des_cbc_pkcs5,
                                             key => l_key);
      DBMS_OUTPUT.put_line('Encrypted : ' || RAWTOHEX(UTL_RAW.cast_to_raw(l_encrypted_raw)));
      l_decrypted_raw := DBMS_CRYPTO.decrypt(src => l_encrypted_raw,
                                             typ => DBMS_CRYPTO.des_cbc_pkcs5,
                                             key => l2_key); --**Using different key to decrypt
      DBMS_OUTPUT.put_line('Decrypted : ' || UTL_RAW.cast_to_varchar2(l_decrypted_raw));
    END;Thank you.

    If I understand what you are trying to do ... and I may not ... it is not going to work.
    SQL> DECLARE
      2   l_credit_card_no VARCHAR2(19) := '1612-1791-1809-2605';
      3   l_ccn_raw RAW(128) := utl_raw.cast_to_raw(l_credit_card_no);
      4   l_key1     RAW(128) := utl_raw.cast_to_raw('abcdefgh');
      5   l_key2     RAW(128) := utl_raw.cast_to_raw('zyxwvuts');  -- alternate key used to attempt a different decryption
      6 
      7   l_encrypted_raw RAW(2048);
      8   l_decrypted_raw RAW(2048);
      9  BEGIN
    10    dbms_output.put_line('Original : ' || l_credit_card_no);
    11 
    12    l_encrypted_raw := dbms_crypto.encrypt(l_ccn_raw, dbms_crypto.des_cbc_pkcs5, l_key1);
    13 
    14    dbms_output.put_line('Encrypted : ' || RAWTOHEX(utl_raw.cast_to_raw(l_encrypted_raw)));
    15 
    16    l_decrypted_raw := dbms_crypto.decrypt(src => l_encrypted_raw, typ => dbms_crypto.des_cbc_pkc
    s5, key => l_key1);
    17 
    18    dbms_output.put_line('Key1 : ' || utl_raw.cast_to_varchar2(l_decrypted_raw));
    19 
    20    l_decrypted_raw := dbms_crypto.decrypt(src => l_encrypted_raw, typ => dbms_crypto.des_cbc_pkc
    s5, key => l_key2);
    21 
    22    dbms_output.put_line('Key2 : ' || utl_raw.cast_to_varchar2(l_decrypted_raw));
    23  END;
    24  /
    Original : 1612-1791-1809-2605
    Encrypted : 3534443342333642353141363846384237463732384636373943374630364234323243334539383042323135
    Key1 : 1612-1791-1809-2605
    DECLARE
    ERROR at line 1:
    ORA-28817: PL/SQL function returned an error.
    ORA-06512: at "SYS.DBMS_CRYPTO_FFI", line 67
    ORA-06512: at "SYS.DBMS_CRYPTO", line 44
    ORA-06512: at line 20

  • DBMS_CRYPTO.DECRYPT-Error in decryption.

    Hi all,
    i created encryption and decryption program using DBMS_CRYPTO package.as a whole both encryption and decryption working fine.but when i used the decrypt part alone using stored encrypted data(RAW DataType) it showing some internal error,kindly help me in this issue.i provided the details here,
    * I encrypted a string using dbms_crypto.encrypt and stored that string in a column which i created as RAW datatype format.
    *The program i used is ,
    DECLARE
    op VARCHAR2(500) ;
    op_raw raw(2000);
    ip raw(2000);
    num_key_bytes NUMBER := 256/8; -- key length 256 bits (32 bytes)
    key_bytes_raw RAW (32); -- stores 256-bit encryption key
    encryption_type PLS_INTEGER := -- total encryption type
    DBMS_CRYPTO.ENCRYPT_AES256 + DBMS_CRYPTO.CHAIN_CBC + DBMS_CRYPTO.PAD_PKCS5;
    BEGIN
    SELECT pass INTO ip FROM user_test WHERE user_id =309;
    /*this pass is of format RAW,it storing the ouput of DBMS_CRYPTO.ENCRYPT */
    /*above query fetches F130E5785F8DAE2D59972FB9B7B74BE4 as output */
    /*word used for encryption is 'secret' */
    key_bytes_raw := DBMS_CRYPTO.RANDOMBYTES (num_key_bytes);
    DBMS_OUTPUT.PUT_LINE ('ip :' || ip);
    op_raw := DBMS_CRYPTO.DECRYPT( src =>ip , typ => encryption_type, KEY => key_bytes_raw );
    DBMS_OUTPUT.PUT_LINE ('op_raw :'||op_raw);
    op:= UTL_I18N.RAW_TO_CHAR (op_raw , 'AL32UTF8');
    DBMS_OUTPUT.PUT_LINE ('op :'||op);
    END;
    * The Error i getting is ,
    Error report:
    ORA-28817: PL/SQL function returned an error.
    ORA-06512: at "SYS.DBMS_CRYPTO_FFI", line 67
    ORA-06512: at "SYS.DBMS_CRYPTO", line 41
    ORA-06512: at line 14
    28817. 00000 - "PL/SQL function returned an error."
    *Cause:    A PL/SQL function returned an error unexpectedly.
    *Action:   This is an internal error. Contact Oracle customer support.
    kindly help me in this issue as soon as possible.
    Thanks in advance,
    Jeevanand.K
    Edited by: Jeevanand K on Oct 26, 2010 2:08 AM

    Hi,
    there is a note on Metalink for this: "DBMS_CRYPTO.DECRYPT - ORA-28817 ORA-06512 at DBMS_CRYPTO_FFI", it has id 956603.1.
    Herald ten Dam
    http://htendam.wordpress.com

  • DBMS_CRYPTO : DECRYPT error ORA 28817...

    Hello,
    We are in 10g2, I have few big VARCHAR2 columns to encrypt in one table. I am pretty new in this topic..
    I took the standard example given with package DBMS_CRYPTO :
    http://download-west.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_crypto.htm
    Here are 2 pieces of code, one with no save of data, and one with an insert into a CLOB column.
    The first example gives no error, but my data is not saved.
    The second example saved the encrypted data into a CLOB, but, I get an error with a DECRYPT (this occurs only 60 times on 5000 records !!)
    Here are my 2 examples :
    1) The one that works (with no save)
    DECLARE
    input_string VARCHAR2 (200) := 'Increase in volume by 26%, increase in GM by 13%';
    output_string VARCHAR2 (200);
    encrypted_raw RAW (2000); -- stores encrypted binary text
    decrypted_raw RAW (2000); -- stores decrypted binary text
    num_key_bytes NUMBER := 256/8; -- key length 256 bits (32 bytes)
    key_bytes_raw RAW (32); -- stores 256-bit encryption key
    encryption_type PLS_INTEGER := -- total encryption type
    DBMS_CRYPTO.ENCRYPT_AES256
    + DBMS_CRYPTO.CHAIN_CBC
    + DBMS_CRYPTO.PAD_PKCS5;
    BEGIN
    DBMS_OUTPUT.PUT_LINE ( 'Original string: ' || input_string);
    key_bytes_raw := DBMS_CRYPTO.RANDOMBYTES (num_key_bytes);
    encrypted_raw := DBMS_CRYPTO.ENCRYPT
    ( src => UTL_I18N.STRING_TO_RAW (input_string, 'AL32UTF8'),
    typ => encryption_type,
    key => key_bytes_raw );
    dbms_output.put_line('encryption='||encrypted_raw);
    decrypted_raw := DBMS_CRYPTO.DECRYPT
    ( src => encrypted_raw,
    typ => encryption_type,
    key => key_bytes_raw );
    output_string := UTL_I18N.RAW_TO_CHAR (decrypted_raw, 'AL32UTF8');
    DBMS_OUTPUT.PUT_LINE ('step4 Decrypted string: ' || output_string);
    END;
    2) The one that doesn't work (with an insert into a CLOB column) :
    DECLARE
    input_string VARCHAR2 (200) := 'Increase in volume by 26%, increase in GM by 13%';
    output_string VARCHAR2 (200);
    encrypted_raw RAW (2000); -- stores encrypted binary text
    decrypted_raw RAW (2000); -- stores decrypted binary text
    num_key_bytes NUMBER := 256/8; -- key length 256 bits (32 bytes)
    key_bytes_raw RAW (32); -- stores 256-bit encryption key
    encryption_type PLS_INTEGER := -- total encryption type
    DBMS_CRYPTO.ENCRYPT_AES256
    + DBMS_CRYPTO.CHAIN_CBC
    + DBMS_CRYPTO.PAD_PKCS5;
    l_test CLOB;
    BEGIN
    DBMS_OUTPUT.PUT_LINE ( 'Original string: ' || input_string);
    key_bytes_raw := DBMS_CRYPTO.RANDOMBYTES (num_key_bytes);
    encrypted_raw := DBMS_CRYPTO.ENCRYPT
    ( src => UTL_I18N.STRING_TO_RAW (input_string, 'AL32UTF8'),
    typ => encryption_type,
    key => key_bytes_raw );
    delete from TEST_ODAB;
    commit;
    insert into TEST_ODAB (my_column) values (encrypted_raw);
    commit;
    dbms_output.put_line('step2 ...');
    select my_column into l_test from TEST_ODAB;
    dbms_output.put_line('step3 ...');
    decrypted_raw := DBMS_CRYPTO.DECRYPT
    ( src => UTL_RAW.cast_to_raw(l_test),
    typ => encryption_type,
    key => key_bytes_raw );
    output_string := UTL_I18N.RAW_TO_CHAR (decrypted_raw, 'AL32UTF8');
    DBMS_OUTPUT.PUT_LINE ('step4 Decrypted string(with select): ' || output_string);
    EXCEPTION
    WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE('Others='||SQLERRM);
    END;
    This is the result I get :
    Original string: Increase in volume by 26%, increase in GM by 13%
    step2 ...
    step3 ...
    Others=ORA-28817: PL/SQL function returned an error.
    I must have something wrong in my code, but I don't see what ...
    Any advice ?
    I hope that my explanation is clear enough ....
    Thanks,
    Olivier

    Hi,
    there is a note on Metalink for this: "DBMS_CRYPTO.DECRYPT - ORA-28817 ORA-06512 at DBMS_CRYPTO_FFI", it has id 956603.1.
    Herald ten Dam
    http://htendam.wordpress.com

  • Key Lenght too short error with dbms_crypto.encrypt

    Hi Friends,
    I am getting above mentioned error with dbms_crypto.encrypt.
    I had created a thread in technology --> security forum but i am not getting any help from there.
    ORA-28234 Key Length too short with dbms_crypto.encrypt
    Appreciate if anyone help me resolve this issue.
    Thanks
    AT

    Hi Warren,
    Yes function is compiled without any compilation error.
    Thanks
    AT

  • Error in dbms_crypto.hash

    I am trying to run following query in my database -
    select RAWTOHEX(dbms_crypto.hash(src => UTL_I18N.STRING_TO_RAW('local123'),typ => dbms_crypto.HASH_SH1))
    from dual;
    But i am getting the following error message -
    ORA-00907: missing right parenthesis . Error at Line 1 Column 37.
    Please give me any hint why this happening? It's urgent.

    Urgent it certainly is not to a forum of volunteers.
    You cannot name parameters in SQL statements unless you're using Version 11, which i'll assume you aren't.
    src => Is a named parameter.
    How you would call this using named parameters.
    ME_XE?declare
      2    whex varchar2(500);
      3  begin
      4    whex := RAWTOHEX(dbms_crypto.hash(src => UTL_I18N.STRING_TO_RAW('local123'),typ => dbms_crypto.HASH_SH1) );
      5    dbms_output.put_line(whex);
      6  end;
      7  /
    B4B2E185D0513EEB159E8476ED1E0E9DD8FE85AD
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.01Edited by: Tubby on May 11, 2009 1:48 PM

  • Error PLS-201 with DBMS_CRYPTO - 11g (totally newbie error).

    Hi guys.
    I'm trying to compile a package which includes the following instruction in a function:
    return DBMS_CRYPTO.Hash(src => v_hashed, typ => DBMS_CRYPTO.HASH_MD5);
    where "v_hashed" is raw(16) and the function expects a RAW as output. This instruction works ok in 10gr2 but fails in 11g with the following error (I have been granted access to the package, of course):
    PLS-201: identified 'DMBS_CRYPTO' must be declared
    If I replicate the same functionality in an anonymous block, it works ok. I'm pretty sure there is a silly mistake I'm making but I really can't see it. Hope somebody can help me.
    TIA,
    Mariano

    You probably have permissions on dbms_crypto through a role, and not granted directly to your user. Permissions granted through a role do not work in stored procedures, but do work in anonymous blocks.
    As a quick test of this, in your sqlplus session type
    set role none;
    then try your anonymous blxok again. It will fail.
    John

  • Using DBMS_CRYPTO package in reports

    hi all,
    i want to encrypt & decrypt user parameter in report.
    to encrypt i use;
    l_encrypted_raw := dbms_crypto.encrypt(src => my_parameter,
    typ => dbms_crypto.des_cbc_pkcs5, key => l_key);
    to decrypt;
    l_decrypted_raw := dbms_crypto.decrypt(src => l_encrypted_raw,
    typ => dbms_crypto.des_cbc_pkcs5, key => l_key);
    in sql developer these codes are running. i can encrypt & decrypt
    but when i want to decrypt in reports it gives an error like this:
    implementation restriction: 'DBMS_CRYPTO.DES_CBC_PKCS5': Cannot directly access remote package variable or cursor
    how can i pass this?
    thanks...

    Hello,
    You should create a "wrapper function"
    Create a function in the database that will call dbms_crypto.encrypt / dbms_crypto.decrypt and call this function in Reports.
    (The problem here seems to be the reference to dbms_crypto.des_cbc_pkcs5)
    Regards

  • EXPDP error - ORA-39126: Worker unexpected fatal error in KUPW$WORKER.UNLOA

    Greetings All,
    Oracle 11g (11.2.0.0) on Windows 2008 R2
    I am getting the error below during a schema export of just 1 particular schema. Other schema expdp’s don’t encounter this problem.
    Processing object type SCHEMA_EXPORT/PACKAGE/PACKAGE_BODY
    Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
    ORA-39126: Worker unexpected fatal error in KUPW$WORKER.UNLOAD_METADATA [REF_CONSTRAINT:"CM_MASTER"."PPY_PEN_FK"]
    ORA-04063: package body "XDB.DBMS_XDBUTIL_INT" has errors
    ORA-06512: at "SYS.DBMS_SYS_ERROR", line 95
    ORA-06512: at "SYS.KUPW$WORKER", line 8165
    ----- PL/SQL Call Stack -----
      object      line  object
      handle    number  name
    000000047B38A000     18990  package body SYS.KUPW$WORKER
    000000047B38A000      8192  package body SYS.KUPW$WORKER
    000000047B38A000      2823  package body SYS.KUPW$WORKER
    000000047B38A000      8847  package body SYS.KUPW$WORKER
    000000047B38A000      1649  package body SYS.KUPW$WORKER
    000000047A576CD0         2  anonymous block
    Job "CM_MASTER"."EXP_CM_MASTER" stopped due to fatal error at 17:11:30I have deleted the identified constraint, but then errors out again on another constraint.
    I have found a tentative resolution for the ORA-39126 error (delete database stats, then gather database stats) but have not done so yet.
    I have tried deleting the statistics for just the schema (cm_master), and then re-gathered stats for the same schema. Still get the error.
    I am concerned about the ORA-04063: package body “XDB.DBMS_XDBUTIL_INT” has errors.
    I have unlocked and set new password for the XDB user, but am not able to logon as XDB to re-compile the package body in question.
    We had some maintenance applied over the weekend that “revoked execute from public” on the following packages:
    dbms_datapump
    dbms_crypto
    dbms_crypto_toolkit
    dbms_java_test
    dbms_random
    dbms_sql
    utl_file
    utl_http
    utl_mail
    utl_smtp
    utl_tcpThe user performing the export with the problem (cm_master) was then granted execute back on the following packages:
    dbms_datapump
    dbms_crypto
    dbms_random
    dbms_sql
    utl_file
    utl_http
    utl_mail
    (not: dbms_crypto_toolkit, dbms_java_test,  utl_smtp, utl_tcp,)Other schemas were granted execute on the following packages and are NOT having expdp problems:
    dbms_datapump
    dbms_sql
    utl_file
    utl_http
    utl_mail
    (not: dbms_crypto, dbms_crypto_toolkit, dbms_random, utl_smtp, utl_tcp )I don't think the public revokes are causing this error because the "Other schemas" do not have this error and were not specifically granted back all of the public revokes that cm_master received back.
    I appreciate any suggestions.
    Thanks for your time,
    Bob
    Edited by: Snyds on Jun 5, 2012 10:03 AM

    rjamya,
    I checked dba_registry, all 18 rows returned are VALID.
    I attempted to compile the package body identified in the error messages:
    ORA-04063: package body "XDB.DBMS_XDBUTIL_INT" has errorswith
    alter package xdb.dbms_xdbutil_int compile body;I got thje following results
    Error starting at line 60 in command:
    alter package xdb.dbms_xdbutil_int compile body
    Error report:
    SQL Command: package XDB.DBMS_XDBUTIL_INT
    Failed: ORA-24344: success with compilation error
    24344. 00000 -  "success with compilation error"
    *Cause:    A sql/plsql compilation error occurred.
    *Action:   Return OCI_SUCCESS_WITH_INFO along with the error code
    package XDB.DBMS_XDBUTIL_INT altered.Any other suggestions regarding how to resolve errors in the XDB.DBMS_ packages?
    I also tried granting CM_MASTER execute on the packages that I revoked execute to PUBLIC on, with no effect.
    I tried “exclude=REF_CONSTRAINT” on the export, the problem seemed to move to the next section:
    Estimate in progress using BLOCKS method...
    Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
    Total estimation using BLOCKS method: 96.31 MB
    Processing object type SCHEMA_EXPORT/USER
    Processing object type SCHEMA_EXPORT/SYSTEM_GRANT
    Processing object type SCHEMA_EXPORT/ROLE_GRANT
    Processing object type SCHEMA_EXPORT/DEFAULT_ROLE
    Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
    Processing object type SCHEMA_EXPORT/DB_LINK
    Processing object type SCHEMA_EXPORT/SEQUENCE/SEQUENCE
    Processing object type SCHEMA_EXPORT/TABLE/TABLE
    Processing object type SCHEMA_EXPORT/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANT
    Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
    Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
    Processing object type SCHEMA_EXPORT/TABLE/COMMENT
    Processing object type SCHEMA_EXPORT/PACKAGE/PACKAGE_SPEC
    Processing object type SCHEMA_EXPORT/FUNCTION/FUNCTION
    Processing object type SCHEMA_EXPORT/PACKAGE/COMPILE_PACKAGE/PACKAGE_SPEC/ALTER_PACKAGE_SPEC
    Processing object type SCHEMA_EXPORT/FUNCTION/ALTER_FUNCTION
    Processing object type SCHEMA_EXPORT/VIEW/VIEW
    Processing object type SCHEMA_EXPORT/PACKAGE/PACKAGE_BODY
    ORA-39126: Worker unexpected fatal error in KUPW$WORKER.UNLOAD_METADATA [PACKAGE_BODY:"CM_MASTER"."SR_MAINTENANCE"]
    ORA-04063: package body "XDB.DBMS_XDBUTIL_INT" has errors
    ORA-06512: at "SYS.DBMS_SYS_ERROR", line 95
    ORA-06512: at "SYS.KUPW$WORKER", line 8165
    ----- PL/SQL Call Stack -----
      object      line  object
      handle    number  name
    000000047B38A000     18990  package body SYS.KUPW$WORKER
    000000047B38A000      8192  package body SYS.KUPW$WORKER
    000000047B38A000      2823  package body SYS.KUPW$WORKER
    000000047B38A000      8847  package body SYS.KUPW$WORKER
    000000047B38A000      1649  package body SYS.KUPW$WORKER
    000000047A576CD0         2  anonymous block
    Job "CM_MASTER"."EXP_CM_MASTER" stopped due to fatal error at 19:36:23I tried the suggestion from my Google-ing, drop database statistics, then gather database statistics. No effect, same error.
    I also tried granting CM_MASTER execute on the packages that I revoked execute to PUBLIC on, with no effect.
    Again what seems odd is that I can export other schemas without errors.
    Any other suggestions, please.
    Thanks,
    Bob
    Edited by: Snyds on Jun 5, 2012 12:04 PM

  • DBMS_CRYPTO package help needed :(

    Hello all,
    I want to use Oracle's DBMS_CRYPTO package for decrypting some data.
    I have one sample program as follows which is not working....the error is shown below.
    SQL> DECLARE
    2 input_string VARCHAR2 (200) := 'Secret Message';
    3 output_string VARCHAR2 (200);
    4 encrypted_raw RAW (2000); -- stores encrypted binary text
    5 decrypted_raw RAW (2000); -- stores decrypted binary text
    6 num_key_bytes NUMBER := 256/8; -- key length 256 bits (32 bytes)
    7 key_bytes_raw RAW (32); -- stores 256-bit encryption key
    8 encryption_type PLS_INTEGER := -- total encryption type
    9 DBMS_CRYPTO.ENCRYPT_AES256
    10 + DBMS_CRYPTO.CHAIN_CBC
    11 + DBMS_CRYPTO.PAD_PKCS5;
    12 BEGIN
    13 DBMS_OUTPUT.PUT_LINE ( 'Original string: ' || input_string);
    14 key_bytes_raw := DBMS_CRYPTO.RANDOMBYTES (num_key_bytes);
    15 encrypted_raw := DBMS_CRYPTO.ENCRYPT
    16 (
    17 src => UTL_I18N.STRING_TO_RAW (input_string, 'AL32UTF8'),
    18 typ => encryption_type,
    19 KEY => key_bytes_raw
    20 );
    21 decrypted_raw := DBMS_CRYPTO.DECRYPT
    22 (
    23 src => encrypted_raw,
    24 typ => encryption_type,
    25 KEY => key_bytes_raw
    26 );
    27 output_string := UTL_I18N.RAW_TO_CHAR (decrypted_raw, 'AL32UTF8');
    28 DBMS_OUTPUT.PUT_LINE ('Decrypted string: ' || output_string);
    29 END;
    30 /
    DBMS_CRYPTO.ENCRYPT_AES256
    ERROR at line 9:
    ORA-06550: line 9, column 2:
    PLS-00201: identifier 'DBMS_CRYPTO' must be declared
    ORA-06550: line 8, column 23:
    PL/SQL: Item ignored
    ORA-06550: line 14, column 21:
    PLS-00201: identifier 'DBMS_CRYPTO' must be declared
    ORA-06550: line 14, column 4:
    PL/SQL: Statement ignored
    ORA-06550: line 15, column 21:
    PLS-00201: identifier 'DBMS_CRYPTO' must be declared
    ORA-06550: line 15, column 4:
    PL/SQL: Statement ignored
    ORA-06550: line 21, column 18:
    PLS-00201: identifier 'DBMS_CRYPTO' must be declared
    ORA-06550: line 21, column 1:
    PL/SQL: Statement ignored
    Oracle version is
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production on linux server.
    can anybody help me how to resolve this problem?
    I mean isnt "DBMS_CRYPTO" Oracle's Standard package?
    pls help.

    Really you should not be using SYSTEM account - you should create your own DBA / Development accounts and use those.
    However, what you are missing is to connect as SYS/SYSDBA and...
    GRANT EXECUTE ON dbms_crypto TO system;

  • Dbms_crypto package for number and date data type

    Hi,
    I am using Oracle 10g 10.2.0.3 on Linux 64 bit
    I am tryiing to use dbms_crypto package for the first time to encypt my tables column
    Following are my table columns
    NAME1 VARCHAR2(2000),
    ID1 NUMBER,
    SCORE number
    This table is already populated
    i want to encrypt Name1 and Score column. Following are the functions i have created for Encryption and decryption.
    --For Encryption
    create or replace function get_enc_val
    p_in in varchar2,
    p_key in raw
    return raw is
    l_enc_val raw (2000);
    l_mod number := dbms_crypto.ENCRYPT_AES128
    + dbms_crypto.CHAIN_CBC
    + dbms_crypto.PAD_PKCS5;
    begin
    l_enc_val := dbms_crypto.encrypt
    UTL_I18N.STRING_TO_RAW
    (p_in, 'AL32UTF8'),
    l_mod,
    p_key
    return l_enc_val;
    end;
    --For Decryption
    create or replace function get_dec_val
    p_in in raw,
    p_key in raw
    return varchar2
    is
    l_ret varchar2 (2000);
    l_dec_val raw (2000);
    l_mod number := dbms_crypto.ENCRYPT_AES128
    + dbms_crypto.CHAIN_CBC
    + dbms_crypto.PAD_PKCS5;
    begin
    l_dec_val := dbms_crypto.decrypt
    p_in,
    l_mod,
    p_key
    l_ret:= UTL_I18N.RAW_TO_CHAR
    (l_dec_val, 'AL32UTF8');
    return l_ret;
    end;
    Key: I have stored a key in other schema and calling it by using function get_key().
    Following is my insert
    INSERT INTO Score_table VALUES
    (get_enc_val('John',get_key()),25,get_enc_val(79,get_key()))
    it is giving me following error
    ORA-00932:Inconsistent Datatypes:Expected number got binary.
    I checked, it is an error due to Score field, which is of number type. So do i need to change type of Score field to varchar or is there any other way to encrypt number and date field.
    If i need to change the type then what will happen to the data already in Table and how do i encrypt data already in table.

    Hi,
    Is there any one who can tell me that, do i need to change my table column data type as the encrypted value will be character.

  • Can't find DBMS_CRYPTO package in my 10g R1

    Hi, I want to use the DBMS_CRYPTO pakage, I found some plsql code to use it, but when compile my code, the databse told me that this pakage not exists, I try with SYS user, but alwas the same error. I can't find this package that assumes to be included in 10g.
    Thanks

    What is the output of this query?
    SQL> select object_name, owner, object_type from dba_objects where object_name = 'DBMS_CRYPTO' ;
    OBJECT_NAME                    OWNER                          OBJECT_TYPE
    DBMS_CRYPTO                    SYS                            PACKAGE
    DBMS_CRYPTO                    SYS                            PACKAGE BODY
    DBMS_CRYPTO                    PUBLIC                         SYNONYM
    SQL> disconnect
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.1.0.3.0 - Production
    With the Partitioning, OLAP and Data Mining options
    SQL>

  • Need some hints on using dbms_crypto

    Hello,
    I need some hints on using the dbms_crypto package to generate some password for the OID userpassword attribute. The passwordstring is stored in a format {CRYPT}dasdasdawdww, {SHA}jfsklefjskldjkdlkldf, {MD4}dfdsfgsdgdfewwe or {MD5}fsdfsdadsgdfg where the keyword in the curly brackets describes the encryption methods. I think CRYPT means DES, SHA means SHA-1.
    The key for the DES encryption for UNIX password authentification is in the first 2 letters of the encrypted string. I wanna have an encryption function which encrypts the clear type passwords in the right format like this perl script:
    #!/bin/perl
    print crypt($ARGV[0],"HS");
    #: crypt.pl Test123 # program fetch
    HSF0Sx2zdrLoQ
    Regards
    Holger

    Hello,
    meanwhile I made some investigations on the Problem
    I tried this code:
    DECLARE
    input_string       VARCHAR2 (200) :=  'Test123';
    output_string      VARCHAR2 (200);
    encrypted_raw      RAW (2000);             -- stores encrypted binary text
    decrypted_raw      RAW (2000);             -- stores decrypted binary text
    num_key_bytes      NUMBER := 256/8;        -- key length 256 bits (32 bytes)
    key_bytes_raw      RAW (32);               -- stores 256-bit encryption key
    encryption_type    PLS_INTEGER :=          -- total encryption type
                             DBMS_CRYPTO.ENCRYPT_DES
                           + DBMS_CRYPTO.CHAIN_CBC
                           + DBMS_CRYPTO.PAD_PKCS5;
    BEGIN
            DBMS_OUTPUT.PUT_LINE ( 'Original string: ' || input_string);
            key_bytes_raw := UTL_I18N.STRING_TO_RAW ( 'HS' );
            encrypted_raw := DBMS_CRYPTO.ENCRYPT
                            src => UTL_I18N.STRING_TO_RAW (input_string,  'AL32UTF8'
                            typ => encryption_type,
                            key => key_bytes_raw
    -- The encrypted value "encrypted_raw" can be used here
            DBMS_OUTPUT.PUT_LINE ( 'Encrypted string: ' || encrypted_raw);
            decrypted_raw := DBMS_CRYPTO.DECRYPT
                            src => encrypted_raw,
                            typ => encryption_type,
                            key => key_bytes_raw
            DBMS_OUTPUT.PUT_LINE ('Decrypted string: ' || UTL_I18N.RAW_TO_CHAR (decr
    ypted_raw, 'AL32UTF8'));
            DBMS_OUTPUT.PUT_LINE ('Encrypted Char string: ' || UTL_I18N.RAW_TO_CHAR
    (encrypted_raw, 'AL32UTF8'));
    END;
    /and got these error messages:
    ERROR at line 1:
    ORA-28234: key length too short
    ORA-06512: at "SYS.DBMS_CRYPTO_FFI", line 3
    ORA-06512: at "SYS.DBMS_CRYPTO", line 10
    ORA-06512: at line 15In the next try:
    DECLARE
    input_string       VARCHAR2 (200) :=  'Test123';
    output_string      VARCHAR2 (200);
    encrypted_raw      RAW (2000);             -- stores encrypted binary text
    decrypted_raw      RAW (2000);             -- stores decrypted binary text
    num_key_bytes      NUMBER := 256/8;        -- key length 256 bits (32 bytes)
    key_bytes_raw      RAW (32);               -- stores 256-bit encryption key
    encryption_type    PLS_INTEGER :=          -- total encryption type
                             DBMS_CRYPTO.ENCRYPT_DES
                           + DBMS_CRYPTO.CHAIN_CBC
                           + DBMS_CRYPTO.PAD_PKCS5;
    BEGIN
            DBMS_OUTPUT.PUT_LINE ( 'Original string: ' || input_string);
            key_bytes_raw := UTL_I18N.STRING_TO_RAW ( 'HS12345678901234' );
            encrypted_raw := DBMS_CRYPTO.ENCRYPT
                            src => UTL_I18N.STRING_TO_RAW (input_string,  'AL32UTF8'
                            typ => encryption_type,
                            key => key_bytes_raw
    -- The encrypted value "encrypted_raw" can be used here
            DBMS_OUTPUT.PUT_LINE ( 'Encrypted string: ' || encrypted_raw);
            decrypted_raw := DBMS_CRYPTO.DECRYPT
                            src => encrypted_raw,
                            typ => encryption_type,
                            key => key_bytes_raw
            DBMS_OUTPUT.PUT_LINE ('Decrypted string: ' || UTL_I18N.RAW_TO_CHAR (decr
    ypted_raw, 'AL32UTF8'));
            DBMS_OUTPUT.PUT_LINE ('Encrypted Char string: ' || UTL_I18N.RAW_TO_CHAR
    (encrypted_raw, 'AL32UTF8'));
    END;
    /I got some results which have nothing in common with the perl script:
    Original string: Test123
    Encrypted string: DE5668CD7762074C
    Decrypted string: Test123
    Encrypted Char string: ?h?bL
    PL/SQL procedure successfully completed.Come to think of it I doubt if DBMS_CRYPTO is the right way to solve my problem. Any further hints?
    Regards Holger

Maybe you are looking for