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

Hi, I am using CRYPT::CBC for encryption. I am getting "Ciphertext does not begin with a valid header for 'salt' header mode" error. Below is the code. Please help me.

my $cipher = Crypt::CBC->new( -key => $cryptkey, -keylength => '256', -cipher => "Crypt::OpenSSL::AES" );

Thank you Sitaaram

Replies are listed 'Best First'.
Re: Regarding CRYPT::CBC header issue
by Corion (Patriarch) on May 11, 2016 at 07:53 UTC

    What is your ciphertext and where do you add it in your code?

    The error message is raised from the ->crypt method call. You don't show that call.

    Please go back and rewrite your code to a small, self-contained program that reproduces the problem. Please also show all needed input data to reproduce the problem.

    Most likely, the problem is that your ciphertext that you are trying to decode does not begin with a valid header. This is more a data problem than a problem in your program.

      Thank you very much Corion