summaryrefslogtreecommitdiffstats
path: root/ext/openssl/lib
diff options
context:
space:
mode:
authortechnorama <technorama@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-03-29 17:29:03 +0000
committertechnorama <technorama@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-03-29 17:29:03 +0000
commit40b91d9da26ac23870ba03bba6ea6d3b0cfc3f0d (patch)
treef104155557a59722ad63ff85530bc5b6ee37aeee /ext/openssl/lib
parent7b616eaf123ed41494a494b99746dcfe7c3c1cbe (diff)
downloadruby-40b91d9da26ac23870ba03bba6ea6d3b0cfc3f0d.tar.gz
ruby-40b91d9da26ac23870ba03bba6ea6d3b0cfc3f0d.tar.xz
ruby-40b91d9da26ac23870ba03bba6ea6d3b0cfc3f0d.zip
* ext/openssl/ossl_{bn,cipher,digest,hmac,rand,pkey_{dh,dsa,rsa}}.c: Add Documentation for various methods.
* ext/openssl/lib/openssl/cipher.rb: Ditto * ext/openssl/ossl_bn.c: add lshift! and rshift! methods. * ext/openssl/ossl_digest.c: GetDigestPtr() also accept a string. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@12128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/openssl/lib')
-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 049533d06..45cf6ac93 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