Crypt-OpenPGP

 view release on metacpan or  search on metacpan

MANIFEST  view on Meta::CPAN

t/11-encrypt.t
t/12-sign.t
t/13-keygen.t
t/14-sha2-verify.t
t/17-issue-19482.t
t/18-issue-20931.t
t/19-issue-79798.t
t/51-roundtrip.t
t/samples/cfg.gnupg
t/samples/cfg.pgp2
t/samples/gpg/ring.pub
t/samples/gpg/ring.sec
t/samples/gpg/sha2.pub
t/samples/gpg/sha2.sec
t/samples/gpg/subkeys-ring.pub
t/samples/gpg/subkeys-ring.sec
t/samples/message.asc
t/samples/sha2.asc
t/test-common.pl
xt/pod.t
xt/synopsis.t

README  view on Meta::CPAN

        when calling *encrypt* or *sign* (below), unless, of course, you
        want to set *Compat* to a different value for those methods.

        *Compat* influences several factors upon object creation, unless
        otherwise overridden in the constructor arguments: if you have a
        configuration file for this compatibility mode (eg. ~/.gnupg/options
        for GnuPG), it will be automatically read in, and *Crypt::OpenPGP*
        will set any options relevant to its execution (symmetric cipher
        algorithm, etc.); *PubRing* and *SecRing* (below) are set according
        to the default values for this compatibility mode (eg.
        ~/.gnupg/pubring.gpg for the GnuPG public keyring).

    *   SecRing

        Path to your secret keyring. If unspecified, *Crypt::OpenPGP* will
        look for your keyring in a number of default places.

        As an alternative to passing in a path to the keyring file, you can
        pass in a *Crypt::OpenPGP::KeyRing* object representing a secret
        keyring.

README  view on Meta::CPAN

            or die "Decryption failed: ", $pgp->errstr;

SAMPLES/TUTORIALS
    Take a look at bin/pgplet for an example of usage of *Crypt::OpenPGP*.
    It gives you an example of using the four main major methods (*encrypt*,
    *sign*, *decrypt*, and *verify*), as well as the various parameters to
    those methods. It also demonstrates usage of the callback parameters
    (eg. *PassphraseCallback*).

    bin/pgplet currently does not have any documentation, but its interface
    mirrors that of *gpg*.

LICENSE
    Crypt::OpenPGP is free software; you may redistribute it and/or modify
    it under the same terms as Perl itself.

AUTHOR & COPYRIGHT
    Except where otherwise noted, Crypt::OpenPGP is Copyright 2001 Benjamin
    Trott, cpan@stupidfool.org. All rights reserved.

REFERENCES

lib/Crypt/OpenPGP.pm  view on Meta::CPAN

              'sign'    => { Digest => 'SHA256', Version => 4 },
              'encrypt' => { Cipher => 'Rijndael', Compress => 'Zlib',
                             MDC => 1 },
              'keygen'  => { Type => 'RSA', Cipher => 'Rijndael',
                             Version => 4, Digest => 'SHA256' },
              'Config'  => [
                     $env->('GNUPGHOME', 'options'),
                     $home->( '.gnupg', 'options' ),
              ],
              'PubRing' => [
                     $env->('GNUPGHOME', 'pubring.gpg'),
                     $home->( '.gnupg', 'pubring.gpg' ),
              ],
              'SecRing' => [
                     $env->('GNUPGHOME', 'secring.gpg'),
                     $home->( '.gnupg', 'secring.gpg' ),
              ],
        },
    );
}

sub version_string {
    no warnings 'uninitialized';
    __PACKAGE__ . ' ' . __PACKAGE__->VERSION;
}

lib/Crypt/OpenPGP.pm  view on Meta::CPAN

I<Compat> here, you do not have to set it again when calling I<encrypt>
or I<sign> (below), unless, of course, you want to set I<Compat> to a
different value for those methods.

I<Compat> influences several factors upon object creation, unless otherwise
overridden in the constructor arguments: if you have a configuration file
for this compatibility mode (eg. F<~/.gnupg/options> for GnuPG), it will
be automatically read in, and I<Crypt::OpenPGP> will set any options
relevant to its execution (symmetric cipher algorithm, etc.); I<PubRing>
and I<SecRing> (below) are set according to the default values for this
compatibility mode (eg. F<~/.gnupg/pubring.gpg> for the GnuPG public
keyring).

=item * SecRing

Path to your secret keyring. If unspecified, I<Crypt::OpenPGP> will look
for your keyring in a number of default places.

As an alternative to passing in a path to the keyring file, you can pass in
a I<Crypt::OpenPGP::KeyRing> object representing a secret keyring.

lib/Crypt/OpenPGP.pm  view on Meta::CPAN


=head1 SAMPLES/TUTORIALS

Take a look at F<bin/pgplet> for an example of usage of I<Crypt::OpenPGP>.
It gives you an example of using the four main major methods (I<encrypt>,
I<sign>, I<decrypt>, and I<verify>), as well as the various parameters to
those methods. It also demonstrates usage of the callback parameters (eg.
I<PassphraseCallback>).

F<bin/pgplet> currently does not have any documentation, but its interface
mirrors that of I<gpg>.

=head1 LICENSE

Crypt::OpenPGP is free software; you may redistribute it and/or modify
it under the same terms as Perl itself.

=head1 AUTHOR & COPYRIGHT

Except where otherwise noted, Crypt::OpenPGP is Copyright 2001 Benjamin
Trott, cpan@stupidfool.org. All rights reserved.

t/10-keyring.t  view on Meta::CPAN

unshift @INC, 't/';
require 'test-common.pl';
use File::Spec;

my $key_id = '39F560A90D7F1559';
my $packed_key_id = pack 'H*', $key_id;
my $passphrase = "foobar";
my $uid = q(Foo Bar <foo@bar.com>);

my $ring = Crypt::OpenPGP::KeyRing->new(
    Filename => File::Spec->catfile($SAMPLES, 'gpg', 'ring.sec')
);
isa_ok $ring, 'Crypt::OpenPGP::KeyRing';

my( $kb, $cert );

# Read the entire ring and look at each block
lives_ok { $ring->read } 'ring->read succeeds';
my @blocks = $ring->blocks;
is @blocks, 1, '1 block';
$kb = $blocks[0];

t/11-encrypt.t  view on Meta::CPAN

Comme deux rahat-loukoums
A la rose qui rebondissent sur ma nuque boum boum
TEXT

my $key_id = '2988D2905AF8F320';
my $key_id2 = '576B010D0F7199D3';
my $key_id_sign = '39F560A90D7F1559';
my $pass = "foobar";
my $uid = 'foo@bar';

my $secring = File::Spec->catfile( $SAMPLES, 'gpg', 'ring.sec' );
my $pubring = File::Spec->catfile( $SAMPLES, 'gpg', 'ring.pub' );
my $pgp = Crypt::OpenPGP->new(
    SecRing => $secring,
    PubRing => $pubring,
);
isa_ok $pgp, 'Crypt::OpenPGP';

{
    # Test unarmoured encrypted data.
    my $ct = $pgp->encrypt(
        KeyID    => $key_id,

t/12-sign.t  view on Meta::CPAN

then i heard the voices on a broadcast from up on the bird
they were getting interviewed by some Goodman whose name was Bill
i'm almost there to Vegas where they're puttin' on a show
they've come so far i've lived this long at least i must just go and say hello
TEXT

my $key_id = '39F560A90D7F1559';
my $pass = "foobar";
my $uid = 'Foo Bar <foo@bar.com>';

my $secring = File::Spec->catfile( $SAMPLES, 'gpg', 'ring.sec' );
my $pubring = File::Spec->catfile( $SAMPLES, 'gpg', 'ring.pub' );
my $pgp = Crypt::OpenPGP->new(
    SecRing => $secring,
    PubRing => $pubring,
);
isa_ok $pgp, 'Crypt::OpenPGP';

{
    diag 'armoured sig';

    # Test standard armoured signature.

t/14-sha2-verify.t  view on Meta::CPAN

our $SAMPLES;
unshift @INC, 't/';
require 'test-common.pl';
use File::Spec;


my $key_id = '43AA1C85';
my $pass = "";
my $uid = 'Test Key (SHA-512 key for Crypt::OpenPGP tests) <test@sha512.sig>';

my $secring = File::Spec->catfile( $SAMPLES, 'gpg', 'sha2.sec' );
my $pubring = File::Spec->catfile( $SAMPLES, 'gpg', 'sha2.pub' );
my $pgp = Crypt::OpenPGP->new(
    SecRing => $secring,
    PubRing => $pubring,
);
isa_ok $pgp, 'Crypt::OpenPGP';

{
    diag 'sig generated by gpg with SHA512';

    # Test a signature created by gnupg with SHA512 key
    my $sig_file = File::Spec->catfile( $SAMPLES, 'sha2.asc' );
    my $signer = $pgp->verify( SigFile => $sig_file );
    is $signer, $uid, 'verified as signed by uid';
}

t/17-issue-19482.t  view on Meta::CPAN

iD8DBQFEdektlHMl2/XbR4ERAtRUAJ9T1auCXUWRLDGaITjUOQd1enFrkQCgnl+d
e13KUKxVXyOTxyEI66s7p7A=
=zUfR
-----END PGP SIGNATURE-----
SIGNED

my $key_id = '947325DBF5DB4781';
my $pass = "foobar";
my $uid = 'Austin F. Frank <aufrank@gmail.com>';

my $secring = File::Spec->catfile( $SAMPLES, 'gpg', 'ring.sec' );
my $pubring = File::Spec->catfile( $SAMPLES, 'gpg', 'ring.pub' );
my $pgp = Crypt::OpenPGP->new(
    SecRing => $secring,
    PubRing => $pubring,
);
isa_ok $pgp, 'Crypt::OpenPGP';

{
    diag 'clear-text sig';

    # Test clear-text signature.

t/18-issue-20931.t  view on Meta::CPAN

    skip ("Skipped author tests", 1) if (!$ENV{AUTHOR_TESTING}); 

    open(X, ">msg.txt");
    print X $message;
    close X;

    open(X, ">msg.txt.asc");
    print X $sig;
    close X;

    my $gpg_result = `gpg --no-tty --no-verbose --no-default-keyring --batch --quiet --homedir t/samples/gpg --keyring gnupg-ring:t/samples/gpg/ring.pub --verify msg.txt.asc msg.txt 2>&1`;
    like($gpg_result, qr/Good signature from "Foo Bar <foo\@bar.com>/, 'gpg can validate signature');

    unlink 'msg.txt';
    unlink 'msg.txt.asc';
}

my $secring = File::Spec->catfile( $SAMPLES, 'gpg', 'ring.sec' );
my $pubring = File::Spec->catfile( $SAMPLES, 'gpg', 'ring.pub' );

my $pgp = Crypt::OpenPGP->new(
                SecRing => $secring,
                PubRing => $pubring,
            );

my $valid = $pgp->verify( Data => $message,
			  Signature => $sig,
			);
ok($valid, "Crypt::OpenPGP can verify signature");

t/19-issue-79798.t  view on Meta::CPAN

2NJmAfRRbePmyDDBQakSF1L7X5zDymFBeqRaUi7L1npf6cXalM+2dsB4VK/CneWf
lzrS+9uT5xgVoDnNexjmQH/JG48TmGCiQjLseItQZwjTidC1C8vaIuu6MI8Y/yVb
CxNJrOmscjIC
=bl4j
-----END PGP MESSAGE-----
ENCRYPTED

my $original = << 'ORIGINAL';
Encrypt with ELG-E key, ID 567B9F42 SubKey
ORIGINAL
my $secring = File::Spec->catfile( $SAMPLES, 'gpg', 'subkeys-ring.sec' );
my $pubring = File::Spec->catfile( $SAMPLES, 'gpg', 'subkeys-ring.pub' );
my $passphrase = 'foobar';

my $pgp = Crypt::OpenPGP->new(
                SecRing => $secring,
                PubRing => $pubring,
            );
ok($pgp, "Crypt::OpenPGP created");

my $plaintext = $pgp->decrypt(
                                Data => $encrypted,

t/51-roundtrip.t  view on Meta::CPAN

use warnings;
use Test::More;

use_ok 'Crypt::OpenPGP';

unshift @INC, 't/';
require 'test-common.pl';
use File::Spec;

my $pgp = Crypt::OpenPGP->new(
    SecRing => File::Spec->catfile( $::SAMPLES, 'gpg', 'ring.sec' ),
    PubRing => File::Spec->catfile( $::SAMPLES, 'gpg', 'ring.pub' ),
);

sub encrypt { $pgp->encrypt( Data => $_[0], Passphrase => 'allo' ) }

sub decrypt { $pgp->decrypt( Data => $_[0], Passphrase => 'allo' ) }

sub handle { $pgp->handle(  Data => $_[0], PassphraseCallback => sub { 'allo' } ) }

sub sign { $pgp->sign( Data => $_[0], Passphrase => 'foobar', KeyID => '39F560A90D7F1559' ) }

t/samples/message.asc  view on Meta::CPAN

======================

In order to check that the version of GnuPG which you are going to
install is an original and unmodified one, you can do it in one of
the following ways:

 * If you already have a trusted version of GnuPG installed, you
   can simply check the supplied signature.  For example to check the
   signature of the file gnupg-1.2.0.tar.bz2 you would use this command:

     gpg --verify gnupg-1.2.0.tar.bz2.sig

   This checks whether the signature file matches the source file.
   You should see a message indicating that the signature is good and
   made by that signing key.  Make sure that you have the right key,
   either by checking the fingerprint of that key with other sources
   or by checking that the key has been signed by a trustworthy other
   key.

   Never use a GnuPG version you just downloaded to check the
   integrity of the source - use an existing GnuPG installation.

t/samples/message.asc  view on Meta::CPAN

     e93ceafc4395d1713d20044d523d18a7  gnupg-1.2.0.tar.gz
     c735a9a4400e3e3b0b78f88aadedfd3d  gnupg-1.0.7-1.2.0.diff.gz
     af439e3ba82c8648041e8e9d902c3c01  gnupg-w32cli-1.2.0.zip



Upgrade Information
===================

The name of the default configuration file has changed from "options"
to "gpg.conf".  The old name will still be used as long as no
"gpg.conf" exists.  We recommend to rename your file after the
installation.

If you are upgrading from a version prior to 1.0.7, you may want to
run the command "gpg --rebuild-keydb-caches" once to speed up the
keyring access. Please note also that due to a bug in versions prior
to 1.0.6 it won't be possible to downgrade to such versions unless you
use the GnuPG version which comes with Debian's Woody release or you
apply the patch http://www.gnupg.org/developer/gpg-woody-fix.txt .

If you have any problems, please see the FAQ and the mailing list
archive at http://lists.gnupg.org.  Please direct questions to the
gnupg-users@gnupg.org mailing list.



What's New
===========

Here is a list of major user visible changes since 1.0.7:

  Configuration:

    * The default configuration file is now ~/.gnupg/gpg.conf.  If an
      old ~/.gnupg/options is found it will still be used.  This
      change is required to have a more consistent naming scheme with
      forthcoming tools.

    * The configure option --with-static-rnd=auto allows to build gpg
      with all available entropy gathering modules included.  At
      runtime the best usable one will be selected from the list
      linux, egd, unix.  This is also the default for systems lacking
      a /dev/random device.

    * All modules are now linked statically; the --load-extension
      option is in general not useful anymore.  The only exception is
      to specify the deprecated IDEA cipher plugin.

    * There are now various ways to restrict the ability GnuPG has to



( run in 0.882 second using v1.01-cache-2.11-cpan-df04353d9ac )