* 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
This commit is contained in:
technorama 2007-03-29 17:29:03 +00:00
parent 240f1279aa
commit 41fa6056ba
9 changed files with 570 additions and 19 deletions

View file

@ -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