NAME

Mail::GPG::Result - Mail::GPG decryption and verification results

SYNOPSIS

$result = $mg->verify (
  entity => $entity
);

($decrypted_entity, $result) = $mg->decrypt (
  entity => $entity,
);

$long_string  = $result->as_string ( ... );
$short_string = $result->as_short_string;

$encrypted           = $result->get_is_encrypted;
$decryption_ok       = $result->get_enc_ok;
$encryption_key_id   = $result->get_enc_key_id;
$encryption_mail     = $result->get_enc_mail;
$enc_key_ids         = $result->get_enc_key_ids;
$enc_mails           = $result->get_enc_mails;

$signed              = $result->get_is_signed;
$signature_ok        = $result->get_sign_ok;
$signed_key          = $result->get_sign_key_id;
$signed_fingerprint  = $result->get_sign_fingerprint;
$trust               = $result->get_sign_trust;
$signed_mail         = $result->get_sign_mail;
$signed_mail_aliases = $result->get_sign_mail_aliases;

$stdout_sref         = $result->get_gpg_stdout;
$stderr_sref         = $result->get_gpg_stderr;
$status_sref         = $result->get_gpg_status;
$gpg_exit_code       = $result->get_gpg_rc;

DESCRIPTION

This class encapsulates decryption and verification results of Mail::GPG. You never create objects of this class yourself, they're all returned by Mail::GPG.

ATTRIBUTES

This class mainly has a bunch of attributes which reflect the result of a Mail::GPG operation. You can read these attributes with get_attribute.

is_encrypted

Indicates whether an entity was encrypted or not.

enc_ok

Indicates whether decryption of an entity was successful or not.

enc_key_id

The recipient's key id of an encrypted mail. This is the first key reported by gnupg in case the mail has more than one recipient.

enc_mail

The recipient's mail address of an encrypted mail. This is the first mail address reported by gnupg in case the mail has more than one recipient.

enc_key_ids

This is an array reference of key ids in case the mail is encrypted for several recipients.

enc_mails

This is an array reference of the correspondent recipient mail adresses. Entries may be empty, if gnugpg didn't report the mail address for a specific key.

is_signed

Indicates whether an entity was signed or not.

sign_ok

Indicates whether the signature could be verified successfully or not.

sign_state

Gives more details about the signature status. May have one of the following valufes: GOOD, EXP, EXPKEY, REVKEY and BAD. Please refer to gnupg's DETAILS file for details about the meaning of these values.

sign_key_id

The key ID of the sender who signed an entity.

sign_fingerprint

Key fingerprint of the sender who signed an entity.

sign_trust

Returns how much you trust the signers key. Refer to Mail::GPG->get_key_trust for a list of known levels and their meaning.

sign_mail

The primary mail address of the sender who signed an entity.

sign_mail_aliases

A reference to a list of the signer's mail alias addresses.

gpg_stdout

This is reference to a scalar containing gpg's STDOUT output.

gpg_stderr

This is reference to a scalar containing gpg's STDERR output.

gpg_rc

Exit code of the gpg program. Don't rely on this, use the other attributes to check wether operation was successful resp. a verification went ok.

METHODS

There are only two methods, both are for debugging purposes:

as_string

$string = $result->as_string ( no_stdout => $no_stdout )

Returns a printable string version of the object.

no_stdout

If this option is set, gpg's stdout is ommitted in the string represenation.

as_short_string

$short_string = $result->as_short_string;

Returns a very short string representation, without any gpg output, arranged in one line.

AUTHOR

Joern Reder <joern AT zyn.de>

COPYRIGHT

Copyright (C) 2004-2006 by Joern Reder, All Rights Reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

Mail::GPG, perl(1).