I have written a Perl script which I have used for years to decrypt at the 
field level in a file. Occasionally I get a problem file.
It throws out this message like this and stops -
    "panic: sv_setpvn called with negative strlen  at   
encrypt_ssn_2_live_STDIN_or_INFILE.pl line 108, <STDIN> line 1249."

It hits a specific record. So, I look at that record and there is nothing 
special about it. I cut the file down so that record is no longer at the same 
record count. Say I now make it record 10 of a 20 record file. It decrypts it 
fine and may fail elsewhere. It is so bizarre.

Here is the key lines of code.

#!/usr/bin/perl -w
use Crypt::GCrypt;
use MIME::Base64;

$skey = <<< a salt key >>>;
$skey64 = MIME::Base64::decode($skey);

$cipher = Crypt::GCrypt->new(
  type => 'cipher',
  algorithm => 'aes',
  mode => 'ecb'
);

$cipher->start('decrypting');

$cipher->setkey($skey64);

$decodecipher = MIME::Base64::decode($encrypted_ssn);
$orig_key = $cipher->decrypt($decodecipher);           <<= it fails on this 
line.


Googling has come up empty handed. Any thoughts, recommendations or experience 
would be appreciated.
I have tried to run the command line of OPENSSL which I think it what Perl is 
interacting with. I can figure out how to do a file, but not a field with 
OPENSSL.

TIA,
John

Reply via email to