summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoro <o@immerda.ch>2011-06-26 00:03:56 +0200
committero <o@immerda.ch>2011-06-26 00:03:56 +0200
commit02d6f605f3738753c96ba6bf86c9f5b90216c9fe (patch)
tree02257460dca376df49da6b883b269387b0cb77c3
parented41e4a1c547bf8d72345d84c09d1eb8efaeecfe (diff)
parsing of private keys works aswell
-rw-r--r--lib/fpg/packets/secret_key.rb6
-rw-r--r--lib/fpg/packets/secret_subkey.rb6
-rw-r--r--lib/fpg/parse/secret_key.rb10
-rw-r--r--lib/fpg/parse/secret_subkey.rb10
-rw-r--r--spec/packet_parsing_spec.rb8
5 files changed, 40 insertions, 0 deletions
diff --git a/lib/fpg/packets/secret_key.rb b/lib/fpg/packets/secret_key.rb
new file mode 100644
index 0000000..3c61f25
--- /dev/null
+++ b/lib/fpg/packets/secret_key.rb
@@ -0,0 +1,6 @@
+module FPG
+ module Packets
+ class SecretKey < Packet
+ end
+ end
+end
diff --git a/lib/fpg/packets/secret_subkey.rb b/lib/fpg/packets/secret_subkey.rb
new file mode 100644
index 0000000..1230a3d
--- /dev/null
+++ b/lib/fpg/packets/secret_subkey.rb
@@ -0,0 +1,6 @@
+module FPG
+ module Packets
+ class SecretSubkey < Packet
+ end
+ end
+end
diff --git a/lib/fpg/parse/secret_key.rb b/lib/fpg/parse/secret_key.rb
new file mode 100644
index 0000000..48da670
--- /dev/null
+++ b/lib/fpg/parse/secret_key.rb
@@ -0,0 +1,10 @@
+module FPG
+ module Parse
+ module SecretKeyParser
+ include PacketParser
+ end
+ class SecretKey < Packets::SecretKey
+ include SecretKeyParser
+ end
+ end
+end
diff --git a/lib/fpg/parse/secret_subkey.rb b/lib/fpg/parse/secret_subkey.rb
new file mode 100644
index 0000000..46d7f97
--- /dev/null
+++ b/lib/fpg/parse/secret_subkey.rb
@@ -0,0 +1,10 @@
+module FPG
+ module Parse
+ module SecretSubkeyParser
+ include PacketParser
+ end
+ class SecretSubkey < Packets::SecretSubkey
+ include SecretSubkeyParser
+ end
+ end
+end
diff --git a/spec/packet_parsing_spec.rb b/spec/packet_parsing_spec.rb
index 2d7de61..8f68207 100644
--- a/spec/packet_parsing_spec.rb
+++ b/spec/packet_parsing_spec.rb
@@ -14,7 +14,15 @@ describe Parser do
parsed = Parser.parse(@binary_pub)
parsed.any?{|packet| packet.is_a? PublicKey}.should be_true
parsed.any?{|packet| packet.is_a? Signature}.should be_true
+ parsed.any?{|packet| packet.is_a? UserId}.should be_true
parsed.any?{|packet| packet.is_a? PublicSubkey}.should be_true
end
+ it "should find all the packets in a secretkey" do
+ parsed = Parser.parse(@binary_sec)
+ parsed.any?{|packet| packet.is_a? Signature}.should be_true
+ parsed.any?{|packet| packet.is_a? UserId}.should be_true
+ parsed.any?{|packet| packet.is_a? SecretSubkey}.should be_true
+ parsed.any?{|packet| packet.is_a? SecretKey}.should be_true
+ end
end