aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2016-08-19 16:44:22 +0900
committerKazuki Yamaguchi <k@rhe.jp>2016-08-22 04:50:39 +0900
commitb9e17f6f9c4528d72f173c4ebea7786718e08218 (patch)
tree933156e407f5fe9a5a04ae997a4213e7840e9b9f /lib
parent2c258aa9e5e8b9ec7cc85cc360e37ce90c96d24d (diff)
downloadruby-openssl-b9e17f6f9c4528d72f173c4ebea7786718e08218.tar.gz
cipher: fixup documentation
Diffstat (limited to 'lib')
-rw-r--r--lib/openssl/cipher.rb20
1 files changed, 14 insertions, 6 deletions
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.