diff --git a/README.md b/README.md index 5f33bf6..f56cc49 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/lib/openssl/ccm.rb b/lib/openssl/ccm.rb index a8ca5d2..958670a 100644 --- a/lib/openssl/ccm.rb +++ b/lib/openssl/ccm.rb @@ -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] } diff --git a/lib/openssl/ccm/version.rb b/lib/openssl/ccm/version.rb index 3b8bed7..30b3098 100644 --- a/lib/openssl/ccm/version.rb +++ b/lib/openssl/ccm/version.rb @@ -1,6 +1,5 @@ module OpenSSL - # CCM Version class CCM - VERSION = '1.0.0' + VERSION = '1.1.0' end end diff --git a/pkg/openssl-ccm-1.1.0.gem b/pkg/openssl-ccm-1.1.0.gem new file mode 100644 index 0000000..a202714 Binary files /dev/null and b/pkg/openssl-ccm-1.1.0.gem differ