From 867e5c021b7308fe35612510c619b2bba424c184 Mon Sep 17 00:00:00 2001 From: Kazuki Yamaguchi Date: Sat, 18 Mar 2017 17:26:33 +0900 Subject: 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. --- ext/openssl/ossl_pkey.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'ext/openssl/ossl_pkey.c') 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"); -- cgit v1.2.3