xmldsig 0.4.1 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +2 -2
- data/lib/xmldsig.rb +9 -8
- data/lib/xmldsig/canonicalizer.rb +25 -13
- data/lib/xmldsig/version.rb +1 -1
- data/spec/lib/xmldsig_spec.rb +1 -1
- data/xmldsig.gemspec +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86696b5c6faa51b3c24f483af3a51eaf8bfc82cf
|
4
|
+
data.tar.gz: d79a464cae245bb59b63b1cc98e5664e7f8292d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba491cf35dd77d78c471fcb29871004cbd6fc1c02e08ede8a25db7bec3d21693f4f32a235d79a59a1b996310eda589f55a07755444fa8bf38dfcad68797be796
|
7
|
+
data.tar.gz: 1fbb14729b3d1ae1ab7d8ece83b874fdbe4e63e0d77e6bd8ba22cf9089f430c1e4416de770f84871aa827092b08a086f5c5985fb8809db9ccb61f0c2463547d3
|
data/.travis.yml
CHANGED
data/lib/xmldsig.rb
CHANGED
@@ -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
|
7
|
-
@method
|
8
|
+
@node = node
|
9
|
+
@method = method
|
8
10
|
@inclusive_namespaces = inclusive_namespaces
|
9
|
-
@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
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
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
|
data/lib/xmldsig/version.rb
CHANGED
data/spec/lib/xmldsig_spec.rb
CHANGED
@@ -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
|
data/xmldsig.gemspec
CHANGED
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
|
+
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-
|
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:
|
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:
|
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
|