I can reproduce this error as follows:
use Modern::Perl; use Crypt::CBC; my $cipher1 = Crypt::CBC->new( -key => 'my secret key', -cipher => 'Crypt::DES', -header => 'randomiv', ); my $plaintext = 'In nova fert animus mutatas dicere formas corpora; di, coeptis (nam v +os mutastis et illas) adspirate meis primaque ab origine mundi ad mea + perpetuum deducite tempora carmen!'; my $ciphertext = $cipher1->encrypt_hex($plaintext); say $ciphertext; my $cipher2 = Crypt::CBC->new( -key => 'my secret key', -cipher => 'Crypt::DES', #-header => 'randomiv', ); $plaintext = $cipher2->decrypt_hex($ciphertext); say $plaintext;
The error shows up in
$plaintext = $cipher2->decrypt_hex($ciphertext);

The error goes away when commenting out -header => 'randomiv', in $cipher1 or uncommenting -header => 'randomiv', in $cipher2.

So it appears your ciphertext has been generated in a different way than the decription routine expects.

The docs for this module say:

The "salt" header is now the default as of Crypt::CBC version 2.17. In all earlier versions "randomiv" was the default.

It may very well be that your upgrading of the OS also caused an upgrade in the Crypt::CBC module which now uses a different default ('salt' instead of 'randomiv'). I used the latest version which is 2.33.

What version did you use before the upgrade and what version are you using now?

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

My blog: Imperial Deltronics

In reply to Re: Salt issue by CountZero
in thread Salt issue by Anonymous Monk

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.