sepafm 1.1.6 → 1.1.7

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: c038dcb77ca225b13580f7f01c23ecf58fc00e23
4
- data.tar.gz: aa11761b080c92183b185d997bb5c7e509e88171
3
+ metadata.gz: af34aff52da80e8a3c24f44f5728ab8c356189fb
4
+ data.tar.gz: 5b3a43610e7c900412e65fc83874d66bf6d132f2
5
5
  SHA512:
6
- metadata.gz: ea3ae75974fbbb309e959796d709dbf50209f03e8fe5d2b5d47b4028c08cd9dbecbeb2e0f835b84792ee5d71f43e16aae94b7ac69dbb09122c990cff6016435d
7
- data.tar.gz: ad964633e3b736ade71ee6a64222311167a47f5f0b7d5406ac06b1f0bfd3012a232e782e798d86d6fe9e14c30afa9f1df549ccc2a1310054735daed5e71ebe3b
6
+ metadata.gz: 912764345d7c6bb8758ff1fc31f378e01fe0737e99d221e97a6007dd7798291a2aaa538a688c245da875ca5f335bc73539232018cec6276344056161088d97cd
7
+ data.tar.gz: 3d9681d0485431280410fa30c6bdb3900c7390249e8c8378510da383dabecaab3bbe7cf3b15aefce9305ee9424a0ca35fe1e66b0a3f1f6d0fde3b00df985da5e
@@ -208,7 +208,7 @@ module Sepa
208
208
  # @return [String] the base64 encoded digest of the {#application_request}
209
209
  def calculate_digest
210
210
  sha1 = OpenSSL::Digest::SHA1.new
211
- encode(sha1.digest(@application_request.canonicalize))
211
+ encode(sha1.digest(@application_request.canonicalize(canonicalization_mode)))
212
212
  end
213
213
 
214
214
  # Adds value to signature node
@@ -231,7 +231,7 @@ module Sepa
231
231
  sha1 = OpenSSL::Digest::SHA1.new
232
232
  dsig = 'http://www.w3.org/2000/09/xmldsig#'
233
233
  node = @application_request.at_css("dsig|SignedInfo", 'dsig' => dsig)
234
- signature = @signing_private_key.sign(sha1, node.canonicalize)
234
+ signature = @signing_private_key.sign(sha1, node.canonicalize(canonicalization_mode))
235
235
  encode signature
236
236
  end
237
237
 
@@ -266,5 +266,11 @@ module Sepa
266
266
  target_id.content = @target_id
267
267
  @application_request.at(node).add_next_sibling target_id
268
268
  end
269
+
270
+ def canonicalization_mode
271
+ return Nokogiri::XML::XML_C14N_EXCLUSIVE_1_0 if @bank == :danske && @command == :renew_certificate
272
+
273
+ Nokogiri::XML::XML_C14N_1_0
274
+ end
269
275
  end
270
276
  end
data/lib/sepa/version.rb CHANGED
@@ -1,4 +1,9 @@
1
1
  module Sepa
2
2
  # The current version of the gem
3
- VERSION = "1.1.6".freeze
3
+ MAJOR = 1
4
+ MINOR = 1
5
+ TINY = 7
6
+ PRE = nil
7
+
8
+ VERSION = [MAJOR, MINOR, TINY, PRE].compact.join('.')
4
9
  end
@@ -18,12 +18,13 @@ class DanskeRenewCertApplicationRequestTest < ActiveSupport::TestCase
18
18
  end
19
19
 
20
20
  test 'signature is calculated correctly' do
21
- sha1 = OpenSSL::Digest::SHA1.new
22
- keys_path = File.expand_path('../keys', __FILE__)
23
- private_key = rsa_key(File.read("#{keys_path}/signing_key.pem"))
21
+ sha1 = OpenSSL::Digest::SHA1.new
22
+ keys_path = File.expand_path('../keys', __FILE__)
23
+ private_key = rsa_key(File.read("#{keys_path}/signing_key.pem"))
24
+ canonicalization_mode = Nokogiri::XML::XML_C14N_EXCLUSIVE_1_0
24
25
 
25
26
  signed_info_node = @doc.at("dsig|SignedInfo", dsig: 'http://www.w3.org/2000/09/xmldsig#')
26
- actual_signature = encode(private_key.sign(sha1, signed_info_node.canonicalize))
27
+ actual_signature = encode(private_key.sign(sha1, signed_info_node.canonicalize(canonicalization_mode)))
27
28
 
28
29
  calculated_signature = @doc.at("dsig|SignatureValue", dsig: 'http://www.w3.org/2000/09/xmldsig#').content
29
30
 
@@ -3,6 +3,6 @@ require 'test_helper'
3
3
  class TestSepa < ActiveSupport::TestCase
4
4
  test 'version is defined correctly' do
5
5
  refute_nil Sepa::VERSION
6
- assert_equal "1.1.6", Sepa::VERSION
6
+ assert_equal '1.1.7', Sepa::VERSION
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sepafm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.6
4
+ version: 1.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joni Kanerva
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-07-12 00:00:00.000000000 Z
13
+ date: 2016-07-25 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activemodel