aboutsummaryrefslogtreecommitdiffstats
path: root/ext/openssl/lib/openssl/cipher.rb
diff options
context:
space:
mode:
Diffstat (limited to 'ext/openssl/lib/openssl/cipher.rb')
-rw-r--r--ext/openssl/lib/openssl/cipher.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/ext/openssl/lib/openssl/cipher.rb b/ext/openssl/lib/openssl/cipher.rb
index 049533d06b..45cf6ac93e 100644
--- a/ext/openssl/lib/openssl/cipher.rb
+++ b/ext/openssl/lib/openssl/cipher.rb
@@ -42,12 +42,16 @@ module OpenSSL
}
class Cipher
+ # Generate, set, and return a random key.
+ # You must call cipher.encrypt or cipher.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.
def random_iv
str = OpenSSL::Random.random_bytes(self.iv_len)
self.iv = str