summaryrefslogtreecommitdiff
path: root/test/openssl/test_pkey_dh.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/openssl/test_pkey_dh.rb')
-rw-r--r--test/openssl/test_pkey_dh.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/openssl/test_pkey_dh.rb b/test/openssl/test_pkey_dh.rb
index afd7a3187c..4d84f7ad49 100644
--- a/test/openssl/test_pkey_dh.rb
+++ b/test/openssl/test_pkey_dh.rb
@@ -83,6 +83,16 @@ YoaOffgTf5qxiwkjnlVZQc3whgnEt9FpVMvQ9eknyeGB5KHfayAc3+hUAvI3/Cr3
assert_equal(dh.compute_key(dh2.pub_key), dh2.compute_key(dh.pub_key))
end
+ def test_dup
+ dh = OpenSSL::PKey::DH.new(NEW_KEYLEN)
+ dh2 = dh.dup
+ assert_equal dh.to_der, dh2.to_der # params
+ assert_equal_params dh, dh2 # keys
+ dh2.set_pqg(dh2.p + 1, nil, dh2.g)
+ assert_not_equal dh2.p, dh.p
+ assert_equal dh2.g, dh.g
+ end
+
private
def assert_equal_params(dh1, dh2)