title: Can the Oracle PL/SQL dbms_crypto package decrypt a file encrypted with the Linux gpg command?
body: <p>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.</p>
  
  <p>At the Linux prompt I created a key with this command:</p>
  
  <pre><code>gpg --gen-key
  </code></pre>
  
  <p>Created a public key with this command (using an actual email addr):</p>
  
  <pre><code>gpg --armor --export xxx@yyy.com &gt; mypublickey
  </code></pre>
  
  <p>And encrypted my file like this:</p>
  
  <pre><code>gpg -r xxx@yyy.com --output input.txt.encrypted --encrypt input.txt
  </code></pre>
  
  <p>amongst the stdout was this message:</p>
  
  <pre><code>gpg: encrypted with 2048-bit RSA key
  </code></pre>
  
  <p>So now I have an encrypted file.</p>
  
  <p>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:</p>
  
  <pre><code>select dbms_crypto.decrypt(
            encrypted_file,
            ?,
            utl_raw.cast_to_raw('public_key'),
            null)
  from crypto_test_lobs
  </code></pre>
  
  <p>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.</p>
  
  <p>So my questions are:</p>
  
  <ol>
  <li>Is this possible?</li>
  <li>How do I figure out that 2nd argument?</li>
  </ol>
  
  <p>Thanks</p>