Thread View: news.software.nntp
2 messages
2 total messages
Started by CyberPromo Danmark
Tue, 16 Dec 1997 00:00
pgpverify for PGP 5.0, eh?
Author: CyberPromo Danmark
Date: Tue, 16 Dec 1997 00:00
Date: Tue, 16 Dec 1997 00:00
27 lines
1606 bytes
1606 bytes
Gnarf. Turns out that a handful o' thangs have changed, again, in the latest and brandest spankingest newest PGP release, rendering it yet again incompatible with the most recent pgpverify 1.4 that I've seen. Two things are obvious: First, one no longer wants to call it as pgp -f but instead as pgpv -f, and second, the successful verification no longer returns the simple one-line result that is coded into the 1.4 and previous releases, but something more on the order of <misc warnings and gripes> Good signature made <blah blef blonk GMT> by key: <details details details and so on> "news.announce.newgroups" Has anyone hacked a more current pgpverify which properly groks this newest format and may even remain backwardly compatible with PGPs which are happy with being invoked as simply pgp? If not, the floor looks very comfortable and it looks very dark outside, so I can wait until someone does it Properly while I snooze. Thanks, ye ole lazy Barry Bouwsma
Re: pgpverify for PGP 5.0, eh?
Author: Wolfgang Rupprecht
Date: Mon, 15 Dec 1997 00:00
Date: Mon, 15 Dec 1997 00:00
186 lines
6992 bytes
6992 bytes
CyberPromo Danmark <remove@int.tele.dk> writes:
> Gnarf. Turns out that a handful o' thangs have changed, again, in the
> latest and brandest spankingest newest PGP release, rendering it yet again
> incompatible with the most recent pgpverify 1.4 that I've seen.
Yea, lots of gratuitous changes in pgp-5.0. I've been running this
hacked version of pgpverify every since pgp-5.0 came out (and I made
the mistake of installing it).
-wolfgang
#! /usr/bin/perl -w
# written April 1996, tale@uunet.uu.net (David C Lawrence)
# Version 1.3 + INN hacks from version 1.2 -wsr
## =()<$pgp = '@<_PATH_PGP>@' ;>()=
$pgp = '/usr/local/bin/pgpv' ;
# if you keep your keyring somewhere that is not the default used by pgp,
# uncomment the next line and set appropriately.
# $ENV{'PGPPATH'} = '/path/to/your/pgp/config';
$tmp = "/tmp/pgp$$";
### Exit value:
### 0 good signature
### 1 no signature
### 2 unknown signature
### 3 bad signature
### 255 problem not directly related to pgp analysis of signature
die "Usage: $0 < message\n" if @ARGV != 0;
$0 =~ s(^.*/)(); # trim /path/to/prog to prog
# this is, by design, case-sensitive with regards to the headers it checks.
# it's also insistent about the colon-space rule.
while (<>) {
chop;
last if /^$/;
if (/^(\S+):[ \t](.+)/) {
($label, $value) = ($1, $2);
$dup{$label} = 1 if $header{$label};
$header{$label} = $value;
} elsif (/^\s/) {
&fail("$0: non-header line at $_\n") unless $label;
$header{$label} .= "\n$_";
} else {
&fail("$0: non-header line at $_\n");
}
}
$pgpheader = "X-PGP-Sig";
exit 1 unless $_ = $header{$pgpheader}; # no signature
# this regexp might be too strict about the structure of pgp signature lines
$sep = "\n[ \t]+";
$r64 = '[a-zA-Z0-9+/]';
&fail("$0: $pgpheader not in expected format\n")
unless /^(\S+) (\S+)(($sep$r64{64})+$sep$r64+=?=?$sep=$r64{4})$/;
($version, $signed_headers, $signature) = ($1, $2, $3);
$signature =~ s/\n[ \t]+/\n/g;
$message = "-----BEGIN PGP SIGNED MESSAGE-----\n\n";
$message .= "X-Signed-Headers: $signed_headers\n";
foreach $label (split(",", $signed_headers)) {
&fail("$0: duplicate signed $label header, can't verify\n")
if $dup{$label};
$message .= "$label: ";
$message .= "$header{$label}" if $header{$label};
$message .= "\n";
}
$message .= "\n"; # end of headers
while (<>) { # read body lines
s/^-/- -/; # pgp quote ("ASCII armor") dashes
$message .= $_; # append to output string
}
$message .= "\n-----BEGIN PGP SIGNATURE-----\n";
$message .= "Version: $version\n";
$message .= $signature;
$message .= "\n-----END PGP SIGNATURE-----\n";
open(TMP,"> $tmp") || &fail("$0: open > $tmp: $!\n");
print TMP $message;
close(TMP) || warn "$0: close > $tmp: $!\n";
&fail("$0: write error for message to check\n")
if -s $tmp != length($message);
&fail("$0: $pgp does not exist.\n") if ( ! -f $pgp ) ;
&fail("$0: $pgp is not executable\n") if ( ! -x $pgp ) ;
$ENV{'LANGUAGE'} = 'en'; # force English for pgp messages
$ok = 2; # unknown signature result is default
open(PGP,"$pgp -f $tmp 2>&1 >/dev/null |") ||
&fail("$0: failed to execute pgp: $!\n");
$/ = "\n";
while (<PGP>) {
# MIT PGP 2.6.2:
# Good signature from user "Robert Braver <rbraver@ohww.norman.ok.us>".
# ViaCrypt PGP 4.0:
# Good signature from user: Robert Braver <rbraver@ohww.norman.ok.us>
# print STDERR "$_" ;
if (/^Good signature made/) {
$ok = 0;
$signer = "unknown";
} elsif (/^BAD signature made/) {
$ok = 3;
}
#Cannot open configuration file /var/news/etc/.pgp/pgp.cfg
#Opening file "stdout" type text.
#Good signature made 1997-08-19 14:30 GMT by key:
# 1024 bits, Key ID B88DA9C1, Created 1996-04-10
# "news.announce.newgroups"
#
#WARNING: The signing key is not trusted to belong to:
#news.announce.newgroups
#
if ($ok == 0) {
if (/^ "([^"]*)"$/) {
$signer = $+;
# print STDERR "*** Signer: '$+' ***\n" ;
}
}
}
close(PGP) || warn "$0: closing pgp pipe returned status $?\n";
unlink("$tmp") || warn "$0: unlink $tmp: $!\n";
print "$signer\n" if $signer;
exit $ok;
sub
fail
{
unlink($tmp);
print STDERR $_[0];
exit 255;
}
# Our lawyer told me to include the following. The upshot of it is
# that you can use the software for free as much as you like.
# Copyright (c) 1996 UUNET Technologies, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. All advertising materials mentioning features or use of this software
# must display the following acknowledgement:
# This product includes software developed by UUNET Technologies, Inc.
# 4. The name of UUNET Technologies ("UUNET") may not be used to endorse or
# promote products derived from this software without specific prior
# written permission.
#
# THIS SOFTWARE IS PROVIDED BY UUNET ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL UUNET BE LIABLE FOR ANY DIRECT,
# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
# OF THE POSSIBILITY OF SUCH DAMAGE.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads