xommelier 0.1.30 → 0.1.31
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 +7 -0
- data/README.md +1 -0
- data/config/giteaucrat.yml +5 -0
- data/lib/xommelier/atom/category.rb +7 -0
- data/lib/xommelier/atom/content.rb +7 -0
- data/lib/xommelier/atom/entry.rb +7 -0
- data/lib/xommelier/atom/feed.rb +7 -0
- data/lib/xommelier/atom/full.rb +7 -0
- data/lib/xommelier/atom/generator.rb +7 -0
- data/lib/xommelier/atom/history.rb +7 -0
- data/lib/xommelier/atom/link.rb +7 -0
- data/lib/xommelier/atom/links_extension.rb +7 -0
- data/lib/xommelier/atom/person.rb +7 -0
- data/lib/xommelier/atom/source.rb +7 -0
- data/lib/xommelier/atom/threading.rb +7 -0
- data/lib/xommelier/atom.rb +7 -0
- data/lib/xommelier/common.rb +7 -0
- data/lib/xommelier/core_ext/boolean.rb +8 -0
- data/lib/xommelier/core_ext/date.rb +7 -0
- data/lib/xommelier/core_ext/float.rb +7 -0
- data/lib/xommelier/core_ext/numeric.rb +7 -0
- data/lib/xommelier/core_ext/string.rb +7 -0
- data/lib/xommelier/core_ext/symbol.rb +7 -0
- data/lib/xommelier/core_ext/time.rb +7 -0
- data/lib/xommelier/core_ext/uri.rb +8 -0
- data/lib/xommelier/core_ext.rb +7 -0
- data/lib/xommelier/ds.rb +266 -0
- data/lib/xommelier/dsig11.rb +111 -0
- data/lib/xommelier/factory_girl.rb +24 -0
- data/lib/xommelier/open_search.rb +7 -0
- data/lib/xommelier/opml.rb +7 -0
- data/lib/xommelier/rss/atomic.rb +7 -0
- data/lib/xommelier/rss.rb +7 -0
- data/lib/xommelier/schemas/ds.xsd +318 -0
- data/lib/xommelier/schemas/dsig11.xsd +131 -0
- data/lib/xommelier/schemas/xmldsig1-schema.xsd +11 -0
- data/lib/xommelier/sitemap.rb +7 -0
- data/lib/xommelier/version.rb +8 -1
- data/lib/xommelier/xml/element/namespace.rb +7 -0
- data/lib/xommelier/xml/element/serialization.rb +7 -0
- data/lib/xommelier/xml/element/structure/property.rb +7 -0
- data/lib/xommelier/xml/element/structure.rb +7 -0
- data/lib/xommelier/xml/element.rb +7 -0
- data/lib/xommelier/xml/namespace.rb +8 -0
- data/lib/xommelier/xml/schema.rb +7 -0
- data/lib/xommelier/xml.rb +7 -0
- data/lib/xommelier.rb +9 -0
- data/spec/fixtures/ds_rsa.xml +58 -0
- data/spec/fixtures/nested_atom.xml +2 -6
- data/spec/functional/xommelier/atom/feed/building_hash_spec.rb +10 -4
- data/spec/functional/xommelier/atom/feed/building_spec.rb +7 -0
- data/spec/functional/xommelier/atom/feed/parsing_spec.rb +9 -7
- data/spec/functional/xommelier/atom/threading/building_spec.rb +7 -0
- data/spec/functional/xommelier/open_search/description/building_spec.rb +7 -0
- data/spec/functional/xommelier/open_search/description/parsing_spec.rb +7 -3
- data/spec/functional/xommelier/rss/rss/building_spec.rb +7 -0
- data/spec/functional/xommelier/rss/rss/parsing_spec.rb +8 -5
- data/spec/lib/xommelier/atom/entry_spec.rb +7 -0
- data/spec/lib/xommelier/ds_spec.rb +102 -0
- data/spec/lib/xommelier/rss/email_address_spec.rb +7 -0
- data/spec/lib/xommelier/xml/element/serialization_spec.rb +7 -0
- data/spec/lib/xommelier/xml/element/structure_spec.rb +7 -0
- data/spec/lib/xommelier/xml/element_spec.rb +7 -0
- data/spec/lib/xommelier/xml_spec.rb +7 -0
- data/spec/lib/xommelier_spec.rb +7 -0
- data/spec/namespaced_module.rb +7 -0
- data/spec/spec_helper.rb +7 -0
- data/spec/support/fixtures.rb +7 -0
- data/spec/support/schema_validatable.rb +7 -0
- data/xommelier.gemspec +1 -0
- metadata +32 -27
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 75bd4f6f2751ba556d0a35cefa150d5886511aae
|
|
4
|
+
data.tar.gz: ee0278a00499fa04929e81f056f89ff5a23846fa
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 8b6ef44e264d5267325647479dfffe5275f9238885eef222a2a3394567fa217a207e2efac00c7240cdbf89362524c05cc8c37b3cdcc3e38cb7f3f6a2973c8ce5
|
|
7
|
+
data.tar.gz: 999d6a89bce33c2729e146f40373af807f4b57a6d9e33b7e3274cbee943b63fc5335495e5d9331067a8b38ad9f85ff51c068356c54a2f005f343ebdb97943096
|
data/README.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
################################################
|
|
4
|
+
# © Alexander Semyonov, 2011—2013, MIT License #
|
|
5
|
+
# Author: Alexander Semyonov <al@semyonov.us> #
|
|
6
|
+
################################################
|
|
7
|
+
|
|
1
8
|
require 'xommelier/atom'
|
|
2
9
|
|
|
3
10
|
module Xommelier
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
################################################
|
|
4
|
+
# © Alexander Semyonov, 2011—2013, MIT License #
|
|
5
|
+
# Author: Alexander Semyonov <al@semyonov.us> #
|
|
6
|
+
################################################
|
|
7
|
+
|
|
1
8
|
require 'xommelier/atom'
|
|
2
9
|
|
|
3
10
|
module Xommelier
|
data/lib/xommelier/atom/entry.rb
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
################################################
|
|
4
|
+
# © Alexander Semyonov, 2011—2013, MIT License #
|
|
5
|
+
# Author: Alexander Semyonov <al@semyonov.us> #
|
|
6
|
+
################################################
|
|
7
|
+
|
|
1
8
|
require 'xommelier/atom'
|
|
2
9
|
|
|
3
10
|
module Xommelier
|
data/lib/xommelier/atom/feed.rb
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
################################################
|
|
4
|
+
# © Alexander Semyonov, 2011—2013, MIT License #
|
|
5
|
+
# Author: Alexander Semyonov <al@semyonov.us> #
|
|
6
|
+
################################################
|
|
7
|
+
|
|
1
8
|
require 'xommelier/atom'
|
|
2
9
|
|
|
3
10
|
module Xommelier
|
data/lib/xommelier/atom/full.rb
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
################################################
|
|
4
|
+
# © Alexander Semyonov, 2011—2013, MIT License #
|
|
5
|
+
# Author: Alexander Semyonov <al@semyonov.us> #
|
|
6
|
+
################################################
|
|
7
|
+
|
|
1
8
|
require 'xommelier/atom'
|
|
2
9
|
require 'xommelier/atom/threading'
|
|
3
10
|
require 'xommelier/atom/history'
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
################################################
|
|
4
|
+
# © Alexander Semyonov, 2011—2013, MIT License #
|
|
5
|
+
# Author: Alexander Semyonov <al@semyonov.us> #
|
|
6
|
+
################################################
|
|
7
|
+
|
|
1
8
|
require 'xommelier/atom'
|
|
2
9
|
|
|
3
10
|
module Xommelier
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
################################################
|
|
4
|
+
# © Alexander Semyonov, 2011—2013, MIT License #
|
|
5
|
+
# Author: Alexander Semyonov <al@semyonov.us> #
|
|
6
|
+
################################################
|
|
7
|
+
|
|
1
8
|
require 'xommelier/atom'
|
|
2
9
|
|
|
3
10
|
module Xommelier
|
data/lib/xommelier/atom/link.rb
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
################################################
|
|
4
|
+
# © Alexander Semyonov, 2011—2013, MIT License #
|
|
5
|
+
# Author: Alexander Semyonov <al@semyonov.us> #
|
|
6
|
+
################################################
|
|
7
|
+
|
|
1
8
|
require 'xommelier/atom'
|
|
2
9
|
|
|
3
10
|
module Xommelier
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
################################################
|
|
4
|
+
# © Alexander Semyonov, 2011—2013, MIT License #
|
|
5
|
+
# Author: Alexander Semyonov <al@semyonov.us> #
|
|
6
|
+
################################################
|
|
7
|
+
|
|
1
8
|
require 'xommelier/atom'
|
|
2
9
|
|
|
3
10
|
module Xommelier
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
################################################
|
|
4
|
+
# © Alexander Semyonov, 2011—2013, MIT License #
|
|
5
|
+
# Author: Alexander Semyonov <al@semyonov.us> #
|
|
6
|
+
################################################
|
|
7
|
+
|
|
1
8
|
require 'xommelier/atom'
|
|
2
9
|
|
|
3
10
|
module Xommelier
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
################################################
|
|
4
|
+
# © Alexander Semyonov, 2011—2013, MIT License #
|
|
5
|
+
# Author: Alexander Semyonov <al@semyonov.us> #
|
|
6
|
+
################################################
|
|
7
|
+
|
|
1
8
|
require 'xommelier/atom'
|
|
2
9
|
|
|
3
10
|
module Xommelier
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
################################################
|
|
4
|
+
# © Alexander Semyonov, 2011—2013, MIT License #
|
|
5
|
+
# Author: Alexander Semyonov <al@semyonov.us> #
|
|
6
|
+
################################################
|
|
7
|
+
|
|
1
8
|
require 'xommelier/atom'
|
|
2
9
|
|
|
3
10
|
module Xommelier
|
data/lib/xommelier/atom.rb
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
################################################
|
|
4
|
+
# © Alexander Semyonov, 2011—2013, MIT License #
|
|
5
|
+
# Author: Alexander Semyonov <al@semyonov.us> #
|
|
6
|
+
################################################
|
|
7
|
+
|
|
1
8
|
require 'xommelier/xml'
|
|
2
9
|
|
|
3
10
|
module Xommelier
|
data/lib/xommelier/common.rb
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
################################################
|
|
4
|
+
# © Alexander Semyonov, 2011—2013, MIT License #
|
|
5
|
+
# Author: Alexander Semyonov <al@semyonov.us> #
|
|
6
|
+
################################################
|
|
7
|
+
|
|
1
8
|
require 'xommelier'
|
|
2
9
|
|
|
3
10
|
module Xommelier
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
################################################
|
|
4
|
+
# © Alexander Semyonov, 2011—2013, MIT License #
|
|
5
|
+
# Authors: Alexander Semyonov <al@semyonov.us> #
|
|
6
|
+
# Artyom Semyonov <sevenov@gmail.com> #
|
|
7
|
+
################################################
|
|
8
|
+
|
|
1
9
|
require 'xommelier'
|
|
2
10
|
|
|
3
11
|
class Boolean
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
################################################
|
|
4
|
+
# © Alexander Semyonov, 2011—2013, MIT License #
|
|
5
|
+
# Author: Alexander Semyonov <al@semyonov.us> #
|
|
6
|
+
################################################
|
|
7
|
+
|
|
1
8
|
class Float
|
|
2
9
|
def self.from_xommelier(value)
|
|
3
10
|
return nil if value.blank?
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
################################################
|
|
4
|
+
# © Alexander Semyonov, 2011—2013, MIT License #
|
|
5
|
+
# Author: Alexander Semyonov <al@semyonov.us> #
|
|
6
|
+
################################################
|
|
7
|
+
|
|
1
8
|
class Numeric
|
|
2
9
|
def self.from_xommelier(value)
|
|
3
10
|
return nil if value.blank?
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
################################################
|
|
4
|
+
# © Alexander Semyonov, 2011—2013, MIT License #
|
|
5
|
+
# Author: Alexander Semyonov <al@semyonov.us> #
|
|
6
|
+
################################################
|
|
7
|
+
|
|
1
8
|
class String
|
|
2
9
|
def self.from_xommelier(value)
|
|
3
10
|
return nil if value.is_a?(NilClass)
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
################################################
|
|
4
|
+
# © Alexander Semyonov, 2011—2013, MIT License #
|
|
5
|
+
# Author: Alexander Semyonov <al@semyonov.us> #
|
|
6
|
+
################################################
|
|
7
|
+
|
|
1
8
|
class Symbol
|
|
2
9
|
def self.from_xommelier(value)
|
|
3
10
|
value.to_sym
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
################################################
|
|
4
|
+
# © Alexander Semyonov, 2011—2013, MIT License #
|
|
5
|
+
# Author: Alexander Semyonov <al@semyonov.us> #
|
|
6
|
+
################################################
|
|
7
|
+
|
|
8
|
+
require 'xommelier'
|
|
1
9
|
require 'xommelier/core_ext/string'
|
|
2
10
|
require 'uri'
|
|
3
11
|
|
data/lib/xommelier/core_ext.rb
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
################################################
|
|
4
|
+
# © Alexander Semyonov, 2011—2013, MIT License #
|
|
5
|
+
# Author: Alexander Semyonov <al@semyonov.us> #
|
|
6
|
+
################################################
|
|
7
|
+
|
|
1
8
|
require 'xommelier'
|
|
2
9
|
|
|
3
10
|
require 'xommelier/core_ext/boolean'
|
data/lib/xommelier/ds.rb
ADDED
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
################################################
|
|
4
|
+
# © Alexander Semyonov, 2011—2013, MIT License #
|
|
5
|
+
# Author: Alexander Semyonov <al@semyonov.us> #
|
|
6
|
+
################################################
|
|
7
|
+
|
|
8
|
+
require 'xommelier'
|
|
9
|
+
require 'base64'
|
|
10
|
+
require 'delegate'
|
|
11
|
+
|
|
12
|
+
module Xommelier
|
|
13
|
+
module DS
|
|
14
|
+
include Xommelier::Xml
|
|
15
|
+
|
|
16
|
+
xmlns 'http://www.w3.org/2000/09/xmldsig#', as: :ds
|
|
17
|
+
schema
|
|
18
|
+
|
|
19
|
+
class CryptoBinary < DelegateClass(String)
|
|
20
|
+
def self.from_xommelier(value)
|
|
21
|
+
return unless value
|
|
22
|
+
case value
|
|
23
|
+
when %r(\A[a-zA-Z0-9+/]={0,2}\Z)
|
|
24
|
+
new Base64.decode64(value)
|
|
25
|
+
when String
|
|
26
|
+
new value
|
|
27
|
+
else
|
|
28
|
+
new value.to_s
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def inspect
|
|
33
|
+
%(#<#{self.class.name} "#{to_s}">)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def raw
|
|
37
|
+
__getobj__
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def to_s
|
|
41
|
+
to_xommelier.to_s
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def to_xommelier
|
|
45
|
+
Base64.encode64(raw)
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
class Element < Xml::Element
|
|
50
|
+
def self.find_element_name
|
|
51
|
+
name.demodulize
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# Defines containing attribute
|
|
55
|
+
def self.attribute(name, options = {})
|
|
56
|
+
options[:as] ||= name.to_s.camelcase
|
|
57
|
+
super(name, options)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def self.any!(options = {})
|
|
61
|
+
# TODO implement <any /> logic
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def self.choice!(options = {})
|
|
65
|
+
# TODO implement <choice /> logic
|
|
66
|
+
may do
|
|
67
|
+
yield
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def self.sequence!(options = {})
|
|
72
|
+
# TODO implement <choice /> logic
|
|
73
|
+
yield
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def self.has_algorithm(map = {})
|
|
77
|
+
attribute :algorithm, type: Uri, required: true
|
|
78
|
+
|
|
79
|
+
const_set(:ALGORITHMS, map)
|
|
80
|
+
map.each do |name, algorithm|
|
|
81
|
+
define_singleton_method("new_#{name}") do |options = {}|
|
|
82
|
+
new(options.merge(algorithm: algorithm))
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
define_method(:algorithm_name) do
|
|
87
|
+
map.key(algorithm.to_s)
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
class SignatureValue < Element
|
|
93
|
+
attribute :id, optional: true
|
|
94
|
+
|
|
95
|
+
text
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
class CanonicalizationMethod < Element
|
|
99
|
+
any! ns: :any, count: :any
|
|
100
|
+
has_algorithm(
|
|
101
|
+
omit_comments: 'http://www.w3.org/TR/2001/REC-xml-c14n-20010315',
|
|
102
|
+
with_comments: 'http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments'
|
|
103
|
+
)
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
class SignatureMethod < Element
|
|
107
|
+
element :hmac_output_length, as: 'HMACOutputLength', type: Integer, count: :may
|
|
108
|
+
any! ns: :other, count: :any
|
|
109
|
+
has_algorithm(
|
|
110
|
+
rsa_sha1: 'http://www.w3.org/2000/09/xmldsig#rsa-sha1',
|
|
111
|
+
dsa_sha1: 'http://www.w3.org/2000/09/xmldsig#dsa-sha1'
|
|
112
|
+
)
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
class Transform < Element
|
|
116
|
+
choice! count: :any do
|
|
117
|
+
any! ns: :other
|
|
118
|
+
element :xpath, as: 'XPath'
|
|
119
|
+
end
|
|
120
|
+
has_algorithm(
|
|
121
|
+
xslt: 'http://www.w3.org/TR/1999/REC-xslt-19991116',
|
|
122
|
+
xpath: 'http://www.w3.org/TR/1999/REC-xpath-19991116',
|
|
123
|
+
enveloped_signature: 'http://www.w3.org/2000/09/xmldsig#enveloped-signature'
|
|
124
|
+
)
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
class Transforms < Element
|
|
128
|
+
element ref: Transform, count: :many
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
class DigestMethod < Element
|
|
132
|
+
any! ns: :other, count: :any
|
|
133
|
+
has_algorithm(
|
|
134
|
+
sha1: 'http://www.w3.org/2000/09/xmldsig#sha1'
|
|
135
|
+
)
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
class Reference < Element
|
|
139
|
+
element ref: Transforms, count: :may
|
|
140
|
+
element ref: DigestMethod
|
|
141
|
+
element :digest_value, as: 'DigestValue'
|
|
142
|
+
attribute :id, optional: true
|
|
143
|
+
attribute :uri, as: 'URI', type: Uri, optional: true
|
|
144
|
+
attribute :type, type: Uri, optional: true
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
class SignedInfo < Element
|
|
148
|
+
element ref: CanonicalizationMethod
|
|
149
|
+
element ref: SignatureMethod
|
|
150
|
+
element ref: Reference, count: :many
|
|
151
|
+
attribute :id, optional: true
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
class DSAKeyValue < Element
|
|
155
|
+
sequence! count: :may do
|
|
156
|
+
element :p, as: 'P', type: CryptoBinary
|
|
157
|
+
element :q, as: 'Q', type: CryptoBinary
|
|
158
|
+
end
|
|
159
|
+
element :g, as: 'G', type: CryptoBinary, count: :may
|
|
160
|
+
element :y, as: 'Y', type: CryptoBinary
|
|
161
|
+
element :j, as: 'J', type: CryptoBinary, count: :may
|
|
162
|
+
sequence! count: :may do
|
|
163
|
+
element :seed, as: 'Seed', type: CryptoBinary
|
|
164
|
+
element :pgen_counter, as: 'PgenCounter', type: CryptoBinary
|
|
165
|
+
end
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
class RSAKeyValue < Element
|
|
169
|
+
sequence! do
|
|
170
|
+
element :modulus, as: 'Modulus', type: CryptoBinary
|
|
171
|
+
element :exponent, as: 'Exponent', type: CryptoBinary
|
|
172
|
+
end
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
class KeyValue < Element
|
|
176
|
+
choice! do
|
|
177
|
+
element ref: DSAKeyValue
|
|
178
|
+
element ref: RSAKeyValue
|
|
179
|
+
any! ns: :other
|
|
180
|
+
end
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
class RetrievalMethod < Element
|
|
184
|
+
element ref: Transforms, count: :any
|
|
185
|
+
attribute :uri, as: 'URI', type: URI
|
|
186
|
+
attribute :type, type: URI, optional: true
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
class X509IssuerSerial < Element
|
|
190
|
+
element :issuer_name, as: 'X509IssuerName'
|
|
191
|
+
element :serial_number, as: 'X509SerialNumber', type: Integer
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
class X509Data < Element
|
|
195
|
+
sequence! count: :many do
|
|
196
|
+
choice! do
|
|
197
|
+
element :issuer_serial, type: X509IssuerSerial
|
|
198
|
+
element :ski, as: 'X509SKI'
|
|
199
|
+
element :subject_name, as: 'X509SubjectName'
|
|
200
|
+
element :certificate, as: 'X509Certificate'
|
|
201
|
+
element :crl, as: 'X509CRL'
|
|
202
|
+
any! ns: :other
|
|
203
|
+
end
|
|
204
|
+
end
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
class PGPData < Element
|
|
208
|
+
element :key_id, as: 'PGPKeyID', count: :may
|
|
209
|
+
element :key_packet, as: 'PGPKeyPacket', count: :may
|
|
210
|
+
any! ns: :other, count: :any
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
class SPKIData < Element
|
|
214
|
+
element :sexp, as: 'SPKISexp'
|
|
215
|
+
any! ns: :other, count: :may
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
class KeyInfo < Element
|
|
219
|
+
choice! count: :many do
|
|
220
|
+
element :key_name, as: 'KeyName'
|
|
221
|
+
element ref: KeyValue
|
|
222
|
+
element ref: RetrievalMethod
|
|
223
|
+
element ref: X509Data
|
|
224
|
+
element ref: PGPData
|
|
225
|
+
element ref: SPKIData
|
|
226
|
+
element :mgmt_data, as: 'MgmtData'
|
|
227
|
+
any! ns: :other
|
|
228
|
+
end
|
|
229
|
+
attribute :id, optional: true
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
class Manifest < Element
|
|
233
|
+
element ref: Reference, count: :many
|
|
234
|
+
attribute :id, optional: true
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
class SignatureProperty < Element
|
|
238
|
+
choice! do
|
|
239
|
+
any! ns: :other
|
|
240
|
+
end
|
|
241
|
+
attribute :target, type: Uri, optional: true
|
|
242
|
+
attribute :id, optional: true
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
class SignatureProperties < Element
|
|
246
|
+
element ref: SignatureProperty, count: :many
|
|
247
|
+
attribute :id, optional: true
|
|
248
|
+
end
|
|
249
|
+
|
|
250
|
+
class Object < Element
|
|
251
|
+
any! ns: :any, count: :any
|
|
252
|
+
attribute :id, optional: true
|
|
253
|
+
attribute :mime_type, optional: true
|
|
254
|
+
attribute :encoding, type: Uri, optional: true
|
|
255
|
+
end
|
|
256
|
+
|
|
257
|
+
class Signature < Element
|
|
258
|
+
element ref: SignedInfo
|
|
259
|
+
element ref: SignatureValue
|
|
260
|
+
element ref: KeyInfo, count: :may
|
|
261
|
+
element ref: Object, count: :any
|
|
262
|
+
|
|
263
|
+
attribute :id, optional: true
|
|
264
|
+
end
|
|
265
|
+
end
|
|
266
|
+
end
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
################################################
|
|
4
|
+
# © Alexander Semyonov, 2011—2013, MIT License #
|
|
5
|
+
# Author: Alexander Semyonov <al@semyonov.us> #
|
|
6
|
+
################################################
|
|
7
|
+
|
|
8
|
+
require 'xommelier'
|
|
9
|
+
require 'xommelier/ds'
|
|
10
|
+
|
|
11
|
+
module Xommelier
|
|
12
|
+
module DSIG11
|
|
13
|
+
include Xommelier::Xml
|
|
14
|
+
|
|
15
|
+
xmlns 'http://www.w3.org/2009/xmldsig11#', as: :dsig11
|
|
16
|
+
schema
|
|
17
|
+
|
|
18
|
+
class ECPointType < DS::CryptoBinary
|
|
19
|
+
def self.from_xommelier(value)
|
|
20
|
+
return unless value
|
|
21
|
+
case value
|
|
22
|
+
when DS::CryptoBinary
|
|
23
|
+
new(value.raw)
|
|
24
|
+
else
|
|
25
|
+
new(DS::CryptoBinary.from_xommelier(value))
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
class Element < Xommelier::DS::Element
|
|
31
|
+
xmlns DSIG11.xmlns
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
class NamedCurve < Element
|
|
35
|
+
attribute :uri, as: 'URI', required: true
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
class Curve < Element
|
|
39
|
+
element :a, as: 'A', type: DS::CryptoBinary
|
|
40
|
+
element :b, as: 'B', type: DS::CryptoBinary
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
class Prime < Element
|
|
44
|
+
element :p, as: 'P', type: DS::CryptoBinary
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
class GnB < Element
|
|
48
|
+
element :m, as: 'M', type: Integer # positiveInteger
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
class TnB < GnB
|
|
52
|
+
element :k, as: 'K', type: Integer # positiveInteger
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
class PnB < GnB
|
|
56
|
+
element :k1, as: 'K1', type: Integer # positiveInteger
|
|
57
|
+
element :k2, as: 'K2', type: Integer # positiveInteger
|
|
58
|
+
element :k3, as: 'K3', type: Integer # positiveInteger
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
class FieldID < Element
|
|
62
|
+
choice! do
|
|
63
|
+
element ref: Prime
|
|
64
|
+
element ref: TnB
|
|
65
|
+
element ref: PnB
|
|
66
|
+
element ref: GnB
|
|
67
|
+
any! ns: :other
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
class ValidationData < Element
|
|
72
|
+
element :seed, type: DS::CryptoBinary
|
|
73
|
+
attribute :hash_algorithm, type: Uri, required: true
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
class ECParameters < Element
|
|
77
|
+
element ref: FieldID
|
|
78
|
+
element ref: Curve
|
|
79
|
+
element :base, as: 'Base', type: ECPointType
|
|
80
|
+
element :order, as: 'Order', type: DS::CryptoBinary
|
|
81
|
+
element :co_factor, as: 'CoFactor', type: Integer, count: :may
|
|
82
|
+
element ref: ValidationData, count: :may
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
class ECKeyValue < Element
|
|
86
|
+
choice! do
|
|
87
|
+
element ref: ECParameters
|
|
88
|
+
element ref: NamedCurve
|
|
89
|
+
end
|
|
90
|
+
element :public_key, as: 'PublicKey', type: ECPointType
|
|
91
|
+
attribute :id, optional: true
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
class DEREncodedKeyValue < Element
|
|
95
|
+
text
|
|
96
|
+
attribute :id, optional: true
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
class KeyInfoReference < Element
|
|
100
|
+
attribute :uri, as: 'URI', type: URI, required: true
|
|
101
|
+
attribute :id, type: URI, optional: true
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
class X509Digest < Element
|
|
105
|
+
text
|
|
106
|
+
has_algorithm(
|
|
107
|
+
|
|
108
|
+
)
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
end
|