linuxfan has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks,

I hope this is not completely off-topic. I have encrypted data stored in a table on a DB2 database. The encryption algorithm used to store data in the table is not important. Using a perl script and the DBI module, I was able to read the values stored in the column into an array. However, I do not know what transformation needs to be applied to this data (with pack or unpack for e.g) so I can use this variable for other tasks.

When I run a select on the table from a db2 prompt, I see that an encrypted value looks like this:

 1 x'D6B6D2EE0C57ADF2'

I had a similar problem with Oracle but was able to use the extracted encrypted data as-is without massaging it.

Thank you very much!

  • Comment on interpreting encrypted data stored on DB2 using Perl

Replies are listed 'Best First'.
Re: interpreting encrypted data stored on DB2 using Perl
by waswas-fng (Curate) on Dec 10, 2004 at 16:37 UTC
    So are you getting different results for the data from the db2 prompt vs DBI? Your example and question are missing key points that allow anyone to answer. What output are you looking for, what output are you getting? are you asking how to take the output and decrypt it? if so what encryption are you using (as it would matter). Please describe your problem a little better.


    -Waswas
      Sorry about the lousy description earlier. Here's the situation:

      I have a server that encrypts plaintext based on the request it receives(plaintext, algorithm, keyname etc.). I can add databases configurations to the server, and also choose specific columns in a table to be encrypted by the server. Once I select a table to be encrypted with a given key/algorithm, the server encrypts all the contents of the column and creates a new table on the database with the encrypted data.

      Now I want to verify if the encryption was indeed correct. So I extract the encrypted data from the new table (using perl and DBI), and send a decrypt request to the server with all the relevant info(key, algorithm etc.). If the resulting plaintext matches that in the original table, I know that the server's encryption is correct.

      So the problem I am facing is - Do I need to transform the data extracted from the encrypted column before sending it to the server for decryption? I hope makes my question clear. Thanks for your help!

      linuxfan

        No, as long as the encrypted block is string friendly and in a varchar or similar feild in the database you transformations are necessary.


        -Waswas