aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorrhe <rhe@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-05-21 05:30:48 +0000
committerrhe <rhe@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-05-21 05:30:48 +0000
commite895661e2c923a1a8cc7e0c0f5086a9475950a86 (patch)
treebc9946df1458b1d47fd0d57432d6b9b31739c1a8 /test
parent29f579d176baf480ea9afaac16ea39de222c2a20 (diff)
downloadruby-e895661e2c923a1a8cc7e0c0f5086a9475950a86.tar.gz
openssl: add OpenSSL::PKey::EC#private? and #public?
* ext/openssl/ossl_pkey_ec.c: rename PKey::EC#private_key? and #public_key? to #private? and #public? for consistency with other PKey types. Old names remain as alias. [ruby-core:45541] [Bug #6567] * test/openssl/test_pkey_ec.rb (test_check_key): check private? and public? works correctly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55098 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/openssl/test_pkey_ec.rb18
1 files changed, 15 insertions, 3 deletions
diff --git a/test/openssl/test_pkey_ec.rb b/test/openssl/test_pkey_ec.rb
index 23afed672a..302259b242 100644
--- a/test/openssl/test_pkey_ec.rb
+++ b/test/openssl/test_pkey_ec.rb
@@ -40,9 +40,21 @@ class OpenSSL::TestEC < OpenSSL::TestCase
def test_check_key
for key in @keys
- assert_equal(key.check_key, true)
- assert_equal(key.private_key?, true)
- assert_equal(key.public_key?, true)
+ assert_equal(true, key.check_key)
+ assert_equal(true, key.private?)
+ assert_equal(true, key.public?)
+ key2 = OpenSSL::PKey::EC.new(key.group)
+ assert_equal(false, key2.private?)
+ assert_equal(false, key2.public?)
+ key2.public_key = key.public_key
+ assert_equal(false, key2.private?)
+ assert_equal(true, key2.public?)
+ key2.private_key = key.private_key
+ assert_equal(true, key2.private?)
+ assert_equal(true, key2.public?)
+ assert_equal(true, key2.check_key)
+ key2.private_key += 1
+ assert_raise(OpenSSL::PKey::ECError) { key2.check_key }
end
end