Dbms_crypto package and grants to public

on 11g RAC installaton we are not getting on default , grants on dbms_crypto to public are set and some time this package is also not installed. what could be the reason ?

Hi,
Post here what you're trying to do.
Oracle Database installs this package in the SYS schema. You can then grant package access to existing users and roles as needed.
http://download.oracle.com/docs/cd/E11882_01/appdev.112/e16760/d_crypto.htm#i1004143
$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.2.0 Production on Wed Aug 24 12:55:59 2011
Copyright (c) 1982, 2010, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
SQL> select * from v$version;
BANNER
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
PL/SQL Release 11.2.0.2.0 - Production
CORE    11.2.0.2.0      Production
TNS for IBM/AIX RISC System/6000: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - Production
SQL> SELECT OWNER,SYNONYM_NAME,TABLE_OWNER FROM DBA_SYNONYMS WHERE TABLE_NAME ='DBMS_CRYPTO';
OWNER                          SYNONYM_NAME                   TABLE_OWNER
PUBLIC                         DBMS_CRYPTO                    SYS
SQL> create user cool identified by cool account unlock;
User created.
SQL> grant connect to cool;
Grant succeeded.
SQL> grant execute on dbms_crypto to cool;
Grant succeeded.
SQL> grant execute on dbms_crypto to public;
Grant succeeded.Levi Pereira

Similar Messages

  • Grant execute on DBMS_CRYPTO package (11R1)

    I figured out I needed to grant my user access to this SYS package using:
    SQL> grant execute on DBMS_CRYPTO to lob_demo;
    Grant succeeded.
    yet after doing this, I still get this error:
    SQL> select DBMS_CRYPTO.HASH(bytes, DBMS_CRYPTO.HASH_SH1) from blobslicer where id=1;
    select DBMS_CRYPTO.HASH(bytes, DBMS_CRYPTO.HASH_SH1) from blobslicer where id=1
    ERROR at line 1:
    ORA-06553: PLS-221: 'HASH_SH1' is not a procedure or is undefined
    Yet if I use the numeric constant for DBMS_CRYPTO.HASH_SH1 (3), it works:
    SQL> select DBMS_CRYPTO.HASH(bytes, 3) from blobslicer where id=1;
    F5A7338EFFEB15A49AFC9545393EF685BB51F931
    So what am I missing that prevents me from having access to a constant in the package when I can successfully use one of the function of that same package?
    Thanks, --DD                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Maybe, that makes a little bit clearer the difference
    between usage of package constants in sql and pl sql...That's what I suspected, thank you for hammering the point home Maxim.
    The taken away for me is that package constants are not available to SQL code, only to PL/SQL code. (irrelevant of their type most likely).
    I actually tried to grant my user SELECT privileges on the package, because accessing a constant from a package is more akin to SELECT than EXECUTE, but of course one cannot do that.
    Thank you both again for the help. --DD                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • 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.

  • Granting view/select access to packages and procedures

    We have role that we grant to users allowing them select access to tables, views, etc.
    They also need to be able to view the contents of packages, etc.
    Does anyone no a way of granting them access (other than grant execute) so they can only view the content of a package?

    It is not normal for users to be granted access to the source code. Even if you have EXECUTE on another user's package you can only read the spec, not the body.
    If you want to do this then you will need to build some filtering views over the _SOURCE view and grant SELECT on the new views to the users in question.
    A much better solution would be to just allow people to look at the source in the source control repository.
    Cheers, APC
    blog: http://radiofreetooting.blogspot.com

  • 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;

  • Hiding the column data. What is the point of DBMS_CRYPTO package?

    DB version:10g R2
    A requirement has come where we need to hide some columns' data from end users.
    Trasparent Data Encryption feature wouldn't do the trick as it encrypts the data only at the storage level not at user level.
    I've seen PL/SQL codes using DBMS_CRYPTO which encrypts and decrypts input strings like the code mentioned in
    Re: Need some hints on using dbms_crypto
    What is point of these PL/SQL codes?
    They can only be used to create functions which will be called in VIEWS. That is the only use of DBMS_CRYPTO package. Right?
    Do you guys have any suggestion in hiding/obfuscating column data? Is creating a view my only option?

    One solution to "hide" data (columns or rows) from end users is simply to create a view.
    The end user will be granted only access to the view and not to the base tables behind the view. The view will only expose those cloumns and rows that the end users is supposed to see.
    Of cause this has nothing to do with encryption. But I don't see anything in your business requirements that needs to use encryption methods.

  • Dbca and permissions to public

    I am looking for a minimum list of the permissions that need to be granted to public.
    I have used the dbca (10g) to create a database and am a little alarmed to find that there are database tables that have insert, update and delete granted to public. Plus there are a lot of procedures/packages that allow public execute. I realize that there is some basic stuff that needs public access, but I have to really wonder about some of the things I am seeing when I do queries like:
    select * from dba_tab_privs where grantee='PUBLIC' and privilege in ('INSERT','UPDATE','DELETE')
    when you add 'EXECUTE' to that list, you get lots of items returned.
    I am wondering if there is a list somewhere of what is absolutely necessary. I have been hunting in the docs for this and have come up with nothing so far. If anyone can point me at the right place, I'd appreciate it. Thanks

    this is an excellent site. http://www.petefinnigan.com
    Look for database checklists.
    HTH -Kevin

  • How To Modify Privileges For APEX Objects Granted To PUBLIC?

    I have searched this forum but couldn't any threads relating to this...
    We have APEX 3.0.1 installed in some 10g (10.2.0.2) databases that host GIS data. I was informed by a GIS administrator that when using ESRI tool to search for data, the objects that belongs to FLOWS_030000 schema and ones that were granted to PUBLIC are shown. He would like to know if there is a way to hide these objects so they don't show up on the list? There are about 176 objects granted to public from the flows_030000 schema.
    Could we establish a different security scheme that could accomplish the same thing? Maybe we need to create a new account and a role. Grant all of the privileges for flows_030000 to public to the new role. Then grant the role to the new account and the flow_files schema?
    Our goal here is to make the flows_030000 objects hidden from the ESRI tools and still have APEX working properly.

    If you look at the grants, you'll see that there are over 170 objects from the FLOWS_030000 granted to PUBLIC:
    SQL> select count(*) from dba_tab_privs where owner= 'FLOWS_030000' and grantee = 'PUBLIC';
    173
    If we were go grant these privileges to a role, called APEX_APP_RU, and grant this role to APEX_PUBLIC_USER and any schemas an application is linked to (Workspace to Schema), would that be a workable solution?
    The only problem I see right off hand that this might not work is that PUBLIC has synonyms created for the FLOWS_030000 objects. If we revoke the underlying privileges, because of the synonyms, this might not work.
    SQL> select COUNT(*) from dba_synonyms where table_owner = 'FLOWS_030000' and owner = 'PUBLIC';
    176
    Does anyone else have any ideas?

  • How to create package and import from jar file?

    Hi all,
    I am writing a software and I am not sure how to create a package for the classes.
    Say I have two classes in the same directory as follows:
    testA.java
    ==========
    package AB;
    public class testA
    public static void main(String[] args){
         testB myB = new testB();
         System.out.println("A test");
    testB.java
    ===========
    package AB;
    public class testB
    public testB(){
         System.out.println("B constructor");
    both file compile without the package heading;
    both file compile using: javac -classpath .\ *.java
    Question 1:
    I cannot run testA by: java -classpath .\ testA
    I think it is a syntax error. What is the correct one?
    If I run testA by: java testA
    The only output I get is: A test
    But I am expecting: B constructor /n A test
    What went wrong?
    Question 2:
    I need to use APIs of another software. I have downloaded a .jar file (xxx.jar) with all the classes in it. And I have put "import xxx.*;" in my source file. But the compiler complains about the importing. What is the right way to copmile it?
    I have read a couple of tutorials but they don't answer my question.
    (I am using windows2000 and don't have the classpath variable.)
    Hope some one can help.
    Thanks a lot

    Try moving testA out of the package and importing 'AB.*;'
    If you have:
    ./testA.class
    ./AB/testb.class
    Then to execute testA from ./ type: java -cp . testA

  • Package and error

    Hi was give this source code but when i compile i get this error it says package does not exist why is that my stack code seems to compile fine but my other code does not
    C:\Users\Owner\Desktop\Java Data Structures\Data Structures programs\ArrayStack.java:7: package java.foundations.exceptions does not exist
    import java.foundations.exceptions.*;
    ^
    C:\Users\Owner\Desktop\Java Data Structures\Data Structures programs\ArrayStack.java:10: cannot find symbol
    symbol: class Stack
    public class ArrayStack<T> implements Stack<T>
    ^
    C:\Users\Owner\Desktop\Java Data Structures\Data Structures programs\ArrayStack.java:10: interface expected here
    public class ArrayStack<T> implements Stack<T>
    ^
       package javafoundations;
        public interface Stack<T>
           public void push (T element);
           public  T pop ();
           public T peek();
           public boolean isEmpty();
           public int size();
           public String toString();
       package javafoundations;
       import java.foundations.exceptions.*;
        public class ArrayStack<T> implements Stack<T>
          private final int DEFAULT_CAPACITY = 10;
          private int count;
          private T[] stack;
           public ArrayStack()
             count = 0;
             stack = (T[]) (new Object[DEFAULT_CAPACITY]);
           public void push (T element)
             if (count == stack.length)
                expandCapacity();
             stack[count] = element;     
             count++;
           public String toString()
             String result = "<top of stack>\n";
             for(int index = count-1; index >= 0; index--)
                result += stack[index] + "\n";
             return result + "<bottom of stack>";
           private void expandCapacity()
             T[] larger = (T[]) (new Object[stack.length*2]);
             for (int index = 0; index< stack.length; index++)
                larger[index] = stack[index];
             stack = larger;
       }

    Given that the current package is "javafoundations", are you sure that you should be calling import with:
    import java.foundations.exceptions.*; and not instead call:
    import javafoundations.exceptions.*; ?
    Otherwise without seeing your code and your current package and directory hierarchy, it may be hard for us to know what is wrong.

  • 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

  • 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

  • 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

  • JAVA PACKAGES and JSP

    i Have two problems one is i am designing a website which consists of a form. I am trying to write the Connectiviy and all other insert statements in seperate java packages and include them in JSP files.
    i Have two java packages one is DBUtil(having two java files both dealing with connectovity) and another one is StudentUtIl which has java files that open the connections with database connection and insert data into DB., I am having a big Problem here. How can i call the function in the other java package in the files in this java package. i have openDB()and Close() in the other Db and i want to call these functions in JAVA classes in the other package. How to include a package. Both these packages are in the same File system mounted on a Local directory

    Thank you for the reply. I am giving the code i have given the full class name . and now it is giving the following error :
    Cannot reference a non-static method connectDB() in a static context.
    I am also giving the code. Please do help me on this. i am a beginner in java.
    import java.sql.*;
    import java.util.*;
    import DButil.*;
    public class StudentManager {
    /** Creates a new instance of StudentManager */
    public StudentManager() {
    Connection conn = null;
    Statement cs = null;
    public Vector getStudent(){
    try{
    dbutil.connectDB();
    String Query = "Select St_Record, St_L_Name, St_F_Name, St_Major, St_Email_Address, St_SSN, Date, St_Company, St_Designation";
    cs = conn.createStatement();
    java.sql.ResultSet rs = cs.executeQuery(Query);
    Vector Studentvector = new Vector();
    while(rs.next()){
    Studentinfo Student = new Studentinfo();
    Student.setSt_Record(rs.getInt("St_Record"));
    Student.setSt_L_Name(rs.getString("St_L_Name"));
    Student.setSt_F_Name(rs.getString("St_F_Name"));
    Student.setSt_Major(rs.getString("St_Major"));
    Student.setSt_Email_Address(rs.getString("St_Email_Address"));
    Student.setSt_Company(rs.getString("St_Company"));
    Student.setSt_Designation(rs.getString("St_Designation"));
    Student.setDate(rs.getInt("Date"));
    Studentvector.add(Student);
    if( cs != null)
    cs.close();
    if( conn != null && !conn.isClosed())
    conn.close();
    return Studentvector;
    }catch(Exception ignore){
    return null;
    }finally {
    dbutil.closeDB();
    import java.sql.*;
    import java.util.*;
    public class dbutil {
    /** Creates a new instance of dbutil */
    public dbutil() {
    Connection conn;
    public void connectDB(){
    conn = ConnectionManager.getConnection();
    public void closeDB(){
    try{
    if(conn != null && !conn.isClosed())
    conn.close();
    }catch(Exception excep){
    The main error is occuring at the following lines connectDB() and closeDB() in the class student manager. The class dbutil is in an another package.with an another file called connectionManager which establishes the connection with DB. The dbutil has the openconnection and close connection methods. I have not yet written the insert statements in StudentManager. PLease do Help me

  • How could I Encrypt the data of SDO_GEOMETRY type using DBMS_CRYPTO package

    Hi:
    I want to Encrypt the data of SDO_GEOMETRY object type using DBMS_CRYPTO package.
    What could I do? hope anyone can help me,give me a suggestions!
    thanks in advance.
    lgs

    well, the spatial api would not be able to handle this data anymore, so what you are trying to do is converting an SDO_GEOMETRY to some cryptable user type (see http://download-uk.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_crypto.htm#sthref1506) and encrypting this.
    Before using the SDO_GEOMETRY type will have to decrypt and reconvert it again and pass it to the spatial query or function.

Maybe you are looking for