linux-l: GPG Sigs -> mutt config fuer maillists

JSC schlegel at tfh-berlin.de
Mi Mai 2 16:35:53 CEST 2001


On Wed, May 02, 2001 at 10:03:20AM +0200, Marc Ende wrote:
> Leute, leute, wenn man die Sigs mit Key oder ohne Key nicht sehen kann,
> bitte verwendet doch Procmail und laßt entsprechend den Kram wegwerfen. Und
> wenn man den einen oder anderen wegen seiner Umgangsform nicht leiden kann
> hilft das Tool auch.
> 
hatte ich mal angefangen, weil ich gpg-sigs nicht auswerten konnte
und mich die 7 zeile fehlerausgabe von pgp beim lesen des "inhalt's"
gestoert haben.

ich glaube, es hatte auch funktioniert. ist aber wegen des archives 
nicht in produktion gegangen.

stadium der software: it work's for me
[hab ich mal in einer bug-db gesehen. nett nich?]

der perlcode ist sicher haesslich. also perl-guru's: ran! wenn
das ganze dann im script-archiv [so es das gibt] auftaucht,
haben alle was von dauer.

bye
Jens
-- 
 --------------------------------------------------------------
| Jens Schlegel                                                |
| TFH Berlin         email: schlegel at tfh-berlin.de             |
 --------------------------------------------------------------
-------------- nächster Teil --------------
#!/usr/bin/perl

@Lines = <STDIN>;

for (0 .. $#Lines){
   if( $Lines[$_] =~ /^Content-Type: (.*)$/ ){
     my $l1 = $1;
     my $two_lined_ct = 0;
      if( $Lines[$_+1] =~ /^\s+(.*)$/ ){
         $l1 = "$l1 $1";
         $two_lined_ct = 1;
      }
      $l1 = "Content-Type: $l1\n";
      @Lines = (@Lines[0..$_-1],$l1, at Lines[$_+1+$two_lined_ct..$#Lines]);
      last;
   }
}
my ($CT,$AE) = (0,0);
my $Key;
for (0 .. $#Lines){
   if( $Lines[$_] =~ /^Content-Type: multipart\/signed;.*boundary=(\S+)/ ){
      $CT = $_;
      $Key = $1;
      if( $Key =~ /^"(\S+)"$/ ){ $Key = $1; } # dequote
   }
}
if( ! $CT ){
   print @Lines;
   exit(0);
}
# GnuPG or not ?
for ($CT+1..$#Lines){
   if( $Lines[$_] =~ /^--$Key$/ ){
      if( $AE ){
         $AE = $_;
      }else{
         $AE = 1;
      }
   }
   if( $Lines[$_] =~ /^-----BEGIN PGP SIGNATURE-----$/ ){
     # next line is it
      if( $Lines[$_+1] =~ /^Version: GnuPG/ ){
        my (@TmpErg) = @Lines[0..$CT-1];
         # wir wissen was in $Lines[$CT] steht:
         @TmpErg = (@TmpErg,"Content-Type: multipart/mixed; boundary=\"$Key\"\n");
         # das attachment:
         @TmpErg = (@TmpErg, at Lines[$CT+1..$AE-1]);
         # skip signature, append rest of mail
         for ($AE+1..$#Lines){
            if( $Lines[$_] =~ /^--$Key/ ){
               @TmpErg = (@TmpErg, at Lines[$_..$#Lines]);
               last;
            }
         }
         @Lines = @TmpErg;
         last;
      }
   }
}
print @Lines;
exit(0);
#< Content-Type: multipart/signed; micalg=pgp-md5;
#< 	protocol="application/pgp-signature"; boundary="EeQfGwPcQSOJBaQU"
#---
#> Content-Type: multipart/mixed; boundary="EeQfGwPcQSOJBaQU"
#58,70d56
#< 
#< --EeQfGwPcQSOJBaQU
#< Content-Type: application/pgp-signature
#< Content-Disposition: inline
#< 
#< -----BEGIN PGP SIGNATURE-----
#< Version: GnuPG v1.0.1 (GNU/Linux)
#< Comment: For info see http://www.gnupg.org
#< 
#< iD8DBQE4vHR1jB6yu/0L7eURAr7gAJ4xxs1qSmxjjCK0bLCq/d1RY/gh0ACaAzWa
#< LAl77+zJbiLxeOh1cJhe2Ec=
#< =iNSP
#< -----END PGP SIGNATURE-----


Mehr Informationen über die Mailingliste linux-l