xmldsig-fiscalizer 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +19 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +4 -0
  5. data/CHANGELOG.md +4 -0
  6. data/Gemfile +12 -0
  7. data/Guardfile +24 -0
  8. data/LICENSE +22 -0
  9. data/README.md +80 -0
  10. data/Rakefile +10 -0
  11. data/lib/xmldsig.rb +20 -0
  12. data/lib/xmldsig/canonicalizer.rb +30 -0
  13. data/lib/xmldsig/reference.rb +80 -0
  14. data/lib/xmldsig/signature.rb +93 -0
  15. data/lib/xmldsig/signed_document.rb +26 -0
  16. data/lib/xmldsig/transforms.rb +26 -0
  17. data/lib/xmldsig/transforms/canonicalize.rb +25 -0
  18. data/lib/xmldsig/transforms/enveloped_signature.rb +10 -0
  19. data/lib/xmldsig/transforms/transform.rb +18 -0
  20. data/lib/xmldsig/version.rb +3 -0
  21. data/signing_service.rb +133 -0
  22. data/spec/fixtures/certificate.cer +16 -0
  23. data/spec/fixtures/certificate2.cer +16 -0
  24. data/spec/fixtures/key.pem +15 -0
  25. data/spec/fixtures/signed.xml +23 -0
  26. data/spec/fixtures/signed/ideal.cert +18 -0
  27. data/spec/fixtures/signed/ideal.txt +41 -0
  28. data/spec/fixtures/unsigned.xml +21 -0
  29. data/spec/fixtures/unsigned/canonicalizer_1_0.xml +19 -0
  30. data/spec/fixtures/unsigned/canonicalizer_1_1.xml +19 -0
  31. data/spec/fixtures/unsigned/canonicalizer_exc.xml +21 -0
  32. data/spec/fixtures/unsigned/digest_sha1.xml +21 -0
  33. data/spec/fixtures/unsigned/with_soap_envelope.xml +33 -0
  34. data/spec/fixtures/unsigned/without_canonicalization.xml +18 -0
  35. data/spec/fixtures/unsigned/without_namespace_prefix.xml +19 -0
  36. data/spec/fixtures/unsigned/without_reference_uri.xml +21 -0
  37. data/spec/fixtures/unsigned_multiple_references.xml +38 -0
  38. data/spec/fixtures/unsigned_nested_signature.xml +40 -0
  39. data/spec/lib/xmldsig/reference_spec.rb +65 -0
  40. data/spec/lib/xmldsig/signature_spec.rb +100 -0
  41. data/spec/lib/xmldsig/signed_document_spec.rb +94 -0
  42. data/spec/lib/xmldsig/transforms/enveloped_signature_spec.rb +18 -0
  43. data/spec/lib/xmldsig/transforms/transform_spec.rb +10 -0
  44. data/spec/lib/xmldsig_spec.rb +47 -0
  45. data/spec/spec_helper.rb +22 -0
  46. data/xmldsig.gemspec +20 -0
  47. metadata +127 -0
@@ -0,0 +1,26 @@
1
+ module Xmldsig
2
+ class Transforms < Array
3
+
4
+ def apply(node)
5
+ @node = node
6
+ each do |transform_node|
7
+ @node = get_transform(@node, transform_node).transform
8
+ end
9
+ @node
10
+ end
11
+
12
+ private
13
+
14
+ def get_transform(node, transform_node)
15
+ case transform_node.get_attribute("Algorithm")
16
+ when "http://www.w3.org/2000/09/xmldsig#enveloped-signature"
17
+ Transforms::EnvelopedSignature.new(node, transform_node)
18
+ when "http://www.w3.org/2001/10/xml-exc-c14n#",
19
+ "http://www.w3.org/TR/2001/REC-xml-c14n-20010315",
20
+ "http://www.w3.org/2006/12/xml-c14n11"
21
+ Transforms::Canonicalize.new(node, transform_node)
22
+ end
23
+ end
24
+
25
+ end
26
+ end
@@ -0,0 +1,25 @@
1
+ module Xmldsig
2
+ class Transforms < Array
3
+ class Canonicalize < Transform
4
+ def transform
5
+ self.node = Canonicalizer.new(node, algorithm, inclusive_namespaces).canonicalize
6
+ node
7
+ end
8
+
9
+ private
10
+
11
+ def algorithm
12
+ transform_node.get_attribute("Algorithm")
13
+ end
14
+
15
+ def inclusive_namespaces
16
+ inclusive_namespaces = transform_node.at_xpath("descendant::ec:InclusiveNamespaces", Xmldsig::NAMESPACES)
17
+ if inclusive_namespaces && inclusive_namespaces.has_attribute?("PrefixList")
18
+ inclusive_namespaces.get_attribute("PrefixList").to_s.split(" ")
19
+ else
20
+ []
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,10 @@
1
+ module Xmldsig
2
+ class Transforms < Array
3
+ class EnvelopedSignature < Transform
4
+ def transform
5
+ node.xpath("descendant::ds:Signature", Xmldsig::NAMESPACES).first.remove
6
+ node
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,18 @@
1
+ module Xmldsig
2
+ class Transforms < Array
3
+ class Transform
4
+
5
+ attr_accessor :node, :transform_node
6
+
7
+ def initialize(node, transform_node)
8
+ @node = node
9
+ @transform_node = transform_node
10
+ end
11
+
12
+ def transform
13
+ warn("Transform called but not implemented!")
14
+ self
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,3 @@
1
+ module Xmldsig
2
+ VERSION = '0.2.4'
3
+ end
@@ -0,0 +1,133 @@
1
+ require 'base64'
2
+
3
+ class SigningService
4
+
5
+ class << self
6
+ def create_redirect_params(xml, relay_state = "")
7
+ relay_state = relay_state ? "&RelayState=#{CGI.escape(relay_state)}" : ""
8
+
9
+ encoded_xml = Saml::Encoding.to_http_redirect_binding_param(xml)
10
+ response_params = "SAMLResponse=#{encoded_xml}#{relay_state}&SigAlg=#{CGI.escape('http://www.w3.org/2000/09/xmldsig#rsa-sha1')}"
11
+ signature = CGI.escape(sign_params(:params => response_params, :private_key => Saml::Config.private_key))
12
+
13
+ "#{response_params}&Signature=#{signature}"
14
+ end
15
+
16
+ def parse_signature_params(query)
17
+ params = {}
18
+ query.split(/[&;]/).each do |pairs|
19
+ key, value = pairs.split('=',2)
20
+ params[key] = value
21
+ end
22
+
23
+ relay_state = params["RelayState"] ? "&RelayState=#{params['RelayState']}" : ""
24
+ "SAMLRequest=#{params['SAMLRequest']}#{relay_state}&SigAlg=#{params['SigAlg']}"
25
+ end
26
+
27
+ def sign_params(options={})
28
+ key = OpenSSL::PKey::RSA.new options[:private_key]
29
+ Base64.encode64(key.sign(OpenSSL::Digest::SHA1.new, options[:params])).gsub("\n", '')
30
+ end
31
+
32
+ def verify_params(options={})
33
+ cert = OpenSSL::X509::Certificate.new(options[:cert_pem])
34
+ key = OpenSSL::PKey::RSA.new cert.public_key
35
+ key.verify(OpenSSL::Digest::SHA1.new, Base64.decode64(options[:signature]), parse_signature_params(options[:query_string]))
36
+ end
37
+
38
+ def sign!(xml, options={})
39
+ raise "Missing :id_attr option" if options[:id_attr].nil?
40
+ in_tmp_dir do
41
+ options[:private_key_path] = create_tmp_file(options[:private_key])
42
+ xml_file_path = create_tmp_file xml
43
+ command = sign_command(xml_file_path, options)
44
+ result, exitstatus = run command
45
+ if exitstatus == 0
46
+ result
47
+ else
48
+ run sign_command(xml_file_path, options.merge(:debug => true))
49
+ raise "unable to sign xml: #{command}\ngot error #{exitstatus}:\n#{result}"
50
+ end
51
+ end
52
+ end
53
+
54
+ # You can add --pubkey rsapub.pem or --trusted rootcert.pem to check that signature
55
+ # is actually valid. See http://www.aleksey.com/pipermail/xmlsec/2003/001120.html
56
+ def verify_signature!(xml, options={})
57
+ in_tmp_dir do
58
+ if options[:id_attr].blank?
59
+ raise "Missing :id_attr option"
60
+ end
61
+ if options[:cert_pem].blank?
62
+ raise "Missing :cert_pem option"
63
+ else
64
+ options[:cert_path] = create_tmp_file(options[:cert_pem])
65
+ end
66
+ command = verify_command(create_tmp_file(xml), options)
67
+ result, exitstatus = run command
68
+ if (exitstatus) != 0
69
+ raise "unable to validate xml signature: #{command}\ngot error #{exitstatus}:\n#{result}"
70
+ end
71
+ result
72
+ end
73
+ end
74
+ end
75
+
76
+ def self.logger
77
+ @logger ||= Logger.new('test.log')
78
+ end
79
+
80
+ private #------------------------------------------------------------------------------
81
+
82
+ class << self
83
+ def in_tmp_dir
84
+ Dir.mktmpdir do |dir|
85
+ Dir.chdir(dir) do
86
+ yield
87
+ end
88
+ end
89
+ end
90
+
91
+ def create_tmp_file contents
92
+ file_path = "signing_tmp_#{Time.now.to_f}_#{::SecureRandom.hex}"
93
+ File.open(file_path, 'w+') do |f|
94
+ f.puts contents.to_s.strip
95
+ end
96
+ file_path
97
+ end
98
+
99
+ def run command
100
+ result = `#{command}`
101
+ exitstatus = $?.exitstatus
102
+ if exitstatus != 0
103
+ logger.error "Got exitstatus '#{exitstatus}' when running #{command}:\n#{result}"
104
+ end
105
+ [result, exitstatus]
106
+ end
107
+
108
+ def sign_command(xml_file_path, options)
109
+ command = xml_sec_command
110
+ command << " --sign "
111
+ command << " --print-debug " if options[:debug]
112
+ command << " --id-attr:#{options[:id_attr]} " if options[:id_attr]
113
+ command << " --enabled-reference-uris empty,same-doc,local "
114
+ command << " --privkey-pem #{options[:private_key_path]} " if options[:private_key_path]
115
+ command << " #{xml_file_path}"
116
+ command
117
+ end
118
+
119
+ def verify_command(xml_file_path, options)
120
+ command = xml_sec_command
121
+ command << " --verify "
122
+ command << " --print-debug " if options[:debug]
123
+ command << " --id-attr:#{options[:id_attr]} " if options[:id_attr]
124
+ command << " --enabled-reference-uris empty,same-doc,local "
125
+ command << " --pubkey-cert-pem #{options[:cert_path]}" if options[:cert_path]
126
+ command << " #{xml_file_path} 2>&1"
127
+ end
128
+
129
+ def xml_sec_command
130
+ "xmlsec1"
131
+ end
132
+ end
133
+ end
@@ -0,0 +1,16 @@
1
+ -----BEGIN CERTIFICATE-----
2
+ MIICgjCCAeugAwIBAgIBADANBgkqhkiG9w0BAQUFADA6MQswCQYDVQQGEwJCRTEN
3
+ MAsGA1UECgwEVGVzdDENMAsGA1UECwwEVGVzdDENMAsGA1UEAwwEVGVzdDAeFw0x
4
+ MzAxMTMxNTMzNDNaFw0xNDAxMTMxNTMzNDNaMDoxCzAJBgNVBAYTAkJFMQ0wCwYD
5
+ VQQKDARUZXN0MQ0wCwYDVQQLDARUZXN0MQ0wCwYDVQQDDARUZXN0MIGfMA0GCSqG
6
+ SIb3DQEBAQUAA4GNADCBiQKBgQC37C0mhTmdr8iVfQPQuOKtzG/fhwG4ILuUX1Vk
7
+ 5uN9oSZJxhb5Kn8aBppny1BSekgk12wn4AE/6i7Jfix3SZWoqdaxpdDalvQSdNey
8
+ n6GmV2oP4lzp6XjXmtRxvO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GZKEUCQHPaomOmqzdBceVCKE3lr5AjtbUP
11
+ Mbwgi6TrhkCmmXadxE3tp/dZotNqrNtn7Pvw9Z+ZhCVdg5arZzx6n0rPxIECQDFZ
12
+ oBUj1FOgXhkKCKrmBrsvipsHkN22+Mw971alJDxYtFkZpkhItnVvW6kUOKGuI35b
13
+ gJdBrJ8TieymDulnA/UCQGfl27mqPX4JTzN+RiZHqGyGSzBi1ggH3vsI2oXDQZ7k
14
+ uOAPiLSBR83eeHGkE2C5fn0QfQGgFNDFjC/6Su/Wvt4=
15
+ -----END RSA PRIVATE KEY-----
@@ -0,0 +1,23 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <foo:Foo xmlns:foo="http://example.com/foo#" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#" ID="foo">
3
+ <foo:Bar>bar</foo:Bar>
4
+ <ds:Signature>
5
+ <ds:SignedInfo>
6
+ <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
7
+ <ds:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/>
8
+ <ds:Reference URI="#foo">
9
+ <ds:Transforms>
10
+ <ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
11
+ <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
12
+ <ec:InclusiveNamespaces PrefixList="foo"/>
13
+ </ds:Transform>
14
+ </ds:Transforms>
15
+ <ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
16
+ <ds:DigestValue>ftoSYFdze1AWgGHF5N9i9SFKThXkqH2AdyzA3/epbJw=</ds:DigestValue>
17
+ </ds:Reference>
18
+ </ds:SignedInfo>
19
+ <ds:SignatureValue>E3yyqsSoxRkhYEuaEtR+SLg85gU5B4a7xUXA+d2Zn6j7F6z73dOd8iYHOusB
20
+ Ty3C/3ujbmPhHKg8uX9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mlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#">
3
+ <foo:Bar>bar</foo:Bar>
4
+ <ds:Signature>
5
+ <ds:SignedInfo>
6
+ <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
7
+ <ds:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/>
8
+ <ds:Reference URI="#foo">
9
+ <ds:Transforms>
10
+ <ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
11
+ <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
12
+ <ec:InclusiveNamespaces PrefixList="foo"/>
13
+ </ds:Transform>
14
+ </ds:Transforms>
15
+ <ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
16
+ <ds:DigestValue></ds:DigestValue>
17
+ </ds:Reference>
18
+ </ds:SignedInfo>
19
+ <ds:SignatureValue></ds:SignatureValue>
20
+ </ds:Signature>
21
+ </foo:Foo>
@@ -0,0 +1,19 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <foo:Foo ID="foo" xmlns:foo="http://example.com/foo#" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#">
3
+ <foo:Bar>bar</foo:Bar>
4
+ <ds:Signature>
5
+ <ds:SignedInfo>
6
+ <ds:CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
7
+ <ds:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/>
8
+ <ds:Reference URI="#foo">
9
+ <ds:Transforms>
10
+ <ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
11
+ <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
12
+ </ds:Transforms>
13
+ <ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
14
+ <ds:DigestValue></ds:DigestValue>
15
+ </ds:Reference>
16
+ </ds:SignedInfo>
17
+ <ds:SignatureValue></ds:SignatureValue>
18
+ </ds:Signature>
19
+ </foo:Foo>
@@ -0,0 +1,19 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <foo:Foo ID="foo" xmlns:foo="http://example.com/foo#" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#">
3
+ <foo:Bar>bar</foo:Bar>
4
+ <ds:Signature>
5
+ <ds:SignedInfo>
6
+ <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2006/12/xml-c14n11"/>
7
+ <ds:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/>
8
+ <ds:Reference URI="#foo">
9
+ <ds:Transforms>
10
+ <ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
11
+ <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
12
+ </ds:Transforms>
13
+ <ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
14
+ <ds:DigestValue></ds:DigestValue>
15
+ </ds:Reference>
16
+ </ds:SignedInfo>
17
+ <ds:SignatureValue></ds:SignatureValue>
18
+ </ds:Signature>
19
+ </foo:Foo>
@@ -0,0 +1,21 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <foo:Foo ID="foo" xmlns:foo="http://example.com/foo#" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#">
3
+ <foo:Bar>bar</foo:Bar>
4
+ <ds:Signature>
5
+ <ds:SignedInfo>
6
+ <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
7
+ <ds:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/>
8
+ <ds:Reference URI="#foo">
9
+ <ds:Transforms>
10
+ <ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
11
+ <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
12
+ <ec:InclusiveNamespaces PrefixList="foo"/>
13
+ </ds:Transform>
14
+ </ds:Transforms>
15
+ <ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
16
+ <ds:DigestValue></ds:DigestValue>
17
+ </ds:Reference>
18
+ </ds:SignedInfo>
19
+ <ds:SignatureValue></ds:SignatureValue>
20
+ </ds:Signature>
21
+ </foo:Foo>