develooper Front page | perl.beginners | Postings from May 2007

Crypt::GCrypt error on new method

Thread Next
From:
JOHN FISHER
Date:
May 23, 2007 08:37
Subject:
Crypt::GCrypt error on new method
Message ID:
465426380200001600456AA4@fshm2.usagroup.com
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 


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About