Crypt::OpenPGP problem

Discussion in 'Perl Misc' started by Gilian, Jun 16, 2004.

  1. Gilian

    Gilian Guest

    Hello,

    I hope somebody can help me with this problem.

    I have a perl-script that creates file, that need to be encrypted.
    I use the Crypt::OpenPGP module to make the encryption done. The only
    thing I want to do is 'conventional encryption', which means I don't
    want to use keys, but I want to encrypt it with a password.

    The script looks like this:
    #!/usr/bin/perl

    use Crypt::OpenPGP;

    my $pgp = Crypt::OpenPGP->new();

    $file = 'file.txt';
    $phrase = 'test123456';

    $encrypted = $pgp->encrypt(
    Compat => 'PGP5', # <== in PGP2 it works fine!
    Filename => $file,
    Passphrase => $phrase,
    ) or die "can not encrypt ",$pgp->errstr;

    print "$encrypted\n";

    open (OUTFILE, "> $file.pgp");
    print OUTFILE "$encrypted";
    close (OUTFILE);


    When I do this with the encryption in PGP2 there is no proble, when I
    try to encrypt in PGP5 I get the following response:
    Can't call method "keysize" on an undefined value at
    /usr/lib/perl5/site_perl/5.8.3/Crypt/OpenPGP.pm line 525.

    Can somebody tell me what the problem is, or rather give me a solution
    to the problem.

    Thanks in advance.

    Regards,
    Gilian.
     
    Gilian, Jun 16, 2004
    #1
    1. Advertising

  2. Gilian

    Sisyphus Guest

    Gilian wrote:
    > Hello,
    >
    > I hope somebody can help me with this problem.
    >
    > I have a perl-script that creates file, that need to be encrypted.
    > I use the Crypt::OpenPGP module to make the encryption done. The only
    > thing I want to do is 'conventional encryption', which means I don't
    > want to use keys, but I want to encrypt it with a password.
    >
    > The script looks like this:
    > #!/usr/bin/perl
    >
    > use Crypt::OpenPGP;
    >
    > my $pgp = Crypt::OpenPGP->new();
    >
    > $file = 'file.txt';
    > $phrase = 'test123456';
    >
    > $encrypted = $pgp->encrypt(
    > Compat => 'PGP5', # <== in PGP2 it works fine!
    > Filename => $file,
    > Passphrase => $phrase,
    > ) or die "can not encrypt ",$pgp->errstr;
    >
    > print "$encrypted\n";
    >
    > open (OUTFILE, "> $file.pgp");
    > print OUTFILE "$encrypted";
    > close (OUTFILE);
    >
    >
    > When I do this with the encryption in PGP2 there is no proble, when I
    > try to encrypt in PGP5 I get the following response:
    > Can't call method "keysize" on an undefined value at
    > /usr/lib/perl5/site_perl/5.8.3/Crypt/OpenPGP.pm line 525.
    >
    > Can somebody tell me what the problem is, or rather give me a solution
    > to the problem.
    >


    The script you supplied works fine for me on Linux (Mandrake-9.1), perl
    5.8.3. I'm using version 1.03 of Crypt-OpenPGP, which is the latest
    available on CPAN. If you're using an older version then you probably
    need only to update.

    Otherwise, 'use warnings;' at the start of your script. That may provide
    some useful output.

    Also you should check that the 'open' and 'close' calls succeeded
    (though that has nothing to do with the problem you are experiencing).

    Cheers,
    Rob

    --
    To reply by email u have to take out the u in kalinaubears.
     
    Sisyphus, Jun 16, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. AdrianK
    Replies:
    0
    Views:
    1,576
    AdrianK
    Jul 9, 2003
  2. Replies:
    2
    Views:
    4,969
  3. Cosmia Luna
    Replies:
    4
    Views:
    349
    Cosmia Luna
    Mar 11, 2012
  4. Bing Du Test

    Crypt::OpenPGP memory use

    Bing Du Test, Jul 7, 2003, in forum: Perl Misc
    Replies:
    0
    Views:
    118
    Bing Du Test
    Jul 7, 2003
  5. asg

    de-crypt... crypt

    asg, Dec 23, 2005, in forum: Perl Misc
    Replies:
    3
    Views:
    150
Loading...

Share This Page