diff options
author | rhe <rhe@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-06-19 09:29:59 +0000 |
---|---|---|
committer | rhe <rhe@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-06-19 09:29:59 +0000 |
commit | 42f437b1e8f42b602cc2fcda5296e2f0169f9e28 (patch) | |
tree | 8d216d4f7bcfcbe7b29871745c642914c65ae124 /test/openssl/test_pkey_rsa.rb | |
parent | c9ebf6bb217ecc50f2f6061f460ca28aeaef5e52 (diff) | |
download | ruby-42f437b1e8f42b602cc2fcda5296e2f0169f9e28.tar.gz |
openssl: implement initialize_copy method for PKey classes
* ext/openssl/ossl_pkey_dh.c, ext/openssl/ossl_pkey_dsa.c,
ext/openssl/ossl_pkey_ec.c, ext/openssl/ossl_pkey_rsa.c: Implement
initialize_copy method for OpenSSL::PKey::*.
[ruby-core:75504] [Bug #12381]
* test/openssl/test_pkey_dh.rb, test/openssl/test_pkey_dsa.rb,
test/openssl/test_pkey_ec.rb, test/openssl/test_pkey_rsa.rb: Test they
actually copy the OpenSSL objects, and modifications to cloned object
don't affect the original object.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55454 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/openssl/test_pkey_rsa.rb')
-rw-r--r-- | test/openssl/test_pkey_rsa.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/openssl/test_pkey_rsa.rb b/test/openssl/test_pkey_rsa.rb index c3532f637f..49e8ceacd9 100644 --- a/test/openssl/test_pkey_rsa.rb +++ b/test/openssl/test_pkey_rsa.rb @@ -294,6 +294,14 @@ AwEAAQ== assert(key3.private?) end + def test_dup + key = OpenSSL::PKey::RSA.generate(256, 17) + key2 = key.dup + assert_equal key.params, key2.params + key2.set_key(key2.n, 3, key2.d) + assert_not_equal key.params, key2.params + end + private def check_PUBKEY(asn1, key) |