summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authortechnorama <technorama@ruby-lang.org>2007-03-29 17:29:03 +0000
committertechnorama <technorama@ruby-lang.org>2007-03-29 17:29:03 +0000
commit7ff21742e1c29552ab6cdc4d8bb55257033e37e5 (patch)
treeecc1a69d056b1d68dcf6abbd73d19da5fea43110 /lib
parentfc28a979700cc627f90c4b07200400704a6a4329 (diff)
downloadruby-openssl-history-7ff21742e1c29552ab6cdc4d8bb55257033e37e5.tar.gz
* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@12128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/openssl/cipher.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/openssl/cipher.rb b/lib/openssl/cipher.rb
index 049533d..45cf6ac 100644
--- a/lib/openssl/cipher.rb
+++ b/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