PGP::Mail - Signature checking for PGP-signed mail messages


  use PGP::Mail;
  my $pgpmail=new PGP::Mail($mail, {default-keyring=>"kr.gpg"});


This module operates on PGP-signed mail messages. It checks the signature of either a standard clearsigned, a signed message or a PGP/MIME style message.

It returns an object which can be used to check what the signed data was, whether the signature verification succeeded, and what keyid did the signature.

my $pgpmail=new PGP::Mail($mesg, $args);

Creates a new PGP::Mail object using the RFC2822 message specified in $mesg. It will do the signature verification itself. $args is a hashref which gets passed to GnuPG::Interface's options. It is particularly worth looking at GnuPG::Options for this.


Returns the status of the signature verification (currently good, bad or unverified).


Returns the keyid of this signature, in the format "0x64-bit_key_id".


Returns the signed data, run through MIME::Parser if necessary.


The style of this module leaves quite a bit to be desired, and it only supports verifying signatures at the moment, rather than the full encryption, decryptions, and creating the messages.


Matthew Byng-Maddick <>


perl, GnuPG::Interface, GnuPG::Options, MIME::Tools.