1.26
Low commit activity in last 3 years
No release in over a year
A Ruby implementation of AES Key Wrap, a.k.a RFC 3394, a.k.a NIST Key Wrap.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
 Dependencies

Development

 Project Readme

Build Status Test Coverage

AESKeyWrap

A Ruby implementation of AES Key Wrap, a.k.a RFC 3394, a.k.a NIST Key Wrap.

Usage

To wrap a key, call AESKeyWrap.wrap with:

  • The plain text key
  • A key-encrypting key (KEK)
  • An "initial value" (optional)
require 'aes_key_wrap'

plaintext_key = ['00112233445566778899AABBCCDDEEFF'].pack('H*') #binary string
kek =  ['000102030405060708090A0B0C0D0E0F'].pack('H*') # binary string
iv = ['DEADBEEFC0FFEEEE'].pack("H*") # binary string (always 8 bytes)

wrapped_key = AESKeyWrap.wrap(plaintext_key, kek, iv)  # iv is optional

To unwrap a key, call AESKeyWrap.unwrap:

unwrapped = AESKeyWrap.unwrap(wrapped_key, kek, iv)  # iv is optional

There also unwrap!, which throws an exception if unwrapping fails, instead of returning nil.

Contributing

Make sure it's got tests, then do the usual fork and pull request hooha.