Ruby Gem for
- RFC 4493 - The AES-CMAC Algorithm
- RFC 4494 - The AES-CMAC-96 Algorithm and Its Use with IPsec
- RFC 4615 - The Advanced Encryption Standard-Cipher-based Message Authentication Code-Pseudo-Random Function-128 (AES-CMAC-PRF-128) Algorithm for the Internet Key Exchange Protocol (IKE)
Add this line to your application's Gemfile:
gem 'openssl-cmac'
And then execute:
$ bundle
Or install it yourself as:
$ gem install openssl-cmac
Example 1:
require 'openssl/cmac'
mac = OpenSSL::CMAC.digest('AES', 'message', 'key')
Example 2:
require 'openssl/cmac'
cmac = OpenSSL::CMAC.new('AES', 'key')
cmac.update('message chunk 1')
...
cmac.update('message chunk n')
mac = cmac.digest