use Crypt::OpenPGP; my $pgp = Crypt::OpenPGP->new( SecRing => "private.keyring", PubRing => "public.key" ); my $data = "Please sign me... PLZ"; my $signature = $pgp->sign( Data => $data, KeyID => "775B1EE7CB2F10CD", Passphrase => "XXXXXXXX", Detach => 1, Clearsign => 1 ) or die "Could not sign. Got error: $pgp->errstr"; print $signature;