boat73 has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to use Crypt::OpenPGP to encrypt data before sending it to a cgi script. This is the code I was tring and it is kicking out the following error.

"ERROR: Need something to encrypt with"

I have read the docs but am having trouble following it and getting any working code. Does anyone have some easy to follow working code I could view?

My public key ID is 0xD233C5EB?
My user id is Garett Holmes: gaholmes\@yahoo.com?

Any help is greatly appreciated.

use Crypt::OpenPGP; $key_id = "Garett Holmes: gaholmes\@yahoo.com"; $data = "Encrypt this"; $pgp = Crypt::OpenPGP->new(); $ciphertext = $pgp->encrypt( Data => $data, Recipient => $key_id, Armour => 1, ) or die "ERROR: " . $pgp->errstr;

Edited by Chady -- added code tags.

Replies are listed 'Best First'.
Re: Crypt::OpenPGP help!!
by arden (Curate) on Mar 10, 2004 at 16:06 UTC
    boat73, it sounds like the process user doesn't have read access to your public key. Therefore, it's dying with "need something to encrypt with." Try a test script where you just list the keys you have access to. . .

    - - arden.
    ps please use <CODE> tags next time. . .

      Sorry about the code tags. I do not see anything in Crypt::OpenPGP that would list keys. Is that in another pgp module that I havn't seen yet?
        Try  Crypt::OpenPGP::Key->check or  Crypt::OpenPGP::Key->public_key. There is a caveat with "check" so be sure to RTFM on Crypt::OpenPGP::Key before using it though.

        Good luck!

        - - arden.