Skip to content

Commit

Permalink
initial import of Crypt::OpenPGP 0.09 from CPAN
Browse files Browse the repository at this point in the history
git-cpan-module: Crypt::OpenPGP
git-cpan-version: 0.09
  • Loading branch information
Benjamin Trott authored and Benjamin Trott committed Dec 10, 2009
0 parents commit f48884e
Show file tree
Hide file tree
Showing 54 changed files with 4,297 additions and 0 deletions.
15 changes: 15 additions & 0 deletions CREDITS
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
$Id: CREDITS,v 1.5 2001/07/27 05:51:08 btrott Exp $

In developing Crypt::OpenPGP I have received help (either direct or
indirect) from the following individuals, who I would like to thank:

* Gary Howland's original pure-Perl PGP code (part of Cryptix) was
useful when I was planning the structure of the code, in
implementing the CRC24 algorithm, and for the basis of the (now
reworked) CFB code.

* Vipul Ved Prakash, from whose Convert::ASCII::Armour I borrowed
some regexen for unarmouring data, and who has helped out enormously
with testing against various PGP releases, sending patches, etc.

Benjamin Trott / ben@rhumba.pair.com
102 changes: 102 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
$Id: Changes,v 1.17 2001/07/27 07:53:11 btrott Exp $

Revision history for Crypt::OpenPGP

0.09 2001.07.27
- Fixed incompatibility with PGP2: PGP2 expects packets of certain
types to have certain header len sizes, no matter the actual len
of the data. eg. all Signature packets have to have 2 len bytes,
even if the data is < 255 bytes long and the len would fit in
1 len byte. So to be compatible we need to let the object set
the number of len bytes, if it wants to.
- Plaintext packets generated in encrypt and sign will now have
the proper 'filename' attribute set, if the Filename param was
passed to the respective method.
- Crypt::OpenPGP::verify now handles compressed signature packets
properly.
- Version 3 signatures now default to MD5 digests for compatibility
with PGP2.
- Added tests for Crypt::OpenPGP::PacketFactory (t/05-packets.t).

0.08 2001.07.26
- Fixed DEK encoding on encrypted session keys; the padding size
was incorrect, which meant that PGP5 could not recognize it
as a valid encoding.
- Added support for compressed data packets for encryption and
decryption. 'Compress' param controls compression when
encrypting, and compressed packets will be automatically
decompressed when decrypting.
- Detect and skip Marker packets in encrypted messages.
- Force generated RSA keys to be version 3 for compatibility with
PGP5, which automatically assumes that all RSA keys are version
3.
- Detect pubring.pkr and secring.skr files, thanks to Vipul for
the spot and patch (reworked).
- Fix Armour so that armoured lines are max 64 columns. Add test
for this case. Thanks to Vipul for spot and patch (reworked
slightly).
- Fix misc. warnings. Thanks to Vipul for spot and patch.
- Fix PacketFactory so that it doesn't enter deep recursion when
looking for specific packet types. Thanks to Vipul for the spot.
- Fix PARI error Util::mp2bin by casting 4*8 to PARI. Thanks to
Vipul for the spot and patch.

0.07 2001.07.26
- Added key generation, in low-end Key etc. modules and in
high-level Crypt::OpenPGP frontend, which returns two
keyblocks.
- Added Certificate->lock to encrypt secret key data.
- Applied Vipul's patch to fix warnings about GNUPGHOME
and to add pubring.pkr and secring.skr. Thanks to Vipul.

0.06 2001.07.25
- Fixed bug in SessionKey::_decode with using ciphers with
keys != 16 bytes. This caused incorrect checksums on the
key data.
- 3DES is now the default cipher (not Blowfish).
- Armoured keyrings (eg. PGP PUBLIC KEY BLOCK strings) are
now automatically unarmoured in Crypt::OpenPGP::KeyRing.
- Added docs for Crypt::OpenPGP, ie. the high-level DWIM
interface to the rest of the system.
- Improved speed of octet-string => integer and vice versa
operations. Crypt::OpenPGP::Util::bin2mp is now 3 times
faster than in the last release, and mp2bin is almost
twice as fast. Added lots more tests for these functions
(in 01-util.t).
- Changed Certificate->decrypt to Certificate->unlock.

0.05 2001.07.23
- Started test suite: currently it tests high-level OpenPGP
interface using keyrings from GnuPG.
- Rewrote CFB implementation (now faster).
- Improved installation process (ask questions, check for
required modules, etc.).

0.04 2001.07.22
- Added support RSA signing and verification.
- Added support for ElGamal encryption/decryption.
- Added second arg to Crypt::OpenPGP::PacketFactory::parse that
allows finding only specific packet types; unspecified packet
types are not even parsed (save the header).
- Added Crypt::OpenPGP::KeyRing::find_keyblock_by_keyid, which
looks up a keyblock by key ID, without requiring the entire
keyring to be parsed (just key certificates).
- Changed Crypt::OpenPGP methods to use find_keyblock_by_keyid
instead of reading in entire keyring.

0.03 2001.07.20
- Fixed bug in un-armouring where checksum would not be picked up
properly if base64-encoded data had '=' at the end.
- Improved first crack at CRC24 implementation by using lookup
tables. This helps a lot.

0.02 2001.07.20
- Added armouring in Crypt::OpenPGP::Armour.
- Added high-level DWIM interface to Crypt::OpenPGP.
- Now generate fingerprint on version 4 key certificates while
reading in key; since we already have the serialized data, we
can just generate the fingerprint using that data, rather than
having to serialize to get the key ID.

0.01 2001.07.19
- Initial version.
54 changes: 54 additions & 0 deletions MANIFEST
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
CREDITS
Changes
MANIFEST
Makefile.PL
README
ToDo
lib/Crypt/DES_EDE3.pm
lib/Crypt/OpenPGP.pm
lib/Crypt/OpenPGP/Armour.pm
lib/Crypt/OpenPGP/Buffer.pm
lib/Crypt/OpenPGP/CFB.pm
lib/Crypt/OpenPGP/Certificate.pm
lib/Crypt/OpenPGP/Cipher.pm
lib/Crypt/OpenPGP/Ciphertext.pm
lib/Crypt/OpenPGP/Compressed.pm
lib/Crypt/OpenPGP/Constants.pm
lib/Crypt/OpenPGP/Digest.pm
lib/Crypt/OpenPGP/ErrorHandler.pm
lib/Crypt/OpenPGP/Key.pm
lib/Crypt/OpenPGP/Key/Public.pm
lib/Crypt/OpenPGP/Key/Public/DSA.pm
lib/Crypt/OpenPGP/Key/Public/ElGamal.pm
lib/Crypt/OpenPGP/Key/Public/RSA.pm
lib/Crypt/OpenPGP/Key/Secret.pm
lib/Crypt/OpenPGP/Key/Secret/DSA.pm
lib/Crypt/OpenPGP/Key/Secret/ElGamal.pm
lib/Crypt/OpenPGP/Key/Secret/RSA.pm
lib/Crypt/OpenPGP/KeyBlock.pm
lib/Crypt/OpenPGP/KeyRing.pm
lib/Crypt/OpenPGP/Marker.pm
lib/Crypt/OpenPGP/Message.pm
lib/Crypt/OpenPGP/OnePassSig.pm
lib/Crypt/OpenPGP/PacketFactory.pm
lib/Crypt/OpenPGP/Plaintext.pm
lib/Crypt/OpenPGP/S2k.pm
lib/Crypt/OpenPGP/SessionKey.pm
lib/Crypt/OpenPGP/Signature.pm
lib/Crypt/OpenPGP/Signature/SubPacket.pm
lib/Crypt/OpenPGP/Trust.pm
lib/Crypt/OpenPGP/UserID.pm
lib/Crypt/OpenPGP/Util.pm
t/00-compile.t
t/01-util.t
t/02-buffer.t
t/03-3des.t
t/04-armour.t
t/05-packets.t
t/10-keyring.t
t/11-encrypt.t
t/12-sign.t
t/13-keygen.t
t/samples/gpg/ring.pub
t/samples/gpg/ring.sec
t/test-common.pl
135 changes: 135 additions & 0 deletions Makefile.PL
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
# $Id: Makefile.PL,v 1.2 2001/07/24 04:19:32 btrott Exp $

use ExtUtils::MakeMaker qw( prompt WriteMakefile );
use strict;

my %BASE_PREREQS = (
'Data::Buffer' => '0.03',
'MIME::Base64' => 0,
'Math::Pari' => 0,
);

my %prereq = %BASE_PREREQS;

my @cryptmod = (
[ '3DES' => 'Crypt::DES' ],
[ 'IDEA' => 'Crypt::IDEA' ],
[ 'Blowfish' => 'Crypt::Blowfish' ],
);

my @pkmod = (
[ 'DSA' => 'Crypt::DSA' ],
[ 'ElGamal' => '' ],
[ 'RSA' => 'Crypt::RSA' ],
);

print<<MSG;
This is Crypt::OpenPGP, a pure-Perl implementation of the OpenPGP
standard.
Each of the Crypt::OpenPGP symmetric ciphers depends on a Crypt::
module from the CPAN. You may already have the necessary module(s)
installed, in which you don't need to bother with this step.
Otherwise you'll need to select a cipher to use with Crypt::OpenPGP.
Please choose at least one from the following list (3DES is the
default).
MSG
my $i = 1;
for my $ciph (@cryptmod) {
printf " [%d] %s\n", $i++, $ciph->[0];
}
my $c = prompt("\nEnter your choices, separated by spaces:", 1);
print "\n";

for my $id (split /\s+/, $c) {
next unless $cryptmod[$id-1]->[1];
$prereq{ $cryptmod[$id-1]->[1] } = '0';
}

print<<MSG;
Crypt::OpenPGP also requires at least one public-key implementation;
it may require more, depending on what types of keys you use in
your other PGP applications. Each public-key implementation may
depend on a Crypt:: module from the CPAN. You may already have the
necessary module(s) installed, in which you don't need to bother with
this step. Otherwise you'll need to select a public-key implementation
to use with Crypt::OpenPGP. Please choose at least one from the
following list (DSA and ElGamal are the defaults).
MSG
my $i = 1;
for my $pk (@pkmod) {
printf " [%d] %s\n", $i++, $pk->[0];
}
my $c = prompt("\nEnter your choices, separated by spaces:", '1 2');
print "\n";

for my $id (split /\s+/, $c) {
next unless $pkmod[$id-1]->[1];
$prereq{ $pkmod[$id-1]->[1] } = '0';
}

print "\nChecking for required modules\n\n";
my(%todo, $missing);
while (my($k, $v) = each %prereq) {
unless (check_module($k, $v, \$missing)) {
$todo{$k} = $v;
}
}
use Cwd;
my $cwd = cwd();

if (%todo) {
print <<MSG;
Crypt::OpenPGP depends on several external modules for functionality.
Some of these modules can not be found on your system; they can be
installed automatically for you. To do so will require loading the
CPAN shell, which may require you to be running as root. Answer 'n' to
each of the following questions if you'd rather not install any
needed modules right now; note, however, that you'll still need to
install them to use Crypt::OpenPGP.
MSG

while (my($k, $v) = each %todo) {
if (prompt(sprintf("%s%s not installed/out of date. Install (y/n)?",
$k, $v ? " (ver. $v)" : ""), "y") =~ /^y/) {
require CPAN; CPAN::Shell->install($k);
delete $prereq{$k};
chdir $cwd or die "Can't chdir back to $cwd: $!";
}
}
}

print "\n";
WriteMakefile(
NAME => 'Crypt::OpenPGP',
DISTNAME => 'Crypt-OpenPGP',
VERSION_FROM => 'lib/Crypt/OpenPGP.pm',
AUTHOR => 'Benjamin Trott <ben@rhumba.pair.com>',
ABSTRACT => 'Pure-Perl OpenPGP-compatible PGP implementation',
PREREQ_PM => \%prereq,
);

sub read_yes_or_no {
my($prompt, $def) = @_;
my $ans = prompt($prompt, $def);
$ans =~ /^y/i;
}

sub check_module {
my($name, $ver, $missing) = @_;
print substr("$name ............................", 0, 30);
my $ok = have_mod($name, $ver);
$$missing++ unless $ok;
print $ok ? "ok\n" : "** FAILED **\n";
$ok;
}

sub have_mod {
my($name, $ver) = @_;
eval("use $name" . ($ver ? " $ver;" : ";"));
!$@;
}
56 changes: 56 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
$Id: README,v 1.2 2001/07/24 04:21:32 btrott Exp $

This is Crypt::OpenPGP. It provides a pure-Perl implementation of the
OpenPGP standard, including support for all versions of PGP and
GnuPG.

PREREQUISITES

Crypt::OpenPGP requires the following Perl modules:

* MIME::Base64
* Data::Buffer
* Math::Pari

Depending on which symmetric ciphers you use, you will require
at least one of the following modules:

* Crypt::DES (for 3DES)
* Crypt::IDEA (for IDEA)
* Crypt::Blowfish (for Blowfish)

And depending on which public key algorithms you use, you will
require at least one of the following modules:

* Crypt::RSA (for RSA encryption/decryption and signatures)
* Crypt::DSA (for DSA signatures)

Note that currently ElGamal for encryption and decryption is
provided by Crypt::OpenPGP itself; once Crypt::ElGamal is up on
CPAN, Crypt::OpenPGP will be switched to use that support instead.

INSTALLATION

Crypt::OpenPGP installation is straightforward. If your cpan shell is
set up, you should just be able to do

% perl -MCPAN -e 'install Crypt::OpenPGP'

Answer the questions as to which encodings you prefer to use,
and you'll be on your way.

If you don't like that, you can download the distribution; the
latest version on CPAN can be found in

ftp://ftp.cpan.org/pub/CPAN/authors/id/B/BT/BTROTT/

Download it, unpack it, then build it as per the usual:

% perl Makefile.PL
% make && make test

Then install it:

% make install

Benjamin Trott / ben@rhumba.pair.com
Loading

0 comments on commit f48884e

Please sign in to comment.