Changeset 32
- Timestamp:
- 11/06/04 13:44:34 (4 years ago)
- Files:
-
- trunk/lib/pgp/packet/packet.rb (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lib/pgp/packet/packet.rb
r29 r32 30 30 31 31 TAGS = { 32 -1 => "Partial", 32 33 0 => "Reserved", 33 34 1 => "Public-Key Encrypted Session Key Packet", … … 88 89 89 90 def self.load(port) 90 loadport = wrap_port(port)91 91 packets = [] 92 92 continue = false 93 newheader = false 94 tag = nil 95 loadport = wrap_port(port) 93 96 while !loadport.eof? 94 97 if continue 95 lengthdefined, partial = load_length_new(loadport) 96 else 97 newheader, tag, lengthdefined, partial = load_header(loadport) 98 end 99 if partial and continue 100 raise "Partial Body Lengths packet not supported" 101 end 102 continue = partial 98 lengthdefined, continue = load_length_new(loadport) 99 packet = Partial.loader(loadport, lengthdefined) 100 packets << packet 101 next 102 end 103 newheader, tag, lengthdefined, continue = load_header(loadport) 103 104 initpos = loadport.readlength 104 105 unless TAG_LOADER.key?(tag) … … 122 123 end 123 124 continue = false 125 newheader = false 126 tag = nil 124 127 loadport = wrap_port(port) 125 128 while !loadport.eof? … … 127 130 begin 128 131 if continue 129 lengthdefined, partial = load_length_new(loadport) 130 else 131 newheader, tag, lengthdefined, partial = load_header(loadport) 132 lengthdefined, continue = load_length_new(loadport) 133 newtag = newheader ? "New" : "Old" 134 if continue 135 newtag += '(partial continue)' 136 else 137 newtag += '(partial end )' 138 end 139 dumpport.puts "#{newtag}: - (tag #{tag})(#{lengthdefined} bytes)" 140 Partial.scanner(dumpport, loadport, lengthdefined) 141 next 132 142 end 143 newheader, tag, lengthdefined, continue = load_header(loadport) 133 144 newtag = newheader ? "New" : "Old" 134 if partial 135 if continue 136 dumpport.puts "#{newtag}(partial continue): - (tag #{tag})(#{lengthdefined} bytes)" 137 loadport.read(lengthdefined) 138 next 139 else 140 newtag += '(partial start)' 141 end 142 else 143 if continue 144 newtag += '(partial end)' 145 end 145 if continue 146 newtag += '(partial start )' 146 147 end 147 continue = partial148 dumpport.puts "#{newtag}: #{taglabel(tag)}(tag #{tag})(#{lengthdefined} bytes)"148 dumpport.puts "#{newtag}: #{taglabel(tag)}(tag #{tag})" + 149 "(#{lengthdefined} bytes)" 149 150 initpos = loadport.readlength 150 151 dumpport.indent(4) do