summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoro <o@immerda.ch>2011-06-30 21:00:59 +0200
committero <o@immerda.ch>2011-06-30 21:00:59 +0200
commit883ab23d7fbb3d8d32cee39ef46b10b44c36faa8 (patch)
tree0e8f49236eb6b749284a6653f035dfac5f328fac
parentce318f2b4aa01c7957fa06c4f788fc904753e96b (diff)
added signature packet
-rw-r--r--lib/fpg/packets/signature.rb14
-rw-r--r--lib/fpg/parse/parser.rb2
2 files changed, 14 insertions, 2 deletions
diff --git a/lib/fpg/packets/signature.rb b/lib/fpg/packets/signature.rb
index c906c75..559e5b3 100644
--- a/lib/fpg/packets/signature.rb
+++ b/lib/fpg/packets/signature.rb
@@ -1,7 +1,19 @@
module FPG
module Packets
class Signature < Packet
- string :skip_this, :read_length => :byte_size
+ uint8 :version, :check_value => lambda { value == 4 }
+ uint8 :signature_type
+ uint8 :pubkey_algo
+ uint8 :h_algo
+ uint16 :hashed_subpacket_size
+ string :hashed_subpackets, :read_length => :hashed_subpacket_size
+ uint16 :unhashed_subpacket_size
+ string :unhashed_subpackets, :read_length => :unhashed_subpacket_size
+ int16 :subpacket_hash
+ choice :key_material, :selection => :pubkey_algo do
+ rsa_session 1
+ end
+
def self.tag
2
end
diff --git a/lib/fpg/parse/parser.rb b/lib/fpg/parse/parser.rb
index 82d6322..76ba23e 100644
--- a/lib/fpg/parse/parser.rb
+++ b/lib/fpg/parse/parser.rb
@@ -16,7 +16,7 @@ module FPG
num = packet_number(stream.getbyte)
stream.seek(-1,IO::SEEK_CUR)
packet = Packets::Packet.with_tag(num)
- if packet.is_a? SecretKey then
+ if packet.is_a? Signature then
puts
BinData::trace_reading do
packet.read(stream)