AnyEvent-GnuPG
view release on metacpan or search on metacpan
lib/AnyEvent/GnuPG.pm view on Meta::CPAN
=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.
lib/AnyEvent/GnuPG.pm view on Meta::CPAN
Example:
$gpg->gen_key(
algo => DSA_ELGAMAL,
size => 1024,
name => "My name"
);
=head2 gen_key_cb(%params[, cb => $callback|$condvar])
Asynchronous variant of L</gen_key>.
=head2 import_keys(%params)
Import keys into the GnuPG private or public keyring. The method croaks if it encounters an error. Parameters:
=over 4
=item * keys
Only parameter and mandatory. It can either be an ArrayRef containing a list of files that will be imported or a single file name or anything else that L<AnyEvent::Proc/pull> accepts.
lib/AnyEvent/GnuPG.pm view on Meta::CPAN
=back
Example:
$gpg->import_keys(
keys => [qw[ key.pub key.sec ]]
);
=head2 import_keys_cb(%args[, cb => $callback|$condvar])
Asynchronous variant of L</import_keys>. It returns the number of keys imported.
=head2 import_key($string)
Import one single key into the GnuPG private or public keyring. The method croaks if it encounters an error.
Example:
$gpg->import_keys($string);
=head2 import_key_cb($string[, $callback|$condvar])
Asynchronous variant of L</import_key>.
=head2 export_keys(%params)
Exports keys from the GnuPG keyrings. The method croaks if it encounters an error. Parameters:
=over 4
=item * keys
Optional argument that restricts the keys that will be exported. Can either be a user id or a reference to an array of userid that specifies the keys to be exported. If left unspecified, all keys will be exported.
lib/AnyEvent/GnuPG.pm view on Meta::CPAN
Example:
$gpg->export_keys(
armor => 1,
output => "keyring.pub"
);
=head2 export_keys_cb(%params[, cb => $callback|$condvar])
Asynchronous variant of L</export_keys>.
=head2 encrypt(%params)
This method is used to encrypt a message, either using assymetric or symmetric cryptography. The methods croaks if an error is encountered. Parameters:
=over
=item * plaintext
This argument specifies what to encrypt. It can be either a file name or anything else that L<AnyEvent::Proc/pull> accepts.
lib/AnyEvent/GnuPG.pm view on Meta::CPAN
$gpg->encrypt(
plaintext => file.txt,
output => "file.gpg",
sign => 1,
passphrase => $secret
);
=head2 encrypt_cb(%params[, cb => $callback|$condvar])
Asynchronous variant of L</encrypt>.
=head2 sign(%params)
This method is used create a signature for a file or stream of data.
This method croaks on errors. Parameters:
=over 4
=item * plaintext
lib/AnyEvent/GnuPG.pm view on Meta::CPAN
Example:
$gpg->sign(
plaintext => "file.txt",
output => "file.txt.asc",
armor => 1
);
=head2 sign_cb(%params[, cb => $callback|$condvar])
Asynchronous variant of L</sign>.
=head2 clearsign(%params)
This methods clearsign a message. The output will contains the original message with a signature appended. It takes the same parameters as the L</sign> method.
=head2 clearsign_cb(%params[, cb => $callback|$condvar])
Asynchronous variant of L</clearsign>.
=head2 verify(%params)
This method verifies a signature against the signed message. The methods croaks if the signature is invalid or an error is encountered. If the signature is valid, it returns an hash with the signature parameters. Here are the method's parameters:
=over 4
=item * signature
If the message and the signature are in the same file (i.e. a clearsigned message), this parameter can be either a file name or anything else that L<AnyEvent::Proc/pull> accepts.
lib/AnyEvent/GnuPG.pm view on Meta::CPAN
Example:
my $sig = $gpg->verify(
signature => "file.txt.asc",
file => "file.txt"
);
=head2 verify_cb(%params[, cb => $callback|$condvar])
Asynchronous variant of L</verify>.
=head2 decrypt(%params)
This method decrypts an encrypted message. It croaks, if there is an error while decrypting the message. If the message was signed, this method also verifies the signature. If decryption is sucessful, the method either returns the valid signature par...
=over 4
=item * ciphertext
This optional parameter contains either the name of the file containing the ciphertext or a reference to a file handle containing the ciphertext.
lib/AnyEvent/GnuPG.pm view on Meta::CPAN
Example:
$gpg->decrypt(
ciphertext => "file.gpg",
output => "file.txt",
passphrase => $secret
);
=head2 decrypt_cb(%params[, cb => $callback|$condvar])
Asynchronous variant of L</decrypt>.
=head1 API OVERVIEW
The API is accessed through methods on a AnyEvent::GnuPG object which is a wrapper around the B<gpg> program. All methods takes their argument using named parameters, and errors are returned by throwing an exception (using croak). If you wan't to cat...
This modules uses L<AnyEvent::Proc>. For input data, all of L<AnyEvent::Proc/pull> and for output data, all of L<AnyEvent::Proc/pipe> possible handle types are allowed.
The code is based on L<GnuPG> with API compatibility except that L<GnuPG::Tie> is B<not> ported.
=head2 CALLBACKS AND CONDITION VARIABLES
( run in 0.528 second using v1.01-cache-2.11-cpan-0d8aa00de5b )