Skip to content

Commit

Permalink
Documentation update.
Browse files Browse the repository at this point in the history
  • Loading branch information
Lars Schmertmann committed Apr 1, 2014
1 parent 6f4713d commit bb4b74d
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 6 deletions.
33 changes: 31 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,33 @@
openssl-ccm
===========
# openssl-ccm

Ruby Gem for RFC 3610 - Counter with CBC-MAC (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).

## Installation

Add this line to your application's Gemfile:

gem 'openssl-ccm'

And then execute:

$ bundle

Or install it yourself as:

$ gem install openssl-ccm

## Usage

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.
4 changes: 2 additions & 2 deletions lib/openssl/ccm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ class CCMError < StandardError
# ciphers, such as the Advanced Encryption Standard (AES).
#
# At the moment there is no update function, because length of
# data and additional_data are needed to start of cipher process.
# data and additional_data are needed at the begin of cipher process.
# In future init(nonce, data_len, additional_data_len) could
# be a solution, to solve this problem. After init, update(data)
# could be used to set additional_data first followed by data.
class CCM
# Searches for supported algorithms within OpenSSL
#
# @return [Stringlist] of supported algorithms
# @return [[String]] supported algorithms
def self.ciphers
l = OpenSSL::Cipher.ciphers.keep_if { |c| c.end_with?('-128-CBC') }
l.length.times { |i| l[i] = l[i][0..-9] }
Expand Down
3 changes: 1 addition & 2 deletions lib/openssl/ccm/version.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
module OpenSSL
# CCM Version
class CCM
VERSION = '1.0.0'
VERSION = '1.1.0'
end
end
Binary file added pkg/openssl-ccm-1.1.0.gem
Binary file not shown.

0 comments on commit bb4b74d

Please sign in to comment.