<<< Date Index >>>     <<< Thread Index >>>

about PGP verification source code: pgp_write_signed()



Hi list,

I am studying Mutt the source code to get a better understanding of gpg. I got a question about the following code when Mutt tries to verify a signature: why Mutt needs to convert every single '\n' to a "\r\n" before calling gpg to verify it? I didn't see a similar (reverse conversion) when Mutt signs a message?



Thanks a lot,
Kai

--------------------------------
File pgp.c:

static int pgp_write_signed(BODY *a, STATE *s, const char *tempfile)
{
 ...

 fseek (s->fpin, a->hdr_offset, 0);
 bytes = a->length + a->offset - a->hdr_offset;
 hadcr = 0;
 while (bytes > 0)
 {
   if((c = fgetc(s->fpin)) == EOF)
     break;
   bytes--;
     if(c == '\r')
     hadcr = 1;
   else
   {
     if(c == '\n' && !hadcr)
       fputc('\r', fp);
     hadcr = 0;
   }
   fputc(c, fp);
 }
}