Skip to content

Commit

Permalink
Improved Documentation. Added readme badges.
Browse files Browse the repository at this point in the history
  • Loading branch information
Lars Schmertmann committed Apr 3, 2014
1 parent bb4b74d commit ea35a42
Show file tree
Hide file tree
Showing 15 changed files with 104 additions and 53 deletions.
18 changes: 18 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
*.gem
*.rbc
.bundle
.config
coverage
InstalledFiles
lib/bundler/man
pkg
rdoc
spec/reports
test/tmp
test/version_tmp
tmp

# YARD artifacts
.yardoc
_yardoc
doc/
8 changes: 4 additions & 4 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@

ClassLength:
Max: 500
Max: 256

MethodLength:
Max: 64
Max: 32

CyclomaticComplexity:
Max: 32
Max: 8

BlockComments:
Documentation:
Enabled: false
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
language: ruby
rvm:
- 2.1.0
script:
- "bundle exec rake"
- "bundle exec rake test"
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
source 'https://rubygems.org'

gem 'rake', '>=10.2.2'
gem 'rdoc', '>=4.1.1'
gem 'yard', '>=0.8.7.3'
gem 'rubocop', '>=0.18.1'
gem 'coveralls', '>=00.7.0'
23 changes: 23 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,51 @@ GEM
remote: https://rubygems.org/
specs:
ast (1.1.0)
coveralls (0.7.0)
multi_json (~> 1.3)
rest-client
simplecov (>= 0.7)
term-ansicolor
thor
docile (1.1.3)
json (1.8.1)
mime-types (2.2)
multi_json (1.9.2)
parser (2.1.7)
ast (~> 1.1)
slop (~> 3.4, >= 3.4.5)
powerpack (0.0.9)
rainbow (2.0.0)
rake (10.2.2)
rdoc (4.1.1)
json (~> 1.4)
rest-client (1.6.7)
mime-types (>= 1.16)
rubocop (0.19.1)
json (>= 1.7.7, < 2)
parser (~> 2.1.7)
powerpack (~> 0.0.6)
rainbow (>= 1.99.1, < 3.0)
ruby-progressbar (~> 1.4)
ruby-progressbar (1.4.2)
simplecov (0.8.2)
docile (~> 1.1.0)
multi_json
simplecov-html (~> 0.8.0)
simplecov-html (0.8.0)
slop (3.5.0)
term-ansicolor (1.3.0)
tins (~> 1.0)
thor (0.19.1)
tins (1.0.1)
yard (0.8.7.4)

PLATFORMS
ruby

DEPENDENCIES
coveralls (>= 00.7.0)
rake (>= 10.2.2)
rdoc (>= 4.1.1)
rubocop (>= 0.18.1)
yard (>= 0.8.7.3)
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2014 Lars Schmertmann
Copyright (c) 2014, Lars Schmertmann <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
# openssl-ccm
[![Gem Version](https://badge.fury.io/rb/openssl-ccm.png)](http://badge.fury.io/rb/openssl-ccm)
[![Dependency Status](https://gemnasium.com/SmallLars/openssl-ccm.png)](https://gemnasium.com/SmallLars/openssl-ccm)
[![Build Status](https://travis-ci.org/SmallLars/openssl-ccm.png?branch=master)](https://travis-ci.org/SmallLars/openssl-ccm)
[![Coverage Status](https://coveralls.io/repos/SmallLars/openssl-ccm/badge.png?branch=master)](https://coveralls.io/r/SmallLars/openssl-ccm)
[![Code Climate](https://codeclimate.com/github/SmallLars/openssl-ccm.png)](https://codeclimate.com/github/SmallLars/openssl-ccm)
[![Inline docs](http://inch-pages.github.io/github/smalllars/openssl-ccm.png)](http://inch-pages.github.io/github/smalllars/openssl-ccm)

Ruby Gem for RFC 3610 - Counter with CBC-MAC (CCM)
# openssl-ccm

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).
Ruby Gem for [RFC 3610 - Counter with CBC-MAC (CCM)](http://tools.ietf.org/html/rfc3610)

## Installation

Expand All @@ -23,11 +28,8 @@ Or install it yourself as:
Example:

require 'openssl/ccm'

ccm = OpenSSL::CCM.new('AES', 'My16Byte LongKey', 8)

ciphertext = ccm.encrypt('The message to encrypt', 'The nonce')

plaintext = ccm.decrypt(ciphertext, 'The nonce')

After initialisation, you can use the object as often you need.
5 changes: 3 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ end
desc "Uninstall and clean documentation"
task :clean do
sh "gem uninstall openssl-ccm"
begin; sh "rm -R ./.yardoc"; rescue; end
begin; sh "rm -R ./doc"; rescue; end
begin; sh "rm -R ./coverage"; rescue; end
begin; sh "rm -R ./.yardoc"; rescue; end
begin; sh "rm -R ./doc"; rescue; end
end

desc "Development Dependencies"
Expand Down
2 changes: 1 addition & 1 deletion lib/openssl/ccm/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module OpenSSL
class CCM
VERSION = '1.1.0'
VERSION = '1.1.1'
end
end
6 changes: 4 additions & 2 deletions openssl-ccm.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,20 @@ Gem::Specification.new do |s|
s.email = ['[email protected]']
s.summary = 'RFC 3610 - CCM'
s.description = 'Ruby Gem for RFC 3610 - Counter with CBC-MAC (CCM)'
s.homepage = ''
s.homepage = 'https://github.com/smalllars/openssl-ccm'
s.license = 'MIT'
s.post_install_message = "Thanks for installing!"

s.files = Dir.glob('lib/openssl/*.rb') +
Dir.glob("lib/openssl/ccm/*.rb") +
['Gemfile', 'Rakefile']
['Gemfile', 'Rakefile', '.rubocop.yml', '.yardopts']
s.test_files = Dir.glob('test/test_*.rb') + Dir.glob('test/data_*')

s.add_development_dependency 'rake', '~> 10.2', '>= 10.2.2'
s.add_development_dependency 'rdoc', '~> 4.1', '>= 4.1.1'
s.add_development_dependency 'yard', '~> 0.8', '>= 0.8.7.3'
s.add_development_dependency 'rubocop', '~> 0.18', '>= 0.18.1'
s.add_development_dependency 'coveralls', '~> 0.7', '>= 0.7.0'

s.rdoc_options += ['-x', 'test/data_*']
s.extra_rdoc_files = ['README.md', 'LICENSE']
Expand Down
Binary file removed pkg/openssl-ccm-0.0.1.gem
Binary file not shown.
Binary file removed pkg/openssl-ccm-1.0.0.gem
Binary file not shown.
Binary file removed pkg/openssl-ccm-1.1.0.gem
Binary file not shown.
34 changes: 34 additions & 0 deletions test/test_ccm.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require 'coveralls'
Coveralls.wear!
require 'test/unit'
require 'openssl/ccm'

Expand Down Expand Up @@ -262,4 +264,36 @@ def test_aes_vectors
"Wrong ENCRYPT in Vector #{i + 1}")
end
end

def test_aes_data
key = %W(
00000000000000000000000000000000
001234567890ABCDEFDCAFFEED3921EE
001234567890ABCDEFDCAFFEED3921EE
11223344AABB00000000000000000000
)
nonce = %W(
00000000000000000000000000
00112233445566778899
001122334455667788990000
00112233445566778899
)
mac_len = [16, 8, 14, 8]

assert(OpenSSL::CCM.ciphers.include?('AES'), 'Missing AES-Cipher')
1.upto(3) do |i|
open("test/data_#{i}", mode = 'r') do |i_file|
input = i_file.read
key.length.times do |j|
open("test/data_#{i}-#{j + 1}_e", mode = 'r') do |o_file|
output = o_file.read
ccm = OpenSSL::CCM.new('AES', [key[j]].pack('H*'), mac_len[j])
c = ccm.encrypt(input, [nonce[j]].pack('H*'))
assert_equal(output.unpack('H*'), c.unpack('H*'),
"Wrong ENCRYPT in Vector #{i + 1}")
end
end
end
end
end
end
37 changes: 0 additions & 37 deletions test/test_ccm_data.rb

This file was deleted.

0 comments on commit ea35a42

Please sign in to comment.