Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Thanks for the replies. I guess this is more of a general question because my encryption/decryption scripts work (they encrypt the data and I'm able to decrypt until this one). But here is the code doing the work:
ENCRYPT SCRIPT #!/usr/bin/perl use DBI; use Crypt::Rijndael; $iv = 'same_16_character_string'; $cipher = Crypt::Rijndael->new( "a" x 32, Crypt::Rijndael::MODE_CBC ); $cipher->set_iv($iv); $data = $cipher->encrypt($some_data); ** $data is then inserted into a blob field in mysql (data in the acco +unts table) DECRYPT SCRIPT #!/usr/bin/perl use DBI; use Crypt::Rijndael; $iv = 'same_16_character_string'; $cipher = Crypt::Rijndael->new( "a" x 32, Crypt::Rijndael::MODE_CBC ); $cipher->set_iv($iv); $sql_data = "SELECT data FROM accounts WHERE account_id = '237' LIMIT +1"; $qry_data = $dbh->prepare($sql_data); $qry_data->execute(); $data = $qry_data->fetchrow_hashref(); $data = $data->{data}; print $cipher->decrypt($data) . "\n\n";
So as you can see I do no extra work on the data before it is inserted into the blob field...just a simple encrypt. The problem now is I have a piece of data encrypted this way that won't decrypt. I get that error on the $cipher->decrypt($data) line, but only with this specific piece of data.

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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2024-04-24 22:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found