Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

generate pgp5 code Crypt::OpenPGP

by pentanol (Initiate)
on Jan 28, 2013 at 10:35 UTC ( #1015675=perlquestion: print w/replies, xml ) Need Help??
pentanol has asked for the wisdom of the Perl Monks concerning the following question:

Hello,I want avoid use file, just use new certificate with input data. it says...
Signature Failed: No secret keyrings
use strict; use warnings; use Crypt::OpenPGP; use Crypt::OpenPGP::Certificate; use Crypt::OpenPGP::Key::Secret; my $pgp = Crypt::OpenPGP->new; my $message_body; $message_body .= $_ while <STDIN>; my $result = $pgp->handle( Data => $message_body ); my $file = 'really-from-me.txt'; my $key_id = '1234567890'; my $pass = 'foo bar'; my $sec = Crypt::OpenPGP::Key::Secret->new("DSA"); my $certpass = "asd123"; my $seccert = Crypt::OpenPGP::Certificate->new( Key => $sec, Passphrase => $certpass, Version => 4, ) || die "Certificate Failed: ",$pgp->errstr; my $signature = $pgp->sign( Data => $seccert, KeyID => $key_id, Passphrase => $pass, Detach => 1, Armour => 1, ) || die "Signature Failed: ",$pgp->errstr; my $ciphertext = $pgp->encrypt( Filename => $file, Recipients => $key_id, Armour => 1, ) || die "Encryption Failed: ",$pgp->errstr; my $a = $ciphertext; print $a;

Replies are listed 'Best First'.
Re: generate pgp5 code Crypt::OpenPGP
by vinoth.ree (Monsignor) on Jan 29, 2013 at 07:50 UTC

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1015675]
Approved by vinoth.ree
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2018-04-25 06:07 GMT
Find Nodes?
    Voting Booth?