xmldsig 0.4.1 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 23aefdcfb75c3ff59055a9751c19d5872f16819a
4
- data.tar.gz: 17ec48f80925f06c21759cd7c21407531d51811b
3
+ metadata.gz: 86696b5c6faa51b3c24f483af3a51eaf8bfc82cf
4
+ data.tar.gz: d79a464cae245bb59b63b1cc98e5664e7f8292d2
5
5
  SHA512:
6
- metadata.gz: fe51378403b39e0c55f729304816bba9b68108e98c4fa9d5fc7415ecf4d6a6860b58626cfb2c96c6f489b584d16859d0d2ec1a98ba6aaa3c25a3d35d25c6b47f
7
- data.tar.gz: bef5d4bebd40e3abcc5023f7f4e622d3d0a1a0cf9221e99212f9bd7f7cc5e4c9a09e06e62a5b18f638438d847e2b7351836e72c6ea81b24426acaa28af6733cc
6
+ metadata.gz: ba491cf35dd77d78c471fcb29871004cbd6fc1c02e08ede8a25db7bec3d21693f4f32a235d79a59a1b996310eda589f55a07755444fa8bf38dfcad68797be796
7
+ data.tar.gz: 1fbb14729b3d1ae1ab7d8ece83b874fdbe4e63e0d77e6bd8ba22cf9089f430c1e4416de770f84871aa827092b08a086f5c5985fb8809db9ccb61f0c2463547d3
@@ -1,4 +1,4 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.0.0
4
- - 1.9.3
3
+ - 2.3.0
4
+ - 2.2.4
@@ -2,14 +2,6 @@ require "nokogiri"
2
2
  require "openssl"
3
3
  require "base64"
4
4
  require "xmldsig/version"
5
- require "xmldsig/canonicalizer"
6
- require "xmldsig/signed_document"
7
- require "xmldsig/transforms/transform"
8
- require "xmldsig/transforms/canonicalize"
9
- require "xmldsig/transforms/enveloped_signature"
10
- require "xmldsig/transforms"
11
- require "xmldsig/reference"
12
- require "xmldsig/signature"
13
5
 
14
6
  module Xmldsig
15
7
  NAMESPACES = {
@@ -26,3 +18,12 @@ module Xmldsig
26
18
 
27
19
  XSD_FILE = File.read(File.expand_path('../xmldsig/xmldsig-core-schema.xsd', __FILE__))
28
20
  end
21
+
22
+ require "xmldsig/canonicalizer"
23
+ require "xmldsig/signed_document"
24
+ require "xmldsig/transforms/transform"
25
+ require "xmldsig/transforms/canonicalize"
26
+ require "xmldsig/transforms/enveloped_signature"
27
+ require "xmldsig/transforms"
28
+ require "xmldsig/reference"
29
+ require "xmldsig/signature"
@@ -1,12 +1,14 @@
1
1
  module Xmldsig
2
2
  class Canonicalizer
3
+ class UnsupportedException < Xmldsig::Error
4
+ end
3
5
  attr_accessor :node, :method, :inclusive_namespaces, :with_comments
4
6
 
5
7
  def initialize(node, method = nil, inclusive_namespaces = [], with_comments = false)
6
- @node = node
7
- @method = method
8
+ @node = node
9
+ @method = method
8
10
  @inclusive_namespaces = inclusive_namespaces
9
- @with_comments = with_comments
11
+ @with_comments = with_comments
10
12
  end
11
13
 
12
14
  def canonicalize
@@ -16,16 +18,26 @@ module Xmldsig
16
18
  private
17
19
 
18
20
  def mode(method)
19
- case method
20
- when "http://www.w3.org/2001/10/xml-exc-c14n#",
21
- "http://www.w3.org/2001/10/xml-exc-c14n#WithComments"
22
- Nokogiri::XML::XML_C14N_EXCLUSIVE_1_0
23
- when "http://www.w3.org/TR/2001/REC-xml-c14n-20010315"
24
- Nokogiri::XML::XML_C14N_1_0
25
- when "http://www.w3.org/2006/12/xml-c14n11"
26
- Nokogiri::XML::XML_C14N_1_1
27
- else
28
- Nokogiri::XML::XML_C14N_1_0
21
+ if RUBY_PLATFORM == "java"
22
+ case method
23
+ when "http://www.w3.org/2001/10/xml-exc-c14n#",
24
+ "http://www.w3.org/2001/10/xml-exc-c14n#WithComments"
25
+ Nokogiri::XML::XML_C14N_EXCLUSIVE_1_0
26
+ else
27
+ raise UnsupportedException.new("Canonicalizer method #{method} unsupported in JRuby")
28
+ end
29
+ else
30
+ case method
31
+ when "http://www.w3.org/2001/10/xml-exc-c14n#",
32
+ "http://www.w3.org/2001/10/xml-exc-c14n#WithComments"
33
+ Nokogiri::XML::XML_C14N_EXCLUSIVE_1_0
34
+ when "http://www.w3.org/TR/2001/REC-xml-c14n-20010315"
35
+ Nokogiri::XML::XML_C14N_1_0
36
+ when "http://www.w3.org/2006/12/xml-c14n11"
37
+ Nokogiri::XML::XML_C14N_1_1
38
+ else
39
+ Nokogiri::XML::XML_C14N_1_0
40
+ end
29
41
  end
30
42
  end
31
43
  end
@@ -1,3 +1,3 @@
1
1
  module Xmldsig
2
- VERSION = '0.4.1'
2
+ VERSION = '0.5.0'
3
3
  end
@@ -52,7 +52,7 @@ describe Xmldsig do
52
52
  let(:certificate) { OpenSSL::X509::Certificate.new(File.read('spec/fixtures/certificate.cer')) }
53
53
 
54
54
  it "raises schema error" do
55
- expect{ signed_document.validate(certificate) }.to raise_error(Xmldsig::SchemaError)
55
+ expect { signed_document.validate(certificate) }.to raise_error(Xmldsig::SchemaError)
56
56
  end
57
57
  end
58
58
  end
@@ -16,5 +16,5 @@ Gem::Specification.new do |gem|
16
16
  gem.require_paths = ["lib"]
17
17
  gem.version = Xmldsig::VERSION
18
18
 
19
- gem.add_dependency("nokogiri")
19
+ gem.add_dependency("nokogiri", '~> 1.6.8')
20
20
  end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xmldsig
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - benoist
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-23 00:00:00.000000000 Z
11
+ date: 2016-08-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: 1.6.8
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: 1.6.8
27
27
  description: This gem is a (partial) implementation of the XMLDsig specification
28
28
  email:
29
29
  - benoist.claassen@gmail.com