in reply to Re: decrypt problems with Crypt::Rijndael (datasize not multiple of blocksize)
in thread decrypt problems with Crypt::Rijndael (datasize not multiple of blocksize)

So close, and yet so far... You have left out the critical (and most likely problematic) piece; the DB insertion. I will bet that if you try to decrypt immediately after you encrypt, it will work fine. The problem is that either your insert or select is munging up the data. I have not used blobs with perl/dbi, so I am not aware of specific issues. Look at http://www.james.rcpt.to/programs/mysql/blob/. Is this the way you are creating the insert?
  • Comment on Re^2: decrypt problems with Crypt::Rijndael (datasize not multiple of blocksize)

Replies are listed 'Best First'.
Re^3: decrypt problems with Crypt::Rijndael (datasize not multiple of blocksize)
by by88 (Initiate) on Sep 29, 2008 at 14:38 UTC
    I can't imagine that's the problem, but I guess it's possible. Here's the update:
    $sql_update = "UPDATE accounts SET data = '" . $data . "', encrypted = + '1' WHERE account_id = '" . $account_id . "'"; $qry_update = $dbh->prepare($sql_update); $qry_update->execute();
    $data is the encrypted piece

      Use placeholders!

      $sql_update = 'UPDATE accounts SET data = ?, encrypted = 1 WHERE accou +nt_id = ?'; $qry_update = $dbh->prepare($sql_update); $qry_update->execute($data, $account_id);