aboutsummaryrefslogtreecommitdiffstats
path: root/ext/openssl/lib
diff options
context:
space:
mode:
authortechnorama <technorama@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-04-05 05:59:22 +0000
committertechnorama <technorama@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-04-05 05:59:22 +0000
commit953e8aca2be6a74a4829f8729cd4ba8e501207fe (patch)
tree6af3285c7c29d4fb458d3cb873f80fbdfcb942ab /ext/openssl/lib
parentf1796fdb2c0473f2362a79402e1d9417cf2b6f96 (diff)
downloadruby-953e8aca2be6a74a4829f8729cd4ba8e501207fe.tar.gz
* ext/openssl/ossl_pkcs5.c: New module.
* ext/openssl/ossl_{cipher,digest,pkcs7,pkcs12}.c: Remove redundant module namespace. * ext/openssl/lib/openssl/{cipher,digest}.rb Add backwards compatibile classes for rearranged classes. * ext/openssl/ossl_{pkcs7,pkcs12}.c: Add documentation. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12148 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/openssl/lib')
-rw-r--r--ext/openssl/lib/openssl/cipher.rb37
-rw-r--r--ext/openssl/lib/openssl/digest.rb7
2 files changed, 26 insertions, 18 deletions
diff --git a/ext/openssl/lib/openssl/cipher.rb b/ext/openssl/lib/openssl/cipher.rb
index 45cf6ac93e..290e9c1d2d 100644
--- a/ext/openssl/lib/openssl/cipher.rb
+++ b/ext/openssl/lib/openssl/cipher.rb
@@ -19,7 +19,7 @@
#require 'openssl'
module OpenSSL
- module Cipher
+ class Cipher
%w(AES CAST5 BF DES IDEA RC2 RC4 RC5).each{|name|
klass = Class.new(Cipher){
define_method(:initialize){|*args|
@@ -41,22 +41,25 @@ module OpenSSL
const_set("AES#{keylen}", klass)
}
- 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
- return str
- end
+ # 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
+ return str
+ end
+
+ # This class is only provided for backwards compatibility. Use OpenSSL::Digest in the future.
+ class Cipher < Cipher
+ # add warning
end
end # Cipher
end # OpenSSL
diff --git a/ext/openssl/lib/openssl/digest.rb b/ext/openssl/lib/openssl/digest.rb
index b3e4484805..8d7df73b54 100644
--- a/ext/openssl/lib/openssl/digest.rb
+++ b/ext/openssl/lib/openssl/digest.rb
@@ -19,7 +19,7 @@
#require 'openssl'
module OpenSSL
- module Digest
+ class Digest
alg = %w(DSS DSS1 MD2 MD4 MD5 MDC2 RIPEMD160 SHA SHA1)
if OPENSSL_VERSION_NUMBER > 0x00908000
@@ -44,6 +44,11 @@ module OpenSSL
const_set(name, klass)
}
+ # This class is only provided for backwards compatibility. Use OpenSSL::Digest in the future.
+ class Digest < Digest
+ # add warning
+ end
+
end # Digest
end # OpenSSL