openssl-ccm 1.2.1 → 1.2.2

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
- SHA1:
3
- metadata.gz: b6f0af03a51c9201108d1ac8e3335fc67349b44c
4
- data.tar.gz: 245686e9bcc444b25d34add352339b05dbe3c434
2
+ SHA256:
3
+ metadata.gz: 94f0f2ac744cac26cf3f3fe5ec47b676d656d0a3d57eaef6ac5af2e5aceade69
4
+ data.tar.gz: 0c5e4bee394768df4c0d7f88edd4c297513e420c8bfb2dd10f4ddbe885fa552f
5
5
  SHA512:
6
- metadata.gz: 14757372cb7d6b005da6a604d5c8e2a8c029f05e53314c68f20770eaaf37522570ff7e115741bc5f2ccb0c3334c1312746892718aba460ba4025cc6ba594b4cd
7
- data.tar.gz: b4a17e4e98d8ffae82f625a478b4312421523254e8f5d7b08d4ce79a361276e8a71a796f241c42f3966adbf7d4111813e680f31cc3adc988a00e4fe2274ae85a
6
+ metadata.gz: 3ec73e24140d4702b6a5debd39d5ef77dd1815d9c5a9bccc586350474ddbe971f02727261deb1fe320596662847cd2598b08ac652ce8b42c279bbeceb67df5fb
7
+ data.tar.gz: f6e5f8c3a7380b21cab77f9ca1af26635c9564fc4f0b05df7b4b537bad6b96e9d4bb622efd796d9708d2dd1119891c7e6fb84bd6d423795fe41fa3b54ee9d24a
data/Gemfile CHANGED
@@ -1,8 +1,8 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'rake', '>=10.4.2'
4
- gem 'rdoc', '>=4.2.0'
5
- gem 'yard', '>=0.8.7.6'
6
- gem 'rubocop', '>=0.34.2'
7
- gem 'test-unit', '>=3.1.4'
8
- gem 'coveralls', '>=0.8.2'
3
+ gem 'rake', '>=12.3.2'
4
+ gem 'rdoc', '>=4.3.0'
5
+ gem 'yard', '>=0.9.16'
6
+ gem 'rubocop', '>=0.50.0'
7
+ gem 'test-unit', '>=3.2.9'
8
+ gem 'coveralls', '>=0.8.22'
@@ -21,10 +21,7 @@ module OpenSSL
21
21
  #
22
22
  # @return [[String]] supported algorithms
23
23
  def self.ciphers
24
- l = OpenSSL::Cipher.ciphers.keep_if { |c| c.end_with?('-128-CBC') or
25
- c.end_with?('-192-CBC') or c.end_with?('-256-CBC') }
26
- l.length.times { |i| l[i] = l[i][0..-9] }
27
- l
24
+ @ciphers ||= OpenSSL::Cipher.ciphers.select { |c| c.match(/-(128|192|256)-CBC$/i) }.map { |e| e[0..-9].upcase }.uniq
28
25
  end
29
26
 
30
27
  public
@@ -38,7 +35,7 @@ module OpenSSL
38
35
  #
39
36
  # @return [Object] the new CCM object
40
37
  def initialize(cipher, key, mac_len)
41
- unless CCM.ciphers.include?(cipher)
38
+ unless CCM.ciphers.include?(cipher.upcase)
42
39
  fail CCMError, "unsupported cipher algorithm (#{cipher})"
43
40
  end
44
41
  fail CCMError, 'invalid key length' unless key.b.length >= 16
@@ -54,7 +51,7 @@ module OpenSSL
54
51
  cipher_key_size = "256"
55
52
  end
56
53
 
57
- @cipher = OpenSSL::Cipher.new("#{cipher}-" + cipher_key_size + "-CBC")
54
+ @cipher = OpenSSL::Cipher.new("#{cipher.upcase}-" + cipher_key_size + "-CBC")
58
55
  @key = key
59
56
  @mac_len = mac_len
60
57
  end
@@ -1,5 +1,5 @@
1
1
  module OpenSSL
2
2
  class CCM
3
- VERSION = '1.2.1'
3
+ VERSION = '1.2.2'
4
4
  end
5
5
  end
@@ -281,16 +281,19 @@ class CCMTest < Test::Unit::TestCase
281
281
  mac_len = [16, 8, 14, 8]
282
282
 
283
283
  assert(OpenSSL::CCM.ciphers.include?('AES'), 'Missing AES-Cipher')
284
- 1.upto(3) do |i|
285
- open("test/data_#{i}", mode = 'r') do |i_file|
286
- input = i_file.read
287
- key.length.times do |j|
288
- open("test/data_#{i}-#{j + 1}_e", mode = 'r') do |o_file|
289
- output = o_file.read
290
- ccm = OpenSSL::CCM.new('AES', [key[j]].pack('H*'), mac_len[j])
291
- c = ccm.encrypt(input, [nonce[j]].pack('H*'))
292
- assert_equal(output.unpack('H*'), c.unpack('H*'),
293
- "Wrong ENCRYPT in Vector #{i + 1}")
284
+
285
+ for cipher in ['aes', 'AES']
286
+ 1.upto(3) do |i|
287
+ open("test/data_#{i}", mode = 'r') do |i_file|
288
+ input = i_file.read
289
+ key.length.times do |j|
290
+ open("test/data_#{i}-#{j + 1}_e", mode = 'r') do |o_file|
291
+ output = o_file.read
292
+ ccm = OpenSSL::CCM.new(cipher, [key[j]].pack('H*'), mac_len[j])
293
+ c = ccm.encrypt(input, [nonce[j]].pack('H*'))
294
+ assert_equal(output.unpack('H*'), c.unpack('H*'),
295
+ "Wrong ENCRYPT in Vector #{i + 1}")
296
+ end
294
297
  end
295
298
  end
296
299
  end
@@ -325,15 +328,17 @@ class CCMTest < Test::Unit::TestCase
325
328
  )
326
329
 
327
330
  assert(OpenSSL::CCM.ciphers.include?('AES'), 'Missing AES-Cipher')
328
- key.length.times do |i|
329
- mac_len = mac[i].length / 2
330
- ccm = OpenSSL::CCM.new('AES', [key[i]].pack('H*'), mac_len)
331
- c = ccm.encrypt([plaintext[i]].pack('H*'), [nonce[i]].pack('H*'))
332
- c_unpack = c.unpack('H*')
333
- assert_equal([mac[i]], c[-mac_len..-1].unpack('H*'),
334
- "Wrong MAC ENCRYPT in Test #{i} ")
335
- assert_equal([ciphertext[i]], c[0..-mac_len - 1].unpack('H*'),
336
- "Wrong ciphertext ENCRYPT in Test #{i}")
331
+
332
+ for cipher in ['aes', 'AES']
333
+ key.length.times do |i|
334
+ mac_len = mac[i].length / 2
335
+ ccm = OpenSSL::CCM.new(cipher, [key[i]].pack('H*'), mac_len)
336
+ c = ccm.encrypt([plaintext[i]].pack('H*'), [nonce[i]].pack('H*'))
337
+ assert_equal([mac[i]], c[-mac_len..-1].unpack('H*'),
338
+ "Wrong MAC ENCRYPT in Test #{i} ")
339
+ assert_equal([ciphertext[i]], c[0..-mac_len - 1].unpack('H*'),
340
+ "Wrong ciphertext ENCRYPT in Test #{i}")
341
+ end
337
342
  end
338
343
  end
339
344
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openssl-ccm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lars Schmertmann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-28 00:00:00.000000000 Z
11
+ date: 2019-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -16,100 +16,100 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '10.4'
19
+ version: '12.3'
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 10.4.2
22
+ version: 12.3.2
23
23
  type: :development
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - "~>"
28
28
  - !ruby/object:Gem::Version
29
- version: '10.4'
29
+ version: '12.3'
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 10.4.2
32
+ version: 12.3.2
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: rdoc
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '4.2'
39
+ version: '4.3'
40
40
  - - ">="
41
41
  - !ruby/object:Gem::Version
42
- version: 4.2.0
42
+ version: 4.3.0
43
43
  type: :development
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
46
46
  requirements:
47
47
  - - "~>"
48
48
  - !ruby/object:Gem::Version
49
- version: '4.2'
49
+ version: '4.3'
50
50
  - - ">="
51
51
  - !ruby/object:Gem::Version
52
- version: 4.2.0
52
+ version: 4.3.0
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: yard
55
55
  requirement: !ruby/object:Gem::Requirement
56
56
  requirements:
57
57
  - - "~>"
58
58
  - !ruby/object:Gem::Version
59
- version: '0.8'
59
+ version: '0.9'
60
60
  - - ">="
61
61
  - !ruby/object:Gem::Version
62
- version: 0.8.7.6
62
+ version: 0.9.16
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - "~>"
68
68
  - !ruby/object:Gem::Version
69
- version: '0.8'
69
+ version: '0.9'
70
70
  - - ">="
71
71
  - !ruby/object:Gem::Version
72
- version: 0.8.7.6
72
+ version: 0.9.16
73
73
  - !ruby/object:Gem::Dependency
74
74
  name: rubocop
75
75
  requirement: !ruby/object:Gem::Requirement
76
76
  requirements:
77
77
  - - "~>"
78
78
  - !ruby/object:Gem::Version
79
- version: '0.34'
79
+ version: '0.50'
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: 0.34.2
82
+ version: 0.50.0
83
83
  type: :development
84
84
  prerelease: false
85
85
  version_requirements: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '0.34'
89
+ version: '0.50'
90
90
  - - ">="
91
91
  - !ruby/object:Gem::Version
92
- version: 0.34.2
92
+ version: 0.50.0
93
93
  - !ruby/object:Gem::Dependency
94
94
  name: test-unit
95
95
  requirement: !ruby/object:Gem::Requirement
96
96
  requirements:
97
97
  - - "~>"
98
98
  - !ruby/object:Gem::Version
99
- version: '3.1'
99
+ version: '3.2'
100
100
  - - ">="
101
101
  - !ruby/object:Gem::Version
102
- version: 3.1.4
102
+ version: 3.2.9
103
103
  type: :development
104
104
  prerelease: false
105
105
  version_requirements: !ruby/object:Gem::Requirement
106
106
  requirements:
107
107
  - - "~>"
108
108
  - !ruby/object:Gem::Version
109
- version: '3.1'
109
+ version: '3.2'
110
110
  - - ">="
111
111
  - !ruby/object:Gem::Version
112
- version: 3.1.4
112
+ version: 3.2.9
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: coveralls
115
115
  requirement: !ruby/object:Gem::Requirement
@@ -119,7 +119,7 @@ dependencies:
119
119
  version: '0.8'
120
120
  - - ">="
121
121
  - !ruby/object:Gem::Version
122
- version: 0.8.2
122
+ version: 0.8.22
123
123
  type: :development
124
124
  prerelease: false
125
125
  version_requirements: !ruby/object:Gem::Requirement
@@ -129,7 +129,7 @@ dependencies:
129
129
  version: '0.8'
130
130
  - - ">="
131
131
  - !ruby/object:Gem::Version
132
- version: 0.8.2
132
+ version: 0.8.22
133
133
  description: Ruby Gem for RFC 3610 - Counter with CBC-MAC (CCM)
134
134
  email:
135
135
  - SmallLars@t-online.de
@@ -185,25 +185,24 @@ required_rubygems_version: !ruby/object:Gem::Requirement
185
185
  version: '0'
186
186
  requirements: []
187
187
  rubyforge_project:
188
- rubygems_version: 2.5.0
188
+ rubygems_version: 2.7.7
189
189
  signing_key:
190
190
  specification_version: 4
191
191
  summary: RFC 3610 - CCM
192
192
  test_files:
193
193
  - test/test_ccm.rb
194
- - test/data_1-4_e
195
- - test/data_3-1_e
196
194
  - test/data_3-2_e
197
- - test/data_1-2_e
198
- - test/data_1-1_e
199
- - test/data_2-2_e
200
195
  - test/data_3-4_e
201
- - test/data_2
202
- - test/data_1
196
+ - test/data_3-1_e
203
197
  - test/data_3
198
+ - test/data_1-2_e
204
199
  - test/data_2-4_e
205
- - test/data_3-3_e
200
+ - test/data_1-4_e
206
201
  - test/data_1-3_e
202
+ - test/data_2-2_e
207
203
  - test/data_2-3_e
204
+ - test/data_1
205
+ - test/data_2
206
+ - test/data_1-1_e
208
207
  - test/data_2-1_e
209
- has_rdoc:
208
+ - test/data_3-3_e