epics 1.1.0 → 1.1.1

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: af6bf6d6425c258c08814fc2c1c3b9a3b3073123
4
- data.tar.gz: 1ee5bef16a6bf11f34f8aa60a79f3b11d8875122
3
+ metadata.gz: 063dc49eee1a69c5da9492fe57bfebad265b6b8c
4
+ data.tar.gz: 2a4ee56062ace723a77db89e8d6d0f740e746a13
5
5
  SHA512:
6
- metadata.gz: 1afc8a8f34f6cde89869f5a5c4a24b09ae3bcb111da63ef81f97823fc187fa67120f86b0343c54a8841f4c43654e7be27b44804ca87ed479f3c27f6666d5ca6b
7
- data.tar.gz: f57a864a565b4bd70731cde527052f5d17c6e304542f26a7937321e7045136ca53424287c082e132d870df0158c73cee4696873fd8fb815bfc90ac30549d9f32
6
+ metadata.gz: d95094a67c27c63c46cbbc406bdb9951ed03a187b933a3feddb5378feaaeebeddac1c727344247af71cb8fe7495c18938ec0d7d288765d9a2e7a7cd7a7603f31
7
+ data.tar.gz: 12d39c6a553e7e21ccae83680f93abd8fb4c5aed789f25c15c20acbbf1806c3d58407a97ef55392b8fe7e21f3703cbe64031de0a9ab1faa4ef79852c5e942dc8
@@ -1,3 +1,9 @@
1
+ ### 1.1.1
2
+
3
+ * [BUGFIX] CCT order was submited as CD1
4
+ * [BUGFIX] padding was calculated against the wrong block size
5
+ * [BUGFIX] double encoding of the signature
6
+
1
7
  ### 1.1.0
2
8
 
3
9
  * [BUGFIX] Sending `Receipts` after downloading data, to circumvent download locks
@@ -14,7 +14,7 @@ class Epics::CCT < Epics::GenericUploadRequest
14
14
  :content! => "EPICS - a ruby ebics kernel"
15
15
  },
16
16
  "OrderDetails" => {
17
- "OrderType" => "CD1",
17
+ "OrderType" => "CCT",
18
18
  "OrderAttribute" => "OZHNN",
19
19
  "StandardOrderParams/" => ""
20
20
  },
@@ -52,10 +52,11 @@ class Epics::GenericUploadRequest < Epics::GenericRequest
52
52
  end
53
53
 
54
54
  def signature_value
55
- Base64.encode64(client.a.sign( digester.digest(document.gsub(/\n|\r/, "")) )).gsub(/\n/, "")
55
+ client.a.sign( digester.digest(document.gsub(/\n|\r/, "")) )
56
56
  end
57
57
 
58
58
  def encrypt(d)
59
+ cipher.reset
59
60
  cipher.encrypt
60
61
  cipher.padding = 0
61
62
  cipher.key = self.key
@@ -75,14 +76,11 @@ class Epics::GenericUploadRequest < Epics::GenericRequest
75
76
  end
76
77
 
77
78
  def pad(d)
78
- if d.size % 32 == 0
79
- return d
80
- else
81
- len = 32*((d.size / 32)+1)
82
- padded = d.ljust(len, "\x01")
83
- padded[-1] = ["#{len - d.size}".rjust(2, "0")].pack("*H")
84
- padded
85
- end
79
+ len = cipher.block_size*((d.size / cipher.block_size)+1)
80
+ padded = d.ljust(len, [0].pack("C*"))
81
+ padded[-1] = [len - d.size].pack("C*")
82
+
83
+ padded
86
84
  end
87
85
 
88
86
  end
@@ -1,3 +1,3 @@
1
1
  module Epics
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.1"
3
3
  end
@@ -0,0 +1,37 @@
1
+ RSpec.describe Epics::GenericUploadRequest do
2
+ let(:client) { Epics::Client.new( File.open(File.join( File.dirname(__FILE__), 'fixtures', 'SIZBN001.key')), 'secret' , 'https://194.180.18.30/ebicsweb/ebicsweb', 'SIZBN001', 'EBIX', 'EBICS') }
3
+ subject { described_class.new(client, "\x01" * 12) }
4
+
5
+ describe '#pad' do
6
+
7
+ it 'will complete the block to the next 16byte' do
8
+ expect(subject.pad("\x01" * 13).size).to eq(16)
9
+ end
10
+
11
+ it 'will pad a complete block if the size is a multiple of 16' do
12
+ expect(subject.pad("\x01" * 16).size).to eq(32)
13
+ end
14
+
15
+ it 'will set the last byte to the padding length' do
16
+ expect(subject.pad("\x01" * 13)[-1]).to eq([3].pack("C*"))
17
+ end
18
+ end
19
+
20
+ describe '#signature_value' do
21
+ before { allow(OpenSSL::Random).to receive(:random_bytes).and_return(Base64.strict_decode64("7wtROfiX4tyN60cygJUSsHkhzxX1RVJa8vGNYnflvKc=")) }
22
+
23
+ it 'will be the signed document' do
24
+ expect(subject.signature_value).to eq("BQBMyxGHYoAbbmbMJRFbGrvUNinY15+qeeRLF708VL+tuENnbJMO6xHLWxU1rksOnu4xDzxfua9b3IxIaxLyTTFDuVi6bbu3sBslhIt2frdigo0xBL14KUJQ/pYiMj+2pfNYhtVxzamrnvgPSLNAEn36JykK2d347chT87HlZ7CAGNBS7lJHAzRP1v7Hkc+kKttkkWCpOGk06R6FUCxxVKXmQketMEl/scsMyJ3JtBe/EcjEZdDe5WcqZYUu5ARrfEiAeyutVRZnu17c3nKwkmWl7UqFAwp16cS8IPNL4i5FGCytgKl/kyaoxaE/P1lrGOkHcCTsSR0bAbARhndfdQ==")
25
+ end
26
+ end
27
+
28
+ describe '#order_signature' do
29
+ before { allow(subject).to receive(:signature_value).and_return("FOOBAR") }
30
+ let(:signature) { Nokogiri::XML(subject.order_signature) }
31
+
32
+ it 'contains the untouched signature_value ' do
33
+ expect(signature.at_xpath('//xmlns:SignatureValue').text).to eq("FOOBAR")
34
+ end
35
+
36
+ end
37
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: epics
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lars Brillert
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-29 00:00:00.000000000 Z
11
+ date: 2014-10-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -214,6 +214,7 @@ files:
214
214
  - spec/fixtures/xml/sta_response.xml
215
215
  - spec/fixtures/xml/sta_response_continued.xml
216
216
  - spec/fixtures/xml/upload_init_response.xml
217
+ - spec/generic_upload_spec.rb
217
218
  - spec/hpb_spec.rb
218
219
  - spec/key_spec.rb
219
220
  - spec/mgf_spec.rb
@@ -301,6 +302,7 @@ test_files:
301
302
  - spec/fixtures/xml/sta_response.xml
302
303
  - spec/fixtures/xml/sta_response_continued.xml
303
304
  - spec/fixtures/xml/upload_init_response.xml
305
+ - spec/generic_upload_spec.rb
304
306
  - spec/hpb_spec.rb
305
307
  - spec/key_spec.rb
306
308
  - spec/mgf_spec.rb