xml-kit 0.1.13 → 0.1.14

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
  SHA256:
3
- metadata.gz: 615ae2857058e5aa104aa0f80df141836e80e13003eb1c30da471dfc5ee410da
4
- data.tar.gz: 40b862ce037a71470178183c33785f40e6961d09585e377a550dab36fb36bfb6
3
+ metadata.gz: fa2eb376d5c11a9777e3a3a6073754c9783c73bdc24bbb45c7ac5877e3e99472
4
+ data.tar.gz: 6eb275d2a3791889c12a04a5e2b1143807bf4e1ac1968491f93ef32faeccd868
5
5
  SHA512:
6
- metadata.gz: 14da74d4beaa2b11110ea07defba33a3aa86b914cae24b1224c48f6e8422fff2edea915c9703da5cf3a346b5455e9b4ae5633dba7bab78499887268553f4d6a0
7
- data.tar.gz: 013471d06b583efa86198aeb0d337bb9c6740179c3e0b80594eebf68b73a359bd125ece382dd784a4aec28c41b26a8d9c6047e1789b8bc707acb12db63d72501
6
+ metadata.gz: 0447e7510327c68ee2f9f500b980d1d36255b044a3825dfd504245ea111eb367f998a0bc6a507d54e5f64472de76a2766460085c808b8ca380254fdbe12feaa0
7
+ data.tar.gz: 7f9c69571ddd52a638daf3b20062cc4b2d06cfd7cd83f6a517405330daddc8c8bb8d62fbd054b02ad8ad1eda6a9229ef0221f97d90b4d4ee3318420175eb3405
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/xml-kit.svg)](https://rubygems.org/gems/xml-kit)
4
4
  [![Code Climate](https://codeclimate.com/github/saml-kit/xml-kit.svg)](https://codeclimate.com/github/saml-kit/xml-kit)
5
- [![Build Status](https://travis-ci.org/saml-kit/xml-kit.svg)](https://travis-ci.org/saml-kit/xml-kit)
5
+ [![Build Status](https://travis-ci.org/saml-kit/xml-kit.svg?branch=master)](https://travis-ci.org/saml-kit/xml-kit)
6
6
  [![Security](https://hakiri.io/github/saml-kit/xml-kit/master.svg)](https://hakiri.io/github/saml-kit/xml-kit/master)
7
7
 
8
8
  Xml::Kit is a toolkit for working with XML. It supports adding [XML
@@ -4,9 +4,9 @@ module Xml
4
4
  module Kit
5
5
  # {include:file:spec/xml/certificate_spec.rb}
6
6
  class Certificate
7
- BASE64_FORMAT = %r(\A([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?\Z)
8
- BEGIN_CERT = /-----BEGIN CERTIFICATE-----/
9
- END_CERT = /-----END CERTIFICATE-----/
7
+ BASE64_FORMAT = %r(\A([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?\Z).freeze
8
+ BEGIN_CERT = /-----BEGIN CERTIFICATE-----/.freeze
9
+ END_CERT = /-----END CERTIFICATE-----/.freeze
10
10
  # The use can be `:signing` or `:encryption`. Use `nil` for both.
11
11
  attr_reader :use
12
12
 
@@ -29,6 +29,7 @@ module Xml
29
29
  # @return [Boolean] true or false.
30
30
  def for?(use)
31
31
  return true if self.use.nil?
32
+
32
33
  self.use == use.to_sym
33
34
  end
34
35
 
@@ -4,8 +4,9 @@ module Xml
4
4
  module Kit
5
5
  module Crypto
6
6
  class OaepCipher
7
+ ALGORITHM = "#{::Xml::Kit::Namespaces::XMLENC}rsa-oaep-mgf1p".freeze
7
8
  ALGORITHMS = {
8
- 'http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p' => true,
9
+ ALGORITHM => true
9
10
  }.freeze
10
11
  def initialize(_algorithm, key)
11
12
  @key = key
@@ -18,7 +18,8 @@ module Xml
18
18
  @symmetric_cipher_value = Base64.encode64(symmetric_cipher.encrypt(raw_xml)).delete("\n")
19
19
 
20
20
  @asymmetric_algorithm = asymmetric_algorithm
21
- @asymmetric_cipher_value = Base64.encode64(public_key.public_encrypt(symmetric_cipher.key)).delete("\n")
21
+ cipher = Crypto.cipher_for(asymmetric_algorithm, public_key)
22
+ @asymmetric_cipher_value = Base64.encode64(cipher.encrypt(symmetric_cipher.key)).delete("\n")
22
23
  end
23
24
 
24
25
  def to_xml(xml: ::Builder::XmlMarkup.new)
@@ -41,6 +41,7 @@ module Xml
41
41
 
42
42
  def signature_for(reference_id:, xml:)
43
43
  return unless sign?
44
+
44
45
  signatures.build(reference_id).to_xml(xml: xml)
45
46
  end
46
47
 
@@ -22,6 +22,7 @@ module Xml
22
22
 
23
23
  def template_path
24
24
  return target.template_path if target.respond_to?(:template_path)
25
+
25
26
  TEMPLATES_DIR.join(template_name)
26
27
  end
27
28
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Xml
4
4
  module Kit
5
- VERSION = '0.1.13'.freeze
5
+ VERSION = '0.1.14'.freeze
6
6
  end
7
7
  end
data/xml-kit.gemspec CHANGED
@@ -1,4 +1,3 @@
1
-
2
1
  # frozen_string_literal: true
3
2
 
4
3
  lib = File.expand_path('lib', __dir__)
@@ -27,7 +26,7 @@ Gem::Specification.new do |spec|
27
26
 
28
27
  spec.add_dependency 'activemodel', '>= 4.2.0'
29
28
  spec.add_dependency 'builder', '~> 3.2'
30
- spec.add_dependency 'nokogiri', '>= 1.8.2'
29
+ spec.add_dependency 'nokogiri', '>= 1.8.5'
31
30
  spec.add_dependency 'tilt', '>= 1.4.1'
32
31
  spec.add_dependency 'xmldsig', '~> 0.6'
33
32
  spec.add_development_dependency 'bundler', '~> 1.16'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xml-kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.13
4
+ version: 0.1.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - mo khan
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-03-07 00:00:00.000000000 Z
11
+ date: 2018-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: 1.8.2
47
+ version: 1.8.5
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: 1.8.2
54
+ version: 1.8.5
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: tilt
57
57
  requirement: !ruby/object:Gem::Requirement