summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/openssl/ossl_pkey.c3
-rw-r--r--test/openssl/test_pkey_dh.rb2
-rw-r--r--test/openssl/utils.rb3
3 files changed, 5 insertions, 3 deletions
diff --git a/ext/openssl/ossl_pkey.c b/ext/openssl/ossl_pkey.c
index c6dbf57272..a00d66aada 100644
--- a/ext/openssl/ossl_pkey.c
+++ b/ext/openssl/ossl_pkey.c
@@ -178,6 +178,9 @@ ossl_pkey_new_from_data(int argc, VALUE *argv, VALUE self)
OSSL_BIO_reset(bio);
if ((pkey = PEM_read_bio_PUBKEY(bio, NULL, NULL, NULL)))
goto ok;
+ OSSL_BIO_reset(bio);
+ if ((pkey = PEM_read_bio_Parameters(bio, NULL)))
+ goto ok;
BIO_free(bio);
ossl_raise(ePKeyError, "Could not parse PKey");
diff --git a/test/openssl/test_pkey_dh.rb b/test/openssl/test_pkey_dh.rb
index fd2c7a66a9..4a05626a12 100644
--- a/test/openssl/test_pkey_dh.rb
+++ b/test/openssl/test_pkey_dh.rb
@@ -36,6 +36,8 @@ class OpenSSL::TestPKeyDH < OpenSSL::PKeyTestCase
EOF
key = OpenSSL::PKey::DH.new(pem)
assert_same_dh dup_public(dh1024), key
+ key = OpenSSL::PKey.read(pem)
+ assert_same_dh dup_public(dh1024), key
assert_equal asn1.to_der, dh1024.to_der
assert_equal pem, dh1024.export
diff --git a/test/openssl/utils.rb b/test/openssl/utils.rb
index 3776fbac4e..c1d737b2ab 100644
--- a/test/openssl/utils.rb
+++ b/test/openssl/utils.rb
@@ -42,9 +42,6 @@ module OpenSSL::TestUtils
def pkey(name)
OpenSSL::PKey.read(read_file("pkey", name))
- rescue OpenSSL::PKey::PKeyError
- # TODO: DH parameters can be read by OpenSSL::PKey.read atm
- OpenSSL::PKey::DH.new(read_file("pkey", name))
end
def read_file(category, name)