My input string is : CR12801
I want my decrypt string : 00FAD6ADD6224CBE91CA1E50EF39DDA2010000001537B666CDDB18DA7DC15506545A6CEDFA0459CBE0027F9D2D52DB3E1D82D4BD
Using Procedure:
DECLARE
input_string VARCHAR2 (2000) := 'CR12801';
output_string VARCHAR2 (200);
encrypted_raw RAW (2000); -- stores encrypted binary text
decrypted_raw RAW (2000); -- stores decrypted binarytext
num_key_bytes NUMBER := 256 / 8; -- key length 256 bits (32bytes)
key_bytes_raw RAW (32); -- stores 256-bit encryption key
encryption_type PLS_INTEGER
:= -- total encryptiontype
DBMS_CRYPTO.ENCRYPT_AES256
+ 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 ('Metba123Metba123Metba123Metba123');
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);
output_string := UTL_I18N.RAW_TO_CHAR (decrypted_raw, 'AL32UTF8');
DBMS_OUTPUT.PUT_LINE ('Decrypted string: ' || output_string);
END;
- But using this procedure i found the decrypted value like ' DF0635E425C654DCEDBEAC05A8A0AA46'
- But i want the value like '00FAD6ADD6224CBE91CA1E50EF39DDA2010000001537B666CDDB18DA7DC15506545A6CEDFA0459CBE0027F9D2D52DB3E1D82D4BD '
Is there any way to find the exact value what i mentioned ?