Click here to get back home

Crypt::CBC Can't call method "blocksize" on unblessed reference

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Crypt::CBC Can't call method "blocksize" on unblessed reference Yves 07-12-2004
Posted by Yves on July 12, 2004, 10:01 am
Please log in for more thread options
I have a problem with the Crypt:CBC Module.

When I'm running my little sample script I allway get the following
error:

Can't call method "blocksize" on unblessed reference at
/usr/lib/perl5/site_perl/5.6.1/i586-linux/Crypt/CBC.pm line 35.

my script:

#!/usr/bin/perl -w
use strict;

use Crypt::CBC;

my ($cipher, $ciphertext, $plaintext);

$cipher = Crypt::CBC->new( {'key' => 'my secret key',
'cipher' => 'Blowfish',
'iv' => '$KJh#(}q',
'regenerate_key' => 0, # default true
'padding' => 'space',
'prepend_iv' => 0
});

$ciphertext = $cipher->encrypt("This data is hush hush");
print $ciphertext;
print "nn";

$plaintext = $cipher->decrypt($ciphertext);
print $plaintext;
print "nn";


I'm running perl v5.6.1 on a SUSE 8.0 Linux Box.

If someone could offer any suggestion, I would be appreciative.

Thank you

Yves Egli


Posted by gnu valued customer on July 12, 2004, 8:18 pm
Please log in for more thread options
Hello
> I have a problem with the Crypt:CBC Module.
>
> When I'm running my little sample script I allway get the following
> error:
>
> Can't call method "blocksize" on unblessed reference at
> /usr/lib/perl5/site_perl/5.6.1/i586-linux/Crypt/CBC.pm line 35.
>
> my script:
>
> #!/usr/bin/perl -w
> use strict;
>
> use Crypt::CBC;
>
> my ($cipher, $ciphertext, $plaintext);
>
> $cipher = Crypt::CBC->new( {'key' => 'my secret key',
> 'cipher' => 'Blowfish',
> 'iv' => '$KJh#(}q',
> 'regenerate_key' => 0, # default true
> 'padding' => 'space',
> 'prepend_iv' => 0
> });
>
> $ciphertext = $cipher->encrypt("This data is hush hush");
> print $ciphertext;
> print "nn";
>
> $plaintext = $cipher->decrypt($ciphertext);
> print $plaintext;
> print "nn";
>
>
> I'm running perl v5.6.1 on a SUSE 8.0 Linux Box.
>
> If someone could offer any suggestion, I would be appreciative.
>
> Thank you
>
> Yves Egli

I see your version of Perl, but your versions of
Crypt-CBC and Crypt-Blowfish might need updating.

Your code works for me on:
Win2k sp3
Perl 5.8.1 Build 807 (x86-multithread)

Crypt-CBC 2.09
Crypt-Blowfish 2.08

My notes on Crypt-CBC:
CBC is rather limited in its method of
deriving keys from passwords. Blowfish
can use a key length of up to
56 bytes (448 bits). CBC only uses the
MD5 hash for key derivation.

To produce a key longer than 128 bits
with CBC requires some kind of PRF. I made
a module which has 3 different PRFs for
making extended keys from a password.



Posted by gnu valued customer on July 12, 2004, 9:26 pm
Please log in for more thread options
see below
Hello
> I have a problem with the Crypt:CBC Module.
>
> When I'm running my little sample script I allway get the following
> error:
>
> Can't call method "blocksize" on unblessed reference at
> /usr/lib/perl5/site_perl/5.6.1/i586-linux/Crypt/CBC.pm line 35.
>
> my script:
>
> #!/usr/bin/perl -w
> use strict;
>
> use Crypt::CBC;
>
> my ($cipher, $ciphertext, $plaintext);
>
> $cipher = Crypt::CBC->new( {'key' => 'my secret key',
> 'cipher' => 'Blowfish',
> 'iv' => '$KJh#(}q',
> 'regenerate_key' => 0, # default true
> 'padding' => 'space',
> 'prepend_iv' => 0
> });
>
> $ciphertext = $cipher->encrypt("This data is hush hush");
> print $ciphertext;
> print "nn";
>
> $plaintext = $cipher->decrypt($ciphertext);
> print $plaintext;
> print "nn";
>
>
> I'm running perl v5.6.1 on a SUSE 8.0 Linux Box.
>
> If someone could offer any suggestion, I would be appreciative.
>
> Thank you
>
> Yves Egli

I see your version of Perl, but your versions of
Crypt-CBC and Crypt-Blowfish might need updating.

Your code works for me on:
Win2k sp3
Perl 5.8.1 Build 807 (x86-multithread)

Crypt-CBC 2.09
Crypt-Blowfish 2.08

My notes on Crypt-CBC:
CBC is rather limited in its method of
deriving keys from passwords. Blowfish
can use a key length of up to
56 bytes (448 bits). CBC only uses the
MD5 hash for key derivation.

To produce a key longer than 128 bits
with CBC requires some kind of PRF. I made
a module which has 3 different PRFs for
making extended keys from a password.

http://4.11.211.97/Crypt-CBC-KDF.zip

The zip above has 2 Perl scripts that
both do DES_EDE3 with a 192 bit key.
The first script uses Crypt-CBC and the
2nd uses Inline-C, calling the Win32 CryptoAPI.

What's interesting about interoperating these
2 is that the CryptoAPI has a custom PRF for
key derivation that I have ported to
Crypt-CBC-KDF.

regards,
tlviewer


Posted by Yves on July 13, 2004, 2:05 am
Please log in for more thread options
> see below
> Hello
> > I have a problem with the Crypt:CBC Module.
> >
> > When I'm running my little sample script I allway get the following
> > error:
> >
> > Can't call method "blocksize" on unblessed reference at
> > /usr/lib/perl5/site perl/5.6.1/i586-linux/Crypt/CBC.pm line 35.
> >
> > my script:
> >
> > #!/usr/bin/perl -w
> > use strict;
> >
> > use Crypt::CBC;
> >
> > my ($cipher, $ciphertext, $plaintext);
> >
> > $cipher = Crypt::CBC->new( {'key' => 'my secret
> key',
> > 'cipher' => 'Blowfish',
> > 'iv' => '$KJh#(}q',
> > 'regenerate key' => 0, # default
> true
> > 'padding' => 'space',
> > 'prepend iv' => 0
> > });
> >
> > $ciphertext = $cipher->encrypt("This data is hush hush");
> > print $ciphertext;
> > print "nn";
> >
> > $plaintext = $cipher->decrypt($ciphertext);
> > print $plaintext;
> > print "nn";
> >
> >
> > I'm running perl v5.6.1 on a SUSE 8.0 Linux Box.
> >
> > If someone could offer any suggestion, I would be appreciative.
> >
> > Thank you
> >
> > Yves Egli
>
> I see your version of Perl, but your versions of
> Crypt-CBC and Crypt-Blowfish might need updating.
>
> Your code works for me on:
> Win2k sp3
> Perl 5.8.1 Build 807 (x86-multithread)
>
> Crypt-CBC 2.09
> Crypt-Blowfish 2.08
>
> My notes on Crypt-CBC:
> CBC is rather limited in its method of
> deriving keys from passwords. Blowfish
> can use a key length of up to
> 56 bytes (448 bits). CBC only uses the
> MD5 hash for key derivation.
>
> To produce a key longer than 128 bits
> with CBC requires some kind of PRF. I made
> a module which has 3 different PRFs for
> making extended keys from a password.
>
> http://4.11.211.97/Crypt-CBC-KDF.zip
>
> The zip above has 2 Perl scripts that
> both do DES EDE3 with a 192 bit key.
> The first script uses Crypt-CBC and the
> 2nd uses Inline-C, calling the Win32 CryptoAPI.
>
> What's interesting about interoperating these
> 2 is that the CryptoAPI has a custom PRF for
> key derivation that I have ported to
> Crypt-CBC-KDF.
>
> regards,
> tlviewer

I had following versions installed:

Crypt-CBC 2.08
Crypt-Blowfish 2.09

now I have upgraded the Crypt-CBC to Version 2.09 but still the same error.

Then I've tried it on a other machine with the newest versions

Crypt-CBC 2.12
Crypt-Blowfish 2.09

and again same error.


Similar ThreadsPosted
Win32::Ole and Call by reference October 22, 2004, 10:06 am
Can't call method on an undefined value at June 27, 2005, 2:56 pm
Crypt::DH Crypt::Random install problem May 9, 2005, 5:25 am
MockObject - reference September 25, 2007, 9:03 am
Quick Perl, HTML, CSS, JavaScript reference April 26, 2006, 10:34 am
Crypt::Tea becomes Crypt::Tea_JS January 17, 2005, 1:14 pm
How to call PL/SQL procs using Oraperl ? December 8, 2004, 5:22 pm
How can I call MFC functions from Perl July 19, 2005, 9:46 pm
Parsing XML data as it arrives from LWP call January 11, 2005, 1:57 am
System call fails in webserver February 11, 2006, 11:04 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap