class OpenSSL::Cipher

Public Instance Methods

random_iv() click to toggle source

Generate, set, and return a random iv. You must call cipher.encrypt or cipher.decrypt before calling this method.

# File lib/openssl_cms/cipher.rb, line 54
def random_iv
  str = OpenSSL::Random.random_bytes(self.iv_len)
  self.iv = str
  return str
end
random_key() click to toggle source

Generate, set, and return a random key. You must call cipher.encrypt or cipher.decrypt before calling this method.

# File lib/openssl_cms/cipher.rb, line 46
def random_key
  str = OpenSSL::Random.random_bytes(self.key_len)
  self.key = str
  return str
end