Sha256: 866aeb53bf5f8022b61873df6b61e7b3185bc63f23f1f18018b114ee6a5ae838
Contents?: true
Size: 604 Bytes
Versions: 1
Compression:
Stored size: 604 Bytes
Contents
module Strongroom class Encryptor include HasRsaKey def initialize public_key, cipher = nil @cipher = cipher if cipher has_rsa_key public_key end def encrypt input key = cipher.random_key iv = cipher.random_iv cipher.encrypt cipher.key = key cipher.iv = iv Enigma.new \ cipher: cipher.name, ciphertext: cipher.update(input) << cipher.final, encrypted_key: rsa_key.public_encrypt(key), iv: iv end private def cipher @cipher ||= OpenSSL::Cipher.new("AES-128-CFB") end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
strongroom-0.0.1 | lib/strongroom/encryptor.rb |