aboutsummaryrefslogtreecommitdiffstats
path: root/ext/openssl/ossl_pkey.c
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2017-03-18 17:26:33 +0900
committerKazuki Yamaguchi <k@rhe.jp>2020-05-13 16:14:06 +0900
commit867e5c021b7308fe35612510c619b2bba424c184 (patch)
treec9f4f80c7eefc2e4c5fe96c70c6d4542d270a683 /ext/openssl/ossl_pkey.c
parent1eb1366615ec97a75d97c4b35cb20adfca175feb (diff)
downloadruby-openssl-867e5c021b7308fe35612510c619b2bba424c184.tar.gz
pkey: have PKey.read parse PEM-encoded DHParameter
Try PEM_read_bio_Parameters(). Only PEM format is supported at the moment since corresponding d2i_* functions are not provided by OpenSSL.
Diffstat (limited to 'ext/openssl/ossl_pkey.c')
-rw-r--r--ext/openssl/ossl_pkey.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/ext/openssl/ossl_pkey.c b/ext/openssl/ossl_pkey.c
index c6dbf572..a00d66aa 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");