Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

3des encryption

Former Member
0 Likes
502

Hi all,

I have created a Oracle database proceudure as follows

CREATE OR REPLACE procedure encrypt_card_1hex(

plain_card_id IN varchar2,

password_t IN varchar2,

enc_card_string out varchar2,

whch IN number)

as

pseudo_string varchar2(100);

plain_card_string varchar2(24) := plain_card_id;

key_string varchar2(24) := password_t;

encrypted_card_string varchar2(256);

begin

dbms_obfuscation_toolkit.DES3Encrypt(

input_string => plain_card_string,

key_string => key_string,

encrypted_string => encrypted_card_string,

which => whch);

enc_card_string := rawtohex(UTL_RAW.CAST_TO_RAW(encrypted_card_string));

end;

I have created an abap program to encrypt a string using this procedure

PARAMETERs: cr_card(24).

DATA: en_card type c length 48,

pwdc(24),

which TYPE i,

f1(80).

PARAMETERS: crcard type c length 24.

START-OF-SELECTION.

MOVE 'f9ejds73hs727i0z' TO pwdc.

EXEC SQL.

execute procedure

encrypt_card_1hex ( in :crcard, in :pwdc, out :en_card, in 0)

ENDEXEC.

This returns a 32 character string. But if this procedure is called from PL sql, it returns 48 characters. Also if the input cr_card is not a multiple of 8, the program abends with the following error:-

Database error text........: "ORA-28232: invalid input length for obfuscation

toolkit#ORA-06512: at "SYS.DBMS_OBFUSCATION_TOOLKIT_FFI", line 0#ORA-06512: at

"SYS.DBMS_OBFUSCATION_TOOLKIT", line 201#ORA-06512:

Any takers. I have never returned emplty handed from sdn.

thanks

Ravi

1 REPLY 1
Read only

Former Member
0 Likes
377

I realised that it is possible in 46c

Ravi