I'm new to encryption and am trying to figure out if the Linux gpg command and Oracle's dbms_crypto package can work together. Oracle version is 11R2. I'll be receiving files encrypted by a different system and would like to decrypt them via PL/SQL if possible. I'm running through the thread below as a POC to see if this is possible.
At the Linux prompt I created a key with this command:
gpg --gen-key
Created a public key with this command (using an actual email addr):
gpg --armor --export xxx@yyy.com > mypublickey
And encrypted my file like this:
gpg -r xxx@yyy.com --output input.txt.encrypted --encrypt input.txt
amongst the stdout was this message:
gpg: encrypted with 2048-bit RSA key
So now I have an encrypted file.
Using blobs/clobs I loaded my encrypted file and my pub key into an Oracle table. I'm attempting to use the dbms_crypto.decrypt function to decrypt the file:
select dbms_crypto.decrypt(
encrypted_file,
?,
utl_raw.cast_to_raw('public_key'),
null)
from crypto_test_lobs
At this point I'm unsure what values to pass for the 2nd argument which is the "Stream or block cipher type and modifiers to be used". I've tried several different combinations which result in a variety of exceptions that are probably not worth posting.
So my questions are:
- Is this possible?
- How do I figure out that 2nd argument?
Thanks