AnyEvent-GnuPG
view release on metacpan or search on metacpan
lib/AnyEvent/GnuPG.pm view on Meta::CPAN
$sig->{trust} = TRUST_ULTIMATE;
},
);
$cv;
}
1;
__END__
=pod
=head1 NAME
AnyEvent::GnuPG - AnyEvent-based interface to the GNU Privacy Guard
=head1 VERSION
version 1.001
=head1 SYNOPSIS
use AnyEvent::GnuPG qw( :algo );
my $gpg = AnyEvent::GnuPG->new();
$gpg->encrypt(
plaintext => "file.txt",
output => "file.gpg",
armor => 1,
sign => 1,
passphrase => $secret
);
$gpg->decrypt(
ciphertext => "file.gpg",
output => "file.txt"
);
$gpg->clearsign(
plaintext => "file.txt",
output => "file.txt.asc",
passphrase => $secret,
armor => 1,
);
$gpg->verify(
signature => "file.txt.asc",
file => "file.txt"
);
$gpg->gen_key(
name => "Joe Blow",
comment => "My GnuPG key",
passphrase => $secret,
);
=head1 DESCRIPTION
AnyEvent::GnuPG is a perl interface to the GNU Privacy Guard. It uses the shared memory coprocess interface that gpg provides for its wrappers. It tries its best to map the interactive interface of the gpg to a more programmatic model.
=head1 METHODS
=head2 new(%params)
You create a new AnyEvent::GnuPG wrapper object by invoking its new method. (How original!). The module will try to finds the B<gpg> program in your path and will croak if it can't find it. Here are the parameters that it accepts:
=over 4
=item * gnupg_path
Path to the B<gpg> program.
=item * options
Path to the options file for B<gpg>. If not specified, it will use the default one (usually F<~/.gnupg/options>).
=item * homedir
Path to the B<gpg> home directory. This is the directory that contains the default F<options> file, the public and private key rings as well as the trust database.
=back
Example:
my $gpg = AnyEvent::GnuPG->new();
=head2 version
This method returns the current gpg version as list.
my @version = $gpg->version;
# returns ( 1, 4, 18 ) for example
=head2 version_cb
Asynchronous variant of L</version>.
=head2 gen_key(%params)
This methods is used to create a new gpg key pair. The methods croaks if there is an error. It is a good idea to press random keys on the keyboard while running this methods because it consumes a lot of entropy from the computer. Here are the paramet...
=over 4
=item * algo
This is the algorithm use to create the key. Can be I<DSA_ELGAMAL>, I<DSA>, I<RSA_RSA> or I<RSA>. It defaults to I<DSA_ELGAMAL>. To import those constant in your name space, use the I<:algo> tag.
=item * size
The size of the public key. Defaults to 1024. Cannot be less than 768 bits, and keys longer than 2048 are also discouraged. (You *DO* know that your monitor may be leaking sensitive information ;-).
=item * valid
How long the key is valid. Defaults to 0 or never expire.
=item * name
This is the only mandatory argument. This is the name that will used to construct the user id.
( run in 0.953 second using v1.01-cache-2.11-cpan-5a3173703d6 )