Mailing List Archive

Re: GnuPG 0.9.2
Okay, I'm on the mailing list finally. Trying to juggle tracking down
a compatibility problem between GPG and PGP while getting my daily
work done is at times challenging.

THE PROBLEM:

I have a large (~8MB) text file that I want to "conventionally"
encrypt using GPG. However, it is important that it can be decrypted
with PGP 5.0 and above.

Unfortunately, PGP fails to decrypt the file GnuPG generates.
However, GnuPG can decrypt the file. If encrypted with PGP, both PGP
and GnuPG can decrypt the file. Unfortunately, PGP is now a GUI only
tool. I need something that I can automate, like GnuPG, and not have
"for non-commercial use" restrictions.

The --list-packets option on GnuPG does not entirely work on the GPG
generated file or a PGP generated file. However, they have slightly
different outputs that may be interesting.

HOW TO REPRODUCE THE PROBLEM

Script started on Wed Feb 10 09:25:24 1999
dwpalm:dwpalmer$ dd if=/dev/urandom count=4096 bs=1024 | hexdump > secrets.txt
4096+0 records in
4096+0 records out
dwpalm:dwpalmer$ du -h secrets.txt
12M secrets.txt
dwpalm:dwpalmer$ gpg -c --cipher-algo cast5 --compress-algo 1 --no-comment secretts.txt
gpg (GnuPG) 0.9.1; Copyright (C) 1999 Free Software Foundation, Inc.
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions. See the file COPYING for details.

gpg: Warning: using insecure memory!
Enter passphrase:
Repeat passphrase:
dwpalm:dwpalmer$ gpg --list-packets secrets.txt.gpg
gpg (GnuPG) 0.9.1; Copyright (C) 1999 Free Software Foundation, Inc.
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions. See the file COPYING for details.

gpg: Warning: using insecure memory!
:symkey enc packet: version 4, cipher 3, s2k 1, hash 3
salt 15151adcce245499
:encrypted data packet:
length: unknown
Enter passphrase:
gpg: decryption failed: bad key
dwpalm:dwpalmer$ gpg secrets.txt.gpg
gpg (GnuPG) 0.9.1; Copyright (C) 1999 Free Software Foundation, Inc.
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions. See the file COPYING for details.

gpg: Warning: using insecure memory!
Enter passphrase:
File `secrets.txt' exists. Overwrite (y/N)? y

dwpalm:dwpalmer$ head secrets.txt
0000000 d3fb 5f19 4315 17d1 7bfc d1e3 1633 a747
0000010 9888 33f6 7b7f b10d 3fe1 f97c 2112 0434
0000020 c294 6927 a038 ac0a ce7b 72de d0db 6343
0000030 ee82 6ab0 57b4 182b 73f5 87d6 1da1 dbe0
0000040 8129 c6cf 71ec 4a8b 5151 a3e1 3f31 4c59
0000050 6de4 2b56 f6f9 0df3 ef31 117b a172 2d14
0000060 ef70 9c7b 97c1 b331 e055 5305 b6f5 4e3b
0000070 56eb 9b13 dc80 38a6 ea92 b0ec 51d8 234d
0000080 1acf c9d0 a2d8 46c9 df99 65ea 076f d802
0000090 f433 3fe2 2604 5673 22dd 7d64 4888 a9d5
dwpalm:dwpalmer$ exit
exit

Script done on Wed Feb 10 09:27:18 1999

ENCRYPTING WITH PGP 5.5:

I encrypted the secrets.txt file produced above using PGP 5.5. Then I
did the following:

dwpalm:dwpalmer$ gpg --list-packets secrets.txt.pgp
gpg (GnuPG) 0.9.1; Copyright (C) 1999 Free Software Foundation, Inc.
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions. See the file COPYING for details.

gpg: Warning: using insecure memory!
:marker packet:
50 47 50
:symkey enc packet: version 4, cipher 3, s2k 0, hash 1
:encrypted data packet:
length: unknown
gpg: decryption failed: bad key


Note that this is slightly different that what GnuPG created. The
"marker packet" is new, "s2k 0" and "hash 3" are different. Also,
decrypting the secrets.txt.pgp file with GnuPG works.

I'd be happy to send you the PGP encrypted file if that would help.
However, it is rather large (6.3M).

Dave
Re: GnuPG 0.9.2 [ In reply to ]
dwpalmer@dwpalm.jf.intel.com writes:

> :symkey enc packet: version 4, cipher 3, s2k 1, hash 3
> salt 15151adcce245499
> :encrypted data packet:
> length: unknown


> ENCRYPTING WITH PGP 5.5:

> :marker packet:
> 50 47 50
> :symkey enc packet: version 4, cipher 3, s2k 0, hash 1
> :encrypted data packet:
> length: unknown

> Note that this is slightly different that what GnuPG created. The
> "marker packet" is new, "s2k 0" and "hash 3" are different. Also,

The marker packet doesn't matter - it is just a comment.

Try this line:

$ gpg -c --s2k-mode 0 --digest-algo md5 -o xxx --cipher-algo cast5

and you should see the same as PGP 5.5 produces:

:symkey enc packet: version 4, cipher 3, s2k 0, hash 1


Please tell me whether this works.


Werner


--
ceterum censeo RSA esse delendam
Re: GnuPG 0.9.2 [ In reply to ]
Ouch! This is even worse. PGP 5.5 crashes on decrypting the GnuPG
generated file. Silly thing followed a NULL pointer to the land of
pure madness. GnuPG, however, is quite happy with the file.

Unfortunately, I still require compatibility with PGP (sigh). I'd
rather avoid hacking GnuPG to work around what appears to be a PGP
bug. I'll try a few ways of doing conventional encryption.

Variables to try:

1. Cipher: --cipher-algo [3des|cast5]
2. Hash: --digest-algo [md5|sha1|ripemd160])
3. Passphrase: --s2k-mode [0|1|3]

That gives me 2*3*3 = 18 tests. I'll let you know how it goes. Any
suggestions on what else I could try?

BTW, the changes in the command line make the two look more alike:

dwpalm:dwpalmer$ gpg --list-packets xxx.gpg
gpg (GnuPG) 0.9.1; Copyright (C) 1999 Free Software Foundation, Inc.
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions. See the file COPYING for details.

gpg: Warning: using insecure memory!
:symkey enc packet: version 4, cipher 3, s2k 0, hash 1
:encrypted data packet:
length: unknown
gpg: decryption failed: bad key


PS: Why the "decryption failed: bad key" message? I'm using the right
passphrase...

THANKS!
Dave

> Date: Wed, 10 Feb 1999 19:16:07 +0100
> From: Werner Koch <wk@isil.d.shuttle.de>

> Try this line:
>
> $ gpg -c --s2k-mode 0 --digest-algo md5 -o xxx --cipher-algo cast5
>
> and you should see the same as PGP 5.5 produces:
>
> :symkey enc packet: version 4, cipher 3, s2k 0, hash 1
>
>
> Please tell me whether this works.
>
>
> Werner
>
>
> --
> ceterum censeo RSA esse delendam
>
>
Re: GnuPG 0.9.2 [ In reply to ]
dwpalmer@dwpalm.jf.intel.com writes:

> PS: Why the "decryption failed: bad key" message? I'm using the right
> passphrase...

A bug with list-packets I think.


Werner


--
ceterum censeo RSA esse delendam