summaryrefslogtreecommitdiff
path: root/test/openssl/test_pkey_dh.rb
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2021-05-31 11:44:05 +0900
committerKazuki Yamaguchi <k@rhe.jp>2021-10-23 13:38:36 +0900
commit37632a0ac635082e4ca9ca5b1c8da6b6770ff0ed (patch)
tree0b6aa176577bb7930dcc5c456bd634fc73ba2584 /test/openssl/test_pkey_dh.rb
parente353bcd1113187185e06eac64b5f63956c30e2d9 (diff)
[ruby/openssl] test/openssl/utils: remove dup_public helper method
It uses deprecated PKey::{RSA,DSA,DH}#set_* methods, which will not work with OpenSSL 3.0. The same can easily be achieved using PKey#public_to_der regardless of the key kind. https://github.com/ruby/openssl/commit/7b66eaa2db
Diffstat (limited to 'test/openssl/test_pkey_dh.rb')
-rw-r--r--test/openssl/test_pkey_dh.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/test/openssl/test_pkey_dh.rb b/test/openssl/test_pkey_dh.rb
index f80af8f841..757704caf6 100644
--- a/test/openssl/test_pkey_dh.rb
+++ b/test/openssl/test_pkey_dh.rb
@@ -40,12 +40,14 @@ class OpenSSL::TestPKeyDH < OpenSSL::PKeyTestCase
def test_DHparams
dh1024 = Fixtures.pkey("dh1024")
+ dh1024params = dh1024.public_key
+
asn1 = OpenSSL::ASN1::Sequence([
OpenSSL::ASN1::Integer(dh1024.p),
OpenSSL::ASN1::Integer(dh1024.g)
])
key = OpenSSL::PKey::DH.new(asn1.to_der)
- assert_same_dh dup_public(dh1024), key
+ assert_same_dh dh1024params, key
pem = <<~EOF
-----BEGIN DH PARAMETERS-----
@@ -55,9 +57,9 @@ class OpenSSL::TestPKeyDH < OpenSSL::PKeyTestCase
-----END DH PARAMETERS-----
EOF
key = OpenSSL::PKey::DH.new(pem)
- assert_same_dh dup_public(dh1024), key
+ assert_same_dh dh1024params, key
key = OpenSSL::PKey.read(pem)
- assert_same_dh dup_public(dh1024), key
+ assert_same_dh dh1024params, key
assert_equal asn1.to_der, dh1024.to_der
assert_equal pem, dh1024.export