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 | 99ac17a07f142ecc4b899c5d49aaf84b30ea211e (patch) | |
| tree | b345674a43e7830b5f0fb8f453e9f37fa06554b8 /test/openssl | |
| parent | dea4be4ca562bd34eaab686ff687e5d9bccb7b67 (diff) | |
| download | ruby-99ac17a07f142ecc4b899c5d49aaf84b30ea211e.tar.gz ruby-99ac17a07f142ecc4b899c5d49aaf84b30ea211e.tar.xz ruby-99ac17a07f142ecc4b899c5d49aaf84b30ea211e.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/trunk@9218 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/openssl')
| -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 |
