Hi everyone!
I'm trying to mimic a bash script in perl and i'm stuck on trying to decode a encode file i previously fetch from mega.co.nz.
That's the bash code with some filled-in variables:

openssl enc -d -aes-128-ctr -K 101488e2533e9a4428afbb2d0055258d -iv 69eec1fb38b11fc30000000000000000 -in asd.enc -out asd

I've tried to decode the same file with the same key/iv without success using Crypt::CBC and Rijndael without luck, that's the snippet i got from another monk i'm actually trying:
my $cipher = Crypt::CBC->new( -cipher => 'Rijndael' , -key => $key , -iv => $iv , -regenerate_key => 0 , -padding => 'space' , -prepend_iv => 0 ); my $buffer; my $tmpfile = 'somefile'; open(FH_crypted, "<$tmpfile"); binmode FH_crypted; open(FH_decrypted, ">$tmpfile.good"); binmode FH_decrypted; $cipher->start('decrypting'); while (read(FH_crypted,$buffer,1024)) { print FH_decrypted $cipher->crypt($buffer); } print FH_decrypted $cipher->finish; $cipher->finish; close FH_crypted; close FH_decrypted;

The resulting file is just garbage, not the decoded file and one byte shorter.
Thank you for your time!

In reply to Trying to decode aes-128-ctr by starless

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.