Bifroest | Mr. Tines | CTC Home | CTClib | MacCTC | CTCjava | Manual |
At the time of originally writing this page, there was no documentation available on PGP formats. Since the PGP Inc. have released a document of their own.
Whereas I have every reason to believe that the following information is accurate, I cannot give any guarantee that it is so. The main changes are as follows:-
PGP2.x packets all start with a Cipher Type Byte(CTB). Whereas PGP5 does not use the term CTB any more the concept of a Tag/Length/Value record remains and the first byte still identifys the type.
2.3 defines bit-6 as reversed and always '0'. PGP5 defines the CTB to have a different format if bit-6 is '1'. The new format is as follows:-
Note that the new style CTB has shifted the type field 2-bit to the right and increased it to 6-bits. Accordingly the CTB nolonger includes the length-of-length information. It also allows 64 rather than 16 types.
As the new-style CTB byte no longer includes length -of-length information this is encoded instead into the top bits of first length byte, as follows:-
PGP5.0 supports most of the old type values are a number of new ones are defined. I have yet to precisely determine precisely what any of these are used for. The new ones are:-
Some CTB record types (largely those associated with Public Key Encryption) have a version byte as the first byte of the record body. The meaning of versions bytes is as follows:-
All other values are undefined. The value defines the precise details of the format of the following packet. CTC1.0 does not accept packets except with versions 2 or 3. PGP5.0 writes some packets at version 3 and some at version 4.
Note that the changes due to version byte are not necessarily related to the changes due to change in algorithm. Version 2/3 defined that the precise data contents of a packet was algorithm byte dependent and only defines the format for RSA. Accordingly different public-key algorithm format can be accomodated with version 2/3 packets.
I ascribe to version, only those changes that explicitly break the Version 2/3 packet definition.
These are packets of type 5 & 6 in Version 2/3, which are respectively Secret and Public key certificates. The public-key format is a truncated variant of the Secret key format differing only in omitting the secret-key data.
In addition Version 4 has packet types 7 & 14 which are Secret and Public sub-key certificates respectively. These seem (although this remains to be confirmed) the same format at types 5 & 6 respectively.
The changes are as follows:
The Version 3 validity field (bytes 7 & 8) is omitted.
I suspect that there has to be more to it than this but at the moment I cannot
find anything. It is possible, for example, that the encryption of secret-key
has subtly changed.
The signature packet has been considerably extended and complicated.
Offset | Length | Meaning |
0 | 1 | Version byte (=4) |
1 | 1 | Signature type (included in hash) (nested flag) |
2 | 1 | PK algorithm (1 = RSA) (included in hash) |
3 | 1 | Hash algorithm (1 = MD5) (included in hash) |
4 | 2 | Length of extra material included in hash (=y) |
6 | y | Subpackets (hashed) |
6+y | 2 | Length of extra material not included in hash (=z) |
8+y | z | Subpackets (unhashed) |
8+y+z | 2 | First 2 bytes of message digest (16-bit checksum) |
10+y+z | 2+w | MPI of PK-signed integer |
Note that this is a significant change from the Version 2/3 format.
The sub-packet structure is new and replaces an number of fields in the old format. It is also much more general. The sub-packets are a Tag/Length/Value structure be much simpler than the CTB structure. The structure is:-
Offset | Size | Name | Description |
0 | 1 | Length (N) | Number of bytes in record excluding length field, but including type field |
1 | 1 | Type | Enumation value indicating significance of record |
2 | N-1 | Contents | Record data according to the type of the record. |
The following type of sub-packet are currently defined (although the comments indicate that they are not all implemented yet):-
The precise use, validity etc. of each value and which can legitimately be in the hashed or unhashed portion of the SKE record is not yet clear.
PGP5.0 includes the following extra algorithm byte values and corresponding ciphers:-
Symmetric Ciphers
Public Key Ciphers
Message Digests