From b9e17f6f9c4528d72f173c4ebea7786718e08218 Mon Sep 17 00:00:00 2001 From: Kazuki Yamaguchi Date: Fri, 19 Aug 2016 16:44:22 +0900 Subject: cipher: fixup documentation --- lib/openssl/cipher.rb | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/openssl/cipher.rb b/lib/openssl/cipher.rb index 0b9be693..af721b3a 100644 --- a/lib/openssl/cipher.rb +++ b/lib/openssl/cipher.rb @@ -33,20 +33,28 @@ module OpenSSL const_set("AES#{keylen}", klass) } - # Generate, set, and return a random key. - # You must call cipher.encrypt or cipher.decrypt before calling this method. + # call-seq: + # cipher.random_key -> key + # + # Generate a random key with OpenSSL::Random.random_bytes and sets it to + # the cipher, and returns it. + # + # You must call #encrypt or #decrypt before calling this method. def random_key str = OpenSSL::Random.random_bytes(self.key_len) self.key = str - return str end - # Generate, set, and return a random iv. - # You must call cipher.encrypt or cipher.decrypt before calling this method. + # call-seq: + # cipher.random_iv -> iv + # + # Generate a random IV with OpenSSL::Random.random_bytes and sets it to the + # cipher, and returns it. + # + # You must call #encrypt or #decrypt before calling this method. def random_iv str = OpenSSL::Random.random_bytes(self.iv_len) self.iv = str - return str end # Deprecated. -- cgit v1.2.3