Browse files

* Fixing key_server_preferences().

* Fixing signature_multi_precision_integer().
  • Loading branch information...
1 parent 1d30d80 commit 727a8391ebffb7bd289a4c789f4671bd0ff16e5b @kazu-yamamoto committed Feb 19, 2010
Showing with 85 additions and 42 deletions.
  1. +5 −0 CHANGES
  2. +21 −21 README
  3. +11 −5 keys.c
  4. +2 −6 packet.c
  5. +1 −1 pgpdump.c
  6. +11 −3 signature.c
  7. +34 −6 subfunc.c
View
5 CHANGES
@@ -1,5 +1,10 @@
Change Log
+0.10 2001/05/08
+
+* Fixing key_server_preferences().
+* Fixing signature_multi_precision_integer().
+
0.09 2001/05/05
* Implementing additional_decryption_key() like revocation_key().
View
42 README
@@ -1,7 +1,7 @@
pgpdump: a PGP packet visualizer
Kazu Yamamoto <kazu@iijlab.net>
- April 12, 2001
+ May 8, 2001
<Overview>
@@ -11,28 +11,28 @@ of OpenPGP (RFC 2440 + bis) and PGP version 2 (RFC 1991).
Here is an example:
- % pgpdump sig.pgp
- Old: Marker Packet(tag 10)(3 bytes)
- String - ...
+ % pgpdump data/sig1
+ Old: Marker Packet(tag 10)(3 bytes)
+ String - ...
New: One-Pass Signature Packet(tag 4)(13 bytes)
- New version(3)
- Sig type - Signature of a binary document(0x00).
- Hash alg - SHA1(hash 2)
- Pub alg - DSA Digital Signature Standard(pub 17)
- Key ID - a7 97 78 e2 47 b6 30 37
- Next packet - other than one pass signature
+ New version(3)
+ Sig type - Signature of a binary document(0x00).
+ Hash alg - SHA1(hash 2)
+ Pub alg - DSA Digital Signature Standard(pub 17)
+ Key ID - a7 97 78 e2 47 b6 30 37
+ Next packet - other than one pass signature
New: Signature Packet(tag 2)(63 bytes)
- Ver 3 - old
- Hash material(5 bytes):
- Sig type - Signature of a binary document(0x00).
- Creation time - Fri Nov 27 22:35:02 1998
- Key ID - a7 97 78 e2 47 b6 30 37
- Pub alg - DSA Digital Signature Standard(pub 17)
- Hash alg - SHA1(hash 2)
- Hash left 2 bytes - 8f 82
- DSA r(160 bits) - ...
- DSA s(157 bits) - ...
- -> hash(160 bits)
+ Ver 3 - old
+ Hash material(5 bytes):
+ Sig type - Signature of a binary document(0x00).
+ Creation time - Fri Nov 27 22:35:02 JST 1998
+ Key ID - a7 97 78 e2 47 b6 30 37
+ Pub alg - DSA Digital Signature Standard(pub 17)
+ Hash alg - SHA1(hash 2)
+ Hash left 2 bytes - 8f 82
+ DSA r(160 bits) - ...
+ DSA s(157 bits) - ...
+ -> hash(160 bits)
<Installation>
View
16 keys.c
@@ -77,8 +77,9 @@ new_Public_Key_Packet(int len)
multi_precision_integer("DSA y");
break;
default:
- printf("\t\tunknown(%d)\n", PUBLIC);
+ printf("\tUnknown public key(pub %d)\n", PUBLIC);
skip(len - 5);
+ break;
}
}
@@ -124,8 +125,9 @@ Secret_Key_Packet(int len)
multi_precision_integer("DSA x");
break;
default:
- printf("\t\tunknown(%d)\n", PUBLIC);
+ printf("\tUnknown secret key(pub %d)\n", PUBLIC);
skip(len - Getc_getlen());
+ break;
}
printf("\t\t-> m = sym alg(1) + checksum(2) + PKCS-1 block type 02\n");
break;
@@ -140,6 +142,7 @@ Secret_Key_Packet(int len)
sym_algs(s2k);
IV(iv_len(s2k));
encrypted_Secret_Key(len - Getc_getlen());
+ break;
}
}
@@ -166,8 +169,9 @@ encrypted_Secret_Key(int len)
multi_precision_integer("Encrypted DSA x");
break;
default:
- printf("\t\tEncrypted unknown(pub %d)\n", PUBLIC);
+ printf("\t\tUnknown encrypted key(pub %d)\n", PUBLIC);
skip(len);
+ break;
}
printf("\tChecksum - ");
dump(2);
@@ -194,14 +198,16 @@ encrypted_Secret_Key(int len)
printf("\tEncrypted checksum\n");
break;
default:
- printf("\tEncrypted unknown(pub %d)\n", PUBLIC);
+ printf("\tUnknown encrypted key(pub %d)\n", PUBLIC);
printf("\tEncrypted checksum\n");
+ break;
}
skip(len);
break;
default:
- printf("unknown key\n");
+ printf("\tUnknown encrypted key\n");
skip(len);
+ break;
}
}
View
8 packet.c
@@ -318,10 +318,8 @@ parse_packet(void)
if (tag < TAG_NUM && tag_func[tag] != NULL)
(*tag_func[tag])(len);
- else {
- printf("\tUNKNOWN TAG\n");
+ else
skip(len);
- }
while (partial == YES) {
printf("New: ");
c = Getc();
@@ -364,10 +362,8 @@ parse_subpacket(char *prefix, int tlen)
printf("(%d bytes)\n", len);
if (sub < SUB_NUM && sub_func[sub] != NULL)
(*sub_func[sub])(len);
- else {
- printf("\tUNKNOWN SUB PARCKET\n");
+ else
skip(len);
- }
}
}
View
2 pgpdump.c
@@ -5,7 +5,7 @@
#include "pgpdump.h"
#include <stdarg.h>
-private char *pgpdump_version = "0.09, Copyright (C) 1998-2001 Kazu Yamamoto";
+private char *pgpdump_version = "0.10, Copyright (C) 1998-2001 Kazu Yamamoto";
private char *prog;
private void usage(void);
View
14 signature.c
@@ -23,17 +23,25 @@ signature_multi_precision_integer(int pub, int skip)
{
switch (pub) {
case 1:
+ case 2:
+ case 3:
multi_precision_integer("RSA m^d mod n");
printf("\t\t-> PKCS-1\n");
break;
+ case 16:
+ case 20:
+ multi_precision_integer("ElGamal ?");
+ multi_precision_integer("ElGamal ?");
+ break;
case 17:
multi_precision_integer("DSA r");
multi_precision_integer("DSA s");
printf("\t\t-> hash(160 bits)\n");
break;
default:
- printf("\tunknown(pub %d)\n", pub);
+ printf("\tUnknown signature(pub %d)\n", pub);
skip(skip);
+ break;
}
}
@@ -115,11 +123,11 @@ Signature_Packet(int len)
case 2:
case 3:
printf("old\n");
- old_Signature_Packet(len);
+ old_Signature_Packet(len - 1);
break;
case 4:
printf("new\n");
- new_Signature_Packet(len);
+ new_Signature_Packet(len - 1);
break;
default:
printf("unknown\n");
View
40 subfunc.c
@@ -80,6 +80,7 @@ additional_decryption_key(int len)
break;
default:
printf("Unknown class(%02x)", c);
+ break;
}
printf("\n");
printf("\t");
@@ -113,6 +114,7 @@ revocation_key(int len)
break;
default:
printf("Unknown class(%02x)", c);
+ break;
}
else
printf("Unknown class(%02x)", c);
@@ -134,13 +136,28 @@ issuer_key_ID(int len)
public void
notation_data(int len)
{
- int nlen, vlen, human = 0;
+ int c, nlen, vlen, human = 0;
printf("\t\tFlag - ");
- if (Getc() & 0x80) {
- printf("Human-readable\n");
+ c = Getc();
+ switch (c) {
+ case 0x80:
+ printf("Human-readable");
human = 1;
+ break;
+ case 0x0:
+ printf("Normal");
+ break;
+ default:
+ printf("Unknown flag1(%02x)", c);
+ break;
}
- skip(3);
+ c = Getc();
+ if (c != 0) printf("Unknown flag2(%02x)", c);
+ c = Getc();
+ if (c != 0) printf("Unknown flag3(%02x)", c);
+ c = Getc();
+ if (c != 0) printf("Unknown flag4(%02x)", c);
+ printf("\n");
nlen = Getc() * 256 + Getc();
vlen = Getc() * 256 + Getc();
printf("\t\tName - ");
@@ -180,9 +197,20 @@ preferred_compression_algorithms(int len)
public void
key_server_preferences(int len)
{
+ int c = Getc();
printf("\t\tFlag - ");
- if (Getc() & 0x80)
- printf("No-modify\n");
+ switch (c) {
+ case 0x80:
+ printf("No-modify");
+ break;
+ case 0x0:
+ printf("Normal");
+ break;
+ default:
+ printf("Unknown flag(%02x)", c);
+ break;
+ }
+ printf("\n");
skip(len - 1);
}

0 comments on commit 727a839

Please sign in to comment.