For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > May 2007 > Crypt::GCrypt error on new method









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Crypt::GCrypt error on new method
John Fisher

2007-05-23, 6:59 pm

I am attempting to use gcrypt using a Perl interface

I have "perl -MCPAN -e 'install Crypt::GCrypt'" and installed it successfully.

I attempted to run the code in Perldoc, but get this error
Can't locate object method "new" via package "GCrypt::Cipher" (perhaps you forgot to load "GCrypt::Cipher"?) at gcrypt_testing.pl line 5.

Any ideas?

=====
use Crypt::GCrypt;

$cipher = GCrypt::Cipher->new(
type => 'cipher',
algorithm => 'aes',
mode => 'cbc'
);
$cipher->start('encrypting');

$cipher->setkey('my secret key');

$cipher->setiv('my init vector');

$ciphertext = $cipher->encrypt('plaintext');
$ciphertext .= $cipher->finish;

$plaintext = $cipher->decrypt($ciphertext);
======Thanks,John


Mike Blezien

2007-05-23, 6:59 pm


----- Original Message -----
From: "JOHN FISHER" <John.J.Fisher@slma.com>
To: <beginners@perl.org>
Sent: Wednesday, May 23, 2007 10:32 AM
Subject: Crypt::GCrypt error on new method


I am attempting to use gcrypt using a Perl interface

I have "perl -MCPAN -e 'install Crypt::GCrypt'" and installed it successfully.

I attempted to run the code in Perldoc, but get this error
Can't locate object method "new" via package "GCrypt::Cipher" (perhaps you
forgot to load "GCrypt::Cipher"?) at gcrypt_testing.pl line 5.

Any ideas?

=====
use Crypt::GCrypt;

$cipher = GCrypt::Cipher->new(
type => 'cipher',
algorithm => 'aes',
mode => 'cbc'
);
$cipher->start('encrypting');

$cipher->setkey('my secret key');

$cipher->setiv('my init vector');

$ciphertext = $cipher->encrypt('plaintext');
$ciphertext .= $cipher->finish;

$plaintext = $cipher->decrypt($ciphertext);
======Thanks,John
========================================
=

Shouldn't that be

$cipher = Crypt::GCrypt->new( ..... );

Mike

Paul Lalli

2007-05-23, 6:59 pm

On May 23, 11:32 am, John.J.Fis...@slma.com (John Fisher) wrote:

> Can't locate object method "new" via package "GCrypt::Cipher" (perhaps you forgot to load "GCrypt::Cipher"?) at gcrypt_testing.pl line 5.
>
> use Crypt::GCrypt;
> $cipher = GCrypt::Cipher->new(


Look at the module names in those two lines. What do you see that's
different?

Paul Lalli

Paul Lalli

2007-05-23, 6:59 pm

On May 23, 11:32 am, John.J.Fis...@slma.com (John Fisher) wrote:

> Can't locate object method "new" via package "GCrypt::Cipher" (perhaps you forgot to load "GCrypt::Cipher"?) at gcrypt_testing.pl line 5.
>
> use Crypt::GCrypt;
> $cipher = GCrypt::Cipher->new(


Look at the module names in those two lines. What do you see that's
different?

Paul Lalli

Paul Lalli

2007-05-23, 6:59 pm

On May 23, 11:32 am, John.J.Fis...@slma.com (John Fisher) wrote:

> Can't locate object method "new" via package "GCrypt::Cipher" (perhaps you forgot to load "GCrypt::Cipher"?) at gcrypt_testing.pl line 5.
>
> use Crypt::GCrypt;
> $cipher = GCrypt::Cipher->new(


Look at the module names in those two lines. What do you see that's
different?

Paul Lalli

P.S. Google is sucking worse than usual today - forgive me if this
message appears three or four times. . .

Paul Lalli

2007-05-23, 6:59 pm

On May 23, 11:32 am, John.J.Fis...@slma.com (John Fisher) wrote:

> Can't locate object method "new" via package "GCrypt::Cipher" (perhaps you forgot to load "GCrypt::Cipher"?) at gcrypt_testing.pl line 5.
>
> use Crypt::GCrypt;
> $cipher = GCrypt::Cipher->new(


Look at the module names in those two lines. What do you see that's
different?

Paul Lalli

P.S. Google is sucking worse than usual today - forgive me if this
message appears three or four times. . .

Yyette

2007-05-24, 8:31 am

BDSM heaven!
http://free-bdsm-movies.info/movies/218571.avi
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com