ipizza 2.0.0 → 2.0.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0d8d1718b8729dfa5e26d38c5bd91e6a3dc572e7
4
- data.tar.gz: 4dde7b36c532ea40fca0a4d9ea982bc828d0c90a
3
+ metadata.gz: 2d02b88f8dee566651de91c705c95c91e586d1de
4
+ data.tar.gz: 05caaaaa4d249c3ae8ffed1809cc6474254886ec
5
5
  SHA512:
6
- metadata.gz: 15b005e53850f6188f4721058da6db647015ac65e34be2707eb686dbcf953501e648a283a60d01b02b5b8cbc29838e7d5193f37442051cb741a88692f057802e
7
- data.tar.gz: 0c3ef956c1fa6611cd25971aadd8a4b96c4527a78e256bbec019e93f3a635c3bfe838181c573386eb5f767f5795c16b0415c900c1eedc9b12a51528763e7c98c
6
+ metadata.gz: c1ce76b70d0e5e1e8ba12fb81e37904649533f7afad1dddb8f3faf875491099595e1c835de1353a29fa490c10b579ff93a7420635e6a8aaae6b5cc4c4e9a9100
7
+ data.tar.gz: 7a482f0d83491fc29ef7aa8bdd39d1d35dbfd3b6744a6a01df35ae3616d31a683f4979bb777b7354435e8fd99e4836ac56beefedd871d3725f6c4a6c4bd76990
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ipizza (2.0.0)
4
+ ipizza (2.0.1)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
@@ -3,7 +3,7 @@ module Ipizza
3
3
 
4
4
  class << self
5
5
  def get(provider_name)
6
- case provider_name.downcase
6
+ case provider_name.to_s.downcase
7
7
  when 'lhv'
8
8
  Ipizza::Provider::Lhv.new
9
9
  when 'swedbank', 'hp'
@@ -16,8 +16,6 @@ module Ipizza
16
16
  Ipizza::Provider::Krediidipank.new
17
17
  when 'nordea'
18
18
  Ipizza::Provider::Nordea.new
19
- else
20
- Ipizza::Provider::Base.new
21
19
  end
22
20
  end
23
21
  end
@@ -77,7 +77,7 @@ module Ipizza::Provider
77
77
 
78
78
  def authentication_response(params)
79
79
  response = Ipizza::AuthenticationResponse.new(params)
80
- response.verify(self.class.file_cert, self.class.encoding)
80
+ response.verify(self.class.file_cert)
81
81
  response
82
82
  end
83
83
 
@@ -7,8 +7,12 @@ module Ipizza
7
7
  class << self
8
8
 
9
9
  def verify_signature(certificate_path, signature, data)
10
- certificate = OpenSSL::X509::Certificate.new(File.read(certificate_path).gsub(/ /, '')).public_key
11
- @valid = certificate.verify(OpenSSL::Digest::SHA1.new, Base64.decode64(signature), data)
10
+ if !certificate_path.to_s.empty? && !signature.to_s.empty? && File.file?(certificate_path)
11
+ certificate = OpenSSL::X509::Certificate.new(File.read(certificate_path).gsub(/ /, '')).public_key
12
+ certificate.verify(OpenSSL::Digest::SHA1.new, Base64.decode64(signature), data)
13
+ else
14
+ false
15
+ end
12
16
  end
13
17
 
14
18
  def sign(privkey_path, privkey_secret, data)
@@ -45,12 +49,12 @@ module Ipizza
45
49
  #
46
50
  # p(x1)||x1||p(x2)||x2||...||p(xn)||xn
47
51
  #
48
- # Where || is string concatenation, p(x) is length of the field x represented by three digits.
52
+ # Where || is string concatenation, p(x) is length of the (stripped) field x represented by three digits.
49
53
  #
50
54
  # Parameters val1, val2, value3 would be turned into "003val1003val2006value3".
51
55
  def mac_data_string(params, sign_param_order)
52
- sign_param_order.inject('') do |memo, param|
53
- val = params[param].to_s
56
+ (sign_param_order || []).inject('') do |memo, param|
57
+ val = params[param].to_s.strip
54
58
  memo << func_p(val) << val
55
59
  memo
56
60
  end
@@ -1,3 +1,3 @@
1
1
  module Ipizza
2
- VERSION = '2.0.0'
2
+ VERSION = '2.0.1'
3
3
  end
@@ -41,5 +41,9 @@ describe Ipizza::Provider do
41
41
  it 'returns nordea provider for "nordea" attribute' do
42
42
  Ipizza::Provider.get('nordea').should be_a(Ipizza::Provider::Nordea)
43
43
  end
44
+
45
+ it 'returns nothing for "unkn" attribute' do
46
+ Ipizza::Provider.get('unkn').should be_nil
47
+ end
44
48
  end
45
49
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ipizza
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Priit Haamer
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-02-03 00:00:00.000000000 Z
12
+ date: 2015-02-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec