compatibility check perl script pgp/gpg

Mark Hofstetter mark.hofstetter at
Wed Apr 4 16:35:07 CEST 2001

Hi everybody,

I've written a small perl-script to test compatibility between pgp 
clearsigned mails ang gpg - it doesn't strive for ellegance but it works ...
perl, pgp and gpg have to be installed and keys have to be exchanged

@bau  contains the fragments of which the text which is to be signed is 
additionally a random ASCII character is inserted

-> both programs work together quite well but tab-character (ASCII 9) leeds 
to to "bad signature" if signed with pgp and checked with gpg an vice versa




@bau=("hallo  ", "hallo  ", 
"hallo  ","hallo  ","hallo  ","hallo  \t","hallo  ","hallo","hallo 
","hallo  ","hallo  ","hallo  ","hallo  ","hal lo","hallo  ","\r\n", "\n");

for ($i=1; $i<=255; $i++)
open (STDERR, ">ausgabe.txt");

open (FH, ">text");
for ($z=0; $z<=30; $z++)

         $zuf=int(rand ($#bau));

         if ($z==15)
         $zeichen=int(rand 255);
         $var=pack "c", $i;

print FH $a;
close FH;

$pgp=`pgp +force -z test -sta text`;

system("cat text.asc");
open (AFH, "<text.asc");
close AFH;

$aus=join(/""/, @all);


open (AFH, ">text.asc");
print AFH $aus;
close AFH;

$gpg=`gpg --verify text.asc`;

#system("cat text.asc");

open (AFH, "<ausgabe.txt");
close AFH;

$aus=join(/""/, @all);

if ($aus=~/Good signature/)
                 print "OK\n";
                 print "BAD - $i\n";
                 open (BFH, ">$fn");
                 print BFH $a;
                 #print BFH "BAD - $i $var\n";
                 close BFH;

Mag. Mark Hofstetter
Vienna University Computer Center
mh.zid at

More information about the Gnupg-devel mailing list