DBMS_CRYPTO
Hi ,
Please help me on this
I am having a function to encrypt a string accepting a key value.
CREATE OR REPLACE FUNCTION encrypt_data(
enc_string IN VARCHAR2,
key_value IN VARCHAR2
RETURN VARCHAR2
AS
l_key RAW(256);
l_stored_key RAW(256);
g_master_key VARCHAR2(32) := 'test123';
l_mod NUMBER
:= DBMS_CRYPTO.encrypt_aes256
+ DBMS_CRYPTO.chain_cbc
+ DBMS_CRYPTO.pad_pkcs5;
BEGIN
IF (key_value IS NULL OR
key_value != g_master_key)
THEN
RETURN NULL;
END IF;
-- Random key generation
l_key :=
UTL_RAW.cast_to_raw(DBMS_RANDOM.STRING('p', 256));
-- Encrypts random key with master key into a stored key
l_stored_key :=
DBMS_CRYPTO.encrypt(l_key,
l_mod,
UTL_I18N.string_to_raw(g_master_key, 'AL32UTF8')
-- returns encrypted salary that is encrypted with the random key
RETURN UTL_ENCODE.base64_encode
(DBMS_CRYPTO.encrypt(UTL_I18N.string_to_raw(enc_string,
'AL32UTF8'),
l_mod,
l_stored_key
END;
But I am getting the following error when trying to execute,Please help
SQL>select ENCRYPT_DATA('TEST','test123') from dual;
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 "CTS_VSD01.CMS_DB_ENCRYPTION", line 28
Edited by: SSNair on Mar 15, 2010 5:21 AM
Edited by: SSNair on Mar 15, 2010 5:26 AM
Hi,
Your key should be atleast 8bytes long.
Might be below query works for you.
select ENCRYPT_DATA('TEST','test1234') from dual;Regards
Anurag.
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.
eserHello,
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 -
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. -
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.
lgswell, 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. -
How to find length of string after encryption using DBMS_CRYPTO package
Hi,
I am planning do data encryption using DBMS_CRYPTO package. I want to find how much will be string length after encryption.
e.g When I try to encrypt string of length between 1-15 characters it gives me encrypted string of 32 characters. When I try with 16 charcters encrypted string is of 64 characters.
Is ther any formula to calculate length of encrypted string?
Thanks
PravinThe length change is dependent upon the algorithm you are using which can be a combination of cipher block, padding, and chaining.
The best solution is determine the method you are going to use and apply it to the l ongest possible strings you are going to proces, then add some safety margin. There iis no penalty for defining your column as VARCHAR2(4000). -
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.
ThanksWhat 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> -
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 -
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
HolgerHello,
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 -
Encrypt and decrypt using dbms_crypto.hash
hi to all i am newbie here and i've just want to ask if how can i decrypt the encryted password.
v_pass_string = 'qwerty';
lower(dbms_crypto.hash(to_clob(v_pass_string),3))
The out is: b1b3773a05c0ed0176787a4f1574ff0075f7521e
and i want to output it into original data which is *'qwerty'*
please help...
thanks in advanceYou can't.
HASH is not an encryption algorithm, it is a one-way hashing algorithm. HASHed cannot be converted back to the original value. This is one reason they are used for passwords as they offer the best security.
If you want to encrypt and decrypt values you would use the ENCRYPT and DECRYPT functions of the DBMS_CRYPTO package...
http://www.psoug.org/reference/dbms_crypto.html -
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, --DDMaybe, 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 -
Key generation using DBMS_CRYPTO
Hi,
I have a question about DBMS_CRYPTO pacakge , which can be used for encrypting sensitive data. When we use this package, is it a must that we have to supply the encryption key or is it that the package can itself generate the key? I read in the documentiation about RANDOMBYTES function (http://download.oracle.com/docs/cd/B14117_01/appdev.101/b10802/d_crypto.htm#1000530) but I don't know exactly how it can be used.
Basically my doubt is, when we use this package, we have to pass in the encryption key as a parameter and we have to know it or is there a way oracle can entirely take care of it?
ThanksThe way the DBMS_CRYPTO package works is with providing an encryption key to encrypt and to decrypt. I think personal looking at your question and the remarks you place you are looking for a solution like "Oracle Advanced Security", see http://www.oracle.com/us/products/database/options/advanced-security/index.html
Regards, Gerwin -
Can the dbms_crypto package be used to decrypt a winzip file?
I have a password protected winzip file. I know the password.
Is it possible to decrypt this file using dbms_crypto or is this not supported?
I have searched everywhere for the answer!
Please help :-)
Thankssimple example...
create or replace and compile java source named unZip as
import java.io.ByteArrayOutputStream;
import java.util.zip.Inflater;
public class ByteArrayUnzip {
public byte[] decompressByteArray(byte[] bytes){
ByteArrayOutputStream baos = null;
Inflater inf = new Inflater();
inf.setInput(bytes);
baos = new ByteArrayOutputStream();
byte[] temp = new byte[4*1024];
try {
while(!inf.finished())
int size = inf.inflate(temp);
baos.write(temp, 0, size);
} catch (Exception e){
} finally {
try{
if(baos != null) baos.close();
} catch(Exception e){}
return baos.toByteArray();
create or replace function unzip (p_buf in raw) return raw
as language java
name 'ByteArrayUnzip.decompressByteArray(byte[]) return byte[]';
declare
v_buf raw(2000);
v_res raw(2000); -- or blob maybe
begin
v_buf := <your data>
v_res := unzip(v_buf);
end;
hope it'll help -
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.
Maybe you are looking for
-
**i have a weird problem with my itunes witch just recently started. when i wake my macbook up and start itunes it will hang for about 45sec to a minute before opens. i can either wait or force quit and restart. ones i get it started it will open fin
-
Is it possible to have Tree chart in OBIEE 11g. How can one go about it? thanks Reshmi
-
10g install simply stops at 'Cloning database creation in progress,' part of the Oracle Database configuration assistant phase in the Universal Installer. I cannot see any error outputs, but this phase stops at 45% complete. I tried three times now,
-
Function to get the layout and variant info of a report
Hi , I have report zmm4. I have created a variant 'var1' . The output format of the report is defined in the layout 'lay1'. Which is the function which gives the complete info about the displaying coulmns of those layout ? because I need replicate t
-
Looking for the SAP Font used in Ads
Hi, I am trying to make a wallpaper just like the SAP Ads that say " XXX RUNS SAP " but for the company I work for. But I have not got any luck finding the font. It is the same that in this page on the right upper corner that says: SAP COMMUNITY NETW