aboutsummaryrefslogtreecommitdiffstats
path: root/ext/openssl/ossl_engine.c
diff options
context:
space:
mode:
authorgotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-09-18 22:56:11 +0000
committergotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-09-18 22:56:11 +0000
commit246f5cfe67fda9fa2fed869c2fffb48effcdc6b9 (patch)
treeb345674a43e7830b5f0fb8f453e9f37fa06554b8 /ext/openssl/ossl_engine.c
parent8885a8720d55bd881e7083adf38a21d73e095e4b (diff)
downloadruby-246f5cfe67fda9fa2fed869c2fffb48effcdc6b9.tar.gz
* ext/openssl/ossl_pkey.h, ossl_pkey_rsa.c, ossl_pkey_dsa.c:
an instance variable "private" is added to OpenSSL::PKey class. this ivar is a flag that shows whether there is a private key in the instance. * ext/openssl/ossl_engine.c: (ossl_engine_load_privkey): set private key flag. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9218 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/openssl/ossl_engine.c')
-rw-r--r--ext/openssl/ossl_engine.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/ext/openssl/ossl_engine.c b/ext/openssl/ossl_engine.c
index 3d943b0098..71586e3620 100644
--- a/ext/openssl/ossl_engine.c
+++ b/ext/openssl/ossl_engine.c
@@ -217,7 +217,7 @@ ossl_engine_load_privkey(int argc, VALUE *argv, VALUE self)
{
ENGINE *e;
EVP_PKEY *pkey;
- VALUE id, data;
+ VALUE id, data, obj;
char *sid, *sdata;
rb_scan_args(argc, argv, "02", &id, &data);
@@ -230,8 +230,10 @@ ossl_engine_load_privkey(int argc, VALUE *argv, VALUE self)
pkey = ENGINE_load_private_key(e, sid, NULL, sdata);
#endif
if (!pkey) ossl_raise(eEngineError, NULL);
+ obj = ossl_pkey_new(pkey);
+ OSSL_PKEY_SET_PRIVATE(obj);
- return ossl_pkey_new(pkey);
+ return obj;
}
static VALUE
@@ -242,8 +244,8 @@ ossl_engine_load_pubkey(int argc, VALUE *argv, VALUE self)
VALUE id, data;
char *sid, *sdata;
- rb_scan_args(argc, argv, "11", &id, &data);
- sid = StringValuePtr(id);
+ rb_scan_args(argc, argv, "02", &id, &data);
+ sid = NIL_P(id) ? NULL : StringValuePtr(id);
sdata = NIL_P(data) ? NULL : StringValuePtr(data);
GetEngine(self, e);
#if OPENSSL_VERSION_NUMBER < 0x00907000L