William H. Geiger III, <whgiii(_at_)invweb(_dot_)net>, writes:
I am having a little problem in parsing signed messages following the
draft documentation.
Both PGP 2.6.x & 5.0 produce the following (output as binary file):
A3 01 01 AF 00 50 FF [remained is signature block]
The first packet is a compressed packet (CTB 0xA3) with a type 3 length
(Old format). Per the docs:
[...]
3 - The packet is of indeterminate length. The header is 1 octet
long, and the implementation must determine how long the packet
is. If the packet is in a file, this means that the packet
extends until the end of the file. In general, an implementation
should not use indeterminate length packets except where the end
of the data will be clear from the context. The new format
headers described below have a mechanism for precisely encoding
data of indeterminite length.
Obviously this is not the case as the compressed data packet does not
cover the entire file as there is a signature packet that follows.
Actually, the comment in the spec is correct, and you are being fooled
by the structure of the compressed data packet.
What is happening here is that the compressed data packet *does* cover
the entire file. It's just that the compression algorithm has chosen to
include a copy of the compressed data (the signature packet) as part of
its output. Since not all data is compressible, compression algorithms
sometimes do this. What you thought was the beginning of a new packet
is simply the 6th byte of the compressed data packet.
I see that the latest draft has added the sentence,
With a compressed packet, the
algorithm implicitly denotes how the end of the packet.
in section 4.2.1, based on the earlier discussion (sorry I did not comment
sooner). I don't believe this sentence is correct, and it should be
removed.
Also Section 10.2 does not seem accurate as:
Signed Message :- Signature Packet, OP Message | One-Pass Signed Message.
Seems to imply that the signature packet comes first followed by the OP
Message (the opposite is the case with 2.6.x & 5.x).
I don't know why you say this, actually 2.6.x and 5.x put the signature
packet first. Are you thinking of clearsigned messages? The grammar
in section 10.2 applies to binary messages.
Hal