class OpenSSL::Cipher

def random_iv

You must call #encrypt or #decrypt before calling this method.

cipher, and returns it.
Generate a random IV with OpenSSL::Random.random_bytes and sets it to the

cipher.random_iv -> iv
call-seq:
def random_iv
  str = OpenSSL::Random.random_bytes(self.iv_len)
  self.iv = str
end

def random_key

You must call #encrypt or #decrypt before calling this method.

the cipher, and returns it.
Generate a random key with OpenSSL::Random.random_bytes and sets it to

cipher.random_key -> key
call-seq:
def random_key
  str = OpenSSL::Random.random_bytes(self.key_len)
  self.key = str
end