openssl-ccm 1.1.0 → 1.1.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: 92a532b59b054ccfe21e829d38c498d8ba7bfd89
4
- data.tar.gz: 3dce973fb8819b77169e896a3aaeb73854d0f074
3
+ metadata.gz: 6fc374df85e53e6b883aa37e73c3ef794663aa1a
4
+ data.tar.gz: c91598781b107b3ded956bd29c80ebf898434bad
5
5
  SHA512:
6
- metadata.gz: 65a1cb1f4da10606b442551fbec24981c508ce7466b203e931d692e4bfc90e474e15d3e99a24ca0f805efa122d9ccc2ec477b108fa05ceaade01305202d3f198
7
- data.tar.gz: a05d1e9b346e0ed7487d3972da57257b91741de4ab8f453f09cd2c0c51099e62c4118933f9689a53ba5dc97a2ac2acf6f9c55f84f71067563892f481d111be2c
6
+ metadata.gz: 5421f2e254f941baf00785b8846781231dc66ac8cf6e5f02098fbed9734d5ab982dbfd69e9405c684b5eacda234232af1bdb6a2c140d38b884a749fb44087b25
7
+ data.tar.gz: 0256e2da4fc6da7f86663730d92643cbfbc8304c25ccd4996146eee0bd5d1184177a0a64a0b47c7dab640e31e2c2ed1c9b7196ffe7390a675279e94a4ffe5623
data/.rubocop.yml ADDED
@@ -0,0 +1,12 @@
1
+
2
+ ClassLength:
3
+ Max: 256
4
+
5
+ MethodLength:
6
+ Max: 32
7
+
8
+ CyclomaticComplexity:
9
+ Max: 8
10
+
11
+ Documentation:
12
+ Enabled: false
data/.yardopts ADDED
@@ -0,0 +1,4 @@
1
+ --no-private
2
+ --protected
3
+ lib/**/**/*.rb -
4
+ LICENSE
data/Gemfile CHANGED
@@ -1,5 +1,7 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
+ gem 'rake', '>=10.2.2'
3
4
  gem 'rdoc', '>=4.1.1'
4
5
  gem 'yard', '>=0.8.7.3'
5
6
  gem 'rubocop', '>=0.18.1'
7
+ gem 'coveralls', '>=00.7.0'
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2014 Lars Schmertmann
3
+ Copyright (c) 2014, Lars Schmertmann <SmallLars@t-online.de>
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -1,8 +1,13 @@
1
- # openssl-ccm
1
+ [![Gem Version](https://badge.fury.io/rb/openssl-ccm.png)](http://badge.fury.io/rb/openssl-ccm)
2
+ [![Dependency Status](https://gemnasium.com/SmallLars/openssl-ccm.png)](https://gemnasium.com/SmallLars/openssl-ccm)
3
+ [![Build Status](https://travis-ci.org/SmallLars/openssl-ccm.png?branch=master)](https://travis-ci.org/SmallLars/openssl-ccm)
4
+ [![Coverage Status](https://coveralls.io/repos/SmallLars/openssl-ccm/badge.png?branch=master)](https://coveralls.io/r/SmallLars/openssl-ccm)
5
+ [![Code Climate](https://codeclimate.com/github/SmallLars/openssl-ccm.png)](https://codeclimate.com/github/SmallLars/openssl-ccm)
6
+ [![Inline docs](http://inch-pages.github.io/github/smalllars/openssl-ccm.png)](http://inch-pages.github.io/github/smalllars/openssl-ccm)
2
7
 
3
- Ruby Gem for RFC 3610 - Counter with CBC-MAC (CCM)
8
+ # openssl-ccm
4
9
 
5
- Abstract from tools.ietf.org/html/rfc3610: Counter with CBC-MAC (CCM) is a generic authenticated encryption block cipher mode. CCM is defined for use with 128-bit block ciphers, such as the Advanced Encryption Standard (AES).
10
+ Ruby Gem for [RFC 3610 - Counter with CBC-MAC (CCM)](http://tools.ietf.org/html/rfc3610)
6
11
 
7
12
  ## Installation
8
13
 
@@ -23,11 +28,8 @@ Or install it yourself as:
23
28
  Example:
24
29
 
25
30
  require 'openssl/ccm'
26
-
27
31
  ccm = OpenSSL::CCM.new('AES', 'My16Byte LongKey', 8)
28
-
29
32
  ciphertext = ccm.encrypt('The message to encrypt', 'The nonce')
30
-
31
33
  plaintext = ccm.decrypt(ciphertext, 'The nonce')
32
34
 
33
35
  After initialisation, you can use the object as often you need.
data/Rakefile CHANGED
@@ -18,8 +18,9 @@ end
18
18
  desc "Uninstall and clean documentation"
19
19
  task :clean do
20
20
  sh "gem uninstall openssl-ccm"
21
- begin; sh "rm -R ./.yardoc"; rescue; end
22
- begin; sh "rm -R ./doc"; rescue; end
21
+ begin; sh "rm -R ./coverage"; rescue; end
22
+ begin; sh "rm -R ./.yardoc"; rescue; end
23
+ begin; sh "rm -R ./doc"; rescue; end
23
24
  end
24
25
 
25
26
  desc "Development Dependencies"
@@ -1,5 +1,5 @@
1
1
  module OpenSSL
2
2
  class CCM
3
- VERSION = '1.1.0'
3
+ VERSION = '1.1.1'
4
4
  end
5
5
  end
data/test/test_ccm.rb CHANGED
@@ -1,3 +1,5 @@
1
+ require 'coveralls'
2
+ Coveralls.wear!
1
3
  require 'test/unit'
2
4
  require 'openssl/ccm'
3
5
 
@@ -262,4 +264,36 @@ class CCMTest < Test::Unit::TestCase
262
264
  "Wrong ENCRYPT in Vector #{i + 1}")
263
265
  end
264
266
  end
267
+
268
+ def test_aes_data
269
+ key = %W(
270
+ 00000000000000000000000000000000
271
+ 001234567890ABCDEFDCAFFEED3921EE
272
+ 001234567890ABCDEFDCAFFEED3921EE
273
+ 11223344AABB00000000000000000000
274
+ )
275
+ nonce = %W(
276
+ 00000000000000000000000000
277
+ 00112233445566778899
278
+ 001122334455667788990000
279
+ 00112233445566778899
280
+ )
281
+ mac_len = [16, 8, 14, 8]
282
+
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}")
294
+ end
295
+ end
296
+ end
297
+ end
298
+ end
265
299
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openssl-ccm
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 Schmertmann
@@ -10,6 +10,26 @@ bindir: bin
10
10
  cert_chain: []
11
11
  date: 2014-04-01 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '10.2'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 10.2.2
23
+ type: :development
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '10.2'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 10.2.2
13
33
  - !ruby/object:Gem::Dependency
14
34
  name: rdoc
15
35
  requirement: !ruby/object:Gem::Requirement
@@ -70,6 +90,26 @@ dependencies:
70
90
  - - ">="
71
91
  - !ruby/object:Gem::Version
72
92
  version: 0.18.1
93
+ - !ruby/object:Gem::Dependency
94
+ name: coveralls
95
+ requirement: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - "~>"
98
+ - !ruby/object:Gem::Version
99
+ version: '0.7'
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: 0.7.0
103
+ type: :development
104
+ prerelease: false
105
+ version_requirements: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: '0.7'
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: 0.7.0
73
113
  description: Ruby Gem for RFC 3610 - Counter with CBC-MAC (CCM)
74
114
  email:
75
115
  - SmallLars@t-online.de
@@ -79,6 +119,8 @@ extra_rdoc_files:
79
119
  - README.md
80
120
  - LICENSE
81
121
  files:
122
+ - ".rubocop.yml"
123
+ - ".yardopts"
82
124
  - Gemfile
83
125
  - LICENSE
84
126
  - README.md
@@ -101,8 +143,7 @@ files:
101
143
  - test/data_3-3_e
102
144
  - test/data_3-4_e
103
145
  - test/test_ccm.rb
104
- - test/test_ccm_data.rb
105
- homepage: ''
146
+ homepage: https://github.com/smalllars/openssl-ccm
106
147
  licenses:
107
148
  - MIT
108
149
  metadata: {}
@@ -130,7 +171,6 @@ specification_version: 4
130
171
  summary: RFC 3610 - CCM
131
172
  test_files:
132
173
  - test/test_ccm.rb
133
- - test/test_ccm_data.rb
134
174
  - test/data_1-3_e
135
175
  - test/data_1-1_e
136
176
  - test/data_3
@@ -1,37 +0,0 @@
1
- require 'test/unit'
2
- require 'openssl/ccm'
3
-
4
- # Additional tests
5
- class CCMFilesTest < Test::Unit::TestCase
6
- KEY = %W(
7
- 00000000000000000000000000000000
8
- 001234567890ABCDEFDCAFFEED3921EE
9
- 001234567890ABCDEFDCAFFEED3921EE
10
- 11223344AABB00000000000000000000
11
- )
12
- NONCE = %W(
13
- 00000000000000000000000000
14
- 00112233445566778899
15
- 001122334455667788990000
16
- 00112233445566778899
17
- )
18
- MAC_LEN = [16, 8, 14, 8]
19
-
20
- def test_aes
21
- assert(OpenSSL::CCM.ciphers.include?('AES'), 'Missing AES-Cipher')
22
- 1.upto(3) do |i|
23
- open("test/data_#{i}", mode = 'r') do |i_file|
24
- input = i_file.read
25
- KEY.length.times do |j|
26
- open("test/data_#{i}-#{j + 1}_e", mode = 'r') do |o_file|
27
- output = o_file.read
28
- ccm = OpenSSL::CCM.new('AES', [KEY[j]].pack('H*'), MAC_LEN[j])
29
- c = ccm.encrypt(input, [NONCE[j]].pack('H*'))
30
- assert_equal(output.unpack('H*'), c.unpack('H*'),
31
- "Wrong ENCRYPT in Vector #{i + 1}")
32
- end
33
- end
34
- end
35
- end
36
- end
37
- end