1

Is there a way to set the salt in pl/sql when using DBMS_CRYPTO?

My code looks like:

--PBEWithMD5AndTripleDES -> Origin Encryption algorithm
encryption_type    PLS_INTEGER := SYS.DBMS_CRYPTO.DES3_CBC_PKCS5 + DBMS_CRYPTO.HASH_MD5;
saltInput RAW(2000); -- needed to parse value for decryption process
digestInput RAW(2000); -- needed to parse value for decryption process
password RAW(2000); -- Password (Raw) AL32UTF8 converted


rawOutput := SYS.DBMS_CRYPTO.DECRYPT
(
     src => digestInput,
     typ => encryption_type,
     key => password
     -- add salt here for the decryption like it was originally made
);

I need to add the salt which was randomly created when encrypting and attached to the front of the encrypted value.

I am able to get this salt, but I am not able to tell DBMS_CRYPTO to use the salt for it's encryption and decryption algorithm.

Pwnstar
  • 2,333
  • 2
  • 29
  • 52
  • 1
    Usually a salt is just added (e.g. appended or prepended) to the data to be encrypted, so decryption would involve removing it in the same way. Why are you using a salt anyway? – Jeffrey Kemp Jul 05 '17 at 02:33
  • Thats what I am trying to do – Pwnstar Jul 05 '17 at 05:52
  • I want to replicate the same decryption as I would do with PooledPBEStringEncryptor of the Jasypt library in Java – Pwnstar Jul 05 '17 at 05:53
  • How is the salt used to generate the original input? That is what you need to determine in order to know how to reverse the process. – Jeffrey Kemp Jul 05 '17 at 09:24

0 Answers0