diff options
author | gotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-09-18 22:56:11 +0000 |
---|---|---|
committer | gotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-09-18 22:56:11 +0000 |
commit | 37d5e5601fc2eba6d4cbee64a383064d9c458746 (patch) | |
tree | ef02cc50dfd0a5fcbf0ab3f2a0fc28f41dc3757f /test | |
parent | ae9888fa3ef1251ffa50fc0d139347ba0d7fb8fa (diff) | |
download | ruby-37d5e5601fc2eba6d4cbee64a383064d9c458746.tar.gz ruby-37d5e5601fc2eba6d4cbee64a383064d9c458746.tar.xz ruby-37d5e5601fc2eba6d4cbee64a383064d9c458746.zip |
* ext/openssl/ossl_pkey.h, ossl_pkey_rsa.c, ossl_pkey_dsa.c:
an instance variable "private" is added to OpenSSL::PKey class.
this ivar is a flag that shows whether there is a private key
in the instance.
* ext/openssl/ossl_engine.c: (ossl_engine_load_privkey): set private
key flag.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@9218 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/openssl/test_pkey_rsa.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/openssl/test_pkey_rsa.rb b/test/openssl/test_pkey_rsa.rb index 36eb2b77e..401cb6c3e 100644 --- a/test/openssl/test_pkey_rsa.rb +++ b/test/openssl/test_pkey_rsa.rb @@ -33,6 +33,17 @@ class OpenSSL::TestPKeyRSA < Test::Unit::TestCase assert_raise(ArgumentError){ key.private_encrypt("hi", 1, nil) } assert_raise(OpenSSL::PKey::RSAError){ key.private_encrypt(plain0, 666) } end + + def test_private + key = OpenSSL::PKey::RSA.new(512, 3) + assert(key.private?) + key2 = OpenSSL::PKey::RSA.new(key.to_der) + assert(key2.private?) + key3 = key.public_key + assert(!key3.private?) + key4 = OpenSSL::PKey::RSA.new(key3.to_der) + assert(!key4.private?) + end end end |