AnyEvent-GnuPG

 view release on metacpan or  search on metacpan

lib/AnyEvent/GnuPG.pm  view on Meta::CPAN


=item * fingerprint

The fingerprint of the signature.

=item * trust

The trust value of the public key of the signer. Those are values that can be imported in your namespace with the :trust tag. They are (TRUST_UNDEFINED, TRUST_NEVER, TRUST_MARGINAL, TRUST_FULLY, TRUST_ULTIMATE).

=back

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.

=item * output

This optional parameter determines where the plaintext will be stored. It can be either a file name or anything else that L<AnyEvent::Proc/pipe> accepts.

=item * symmetric

This should be set to true, if the message is encrypted using symmetric cryptography.

=item * passphrase

The passphrase that should be used to decrypt the message (in the case of a message encrypted using a symmetric cipher) or the secret that will unlock the private key that should be used to decrypt the message.

=back

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

Every method has a callback variant, suffixed with I<_cb>. These methods accept an optional parameter called I<cb>, which can be a CodeRef or an L<AnyEvent>::CondVar and returns a condvar.

    $gpg->method_cb(%params, cb => sub {
        my $result = shift->recv; # croaks on error
        ...
    });

    my $cv = $gpg->method_cb(%params);
    my $result = $cv->recv; # croaks on error
    ...

The non-callback variants are all wrapper methods, looking something like this:

    sub method {
        shift->method_cb(@_)->recv
    }

=head1 EXPORTS

Nothing by default. Available tags:

=over 4

=item * :algo

RSA_RSA DSA_ELGAMAL DSA RSA

=item * :trust

TRUST_UNDEFINED TRUST_NEVER TRUST_MARGINAL TRUST_FULLY TRUST_ULTIMATE

=back

=head1 BUGS AND LIMITATIONS

This module doesn't work (yet) with the v2 branch of GnuPG.

=head1 SEE ALSO

=over 4

=item * L<GnuPG>

=item * L<gpg(1)>

=back

=head1 BUGS

Please report any bugs or feature requests on the bugtracker website
https://github.com/zurborg/libanyevent-gnupg-perl/issues

When submitting a bug or request, please include a test-file or a



( run in 0.422 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )