mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/openssl/ossl_pkey.c (ossl_pkey_to_der): removed; it returns
public key only. * ext/openssl/ossl_pkey_dh.c (ossl_dh_to_der): new function for OpenSSL::PKey::DH#to_der. * ext/openssl/ossl_pkey_dsa.c (ossl_dsa_to_der): new function for OpenSSL::PKey::DSA#to_der. * ext/openssl/ossl_pkey_rsa.c (ossl_rsa_to_der): new function for OpenSSL::PKey::RSA#to_der. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5417 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0f3e58e707
commit
54d29aaba9
5 changed files with 89 additions and 22 deletions
|
@ -144,26 +144,6 @@ ossl_pkey_initialize(VALUE self)
|
|||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
ossl_pkey_to_der(VALUE self)
|
||||
{
|
||||
EVP_PKEY *pkey;
|
||||
VALUE str;
|
||||
long len;
|
||||
unsigned char *p;
|
||||
|
||||
GetPKey(self, pkey);
|
||||
if((len = i2d_PUBKEY(pkey, NULL)) <= 0)
|
||||
ossl_raise(ePKeyError, NULL);
|
||||
str = rb_str_new(0, len);
|
||||
p = RSTRING(str)->ptr;
|
||||
if(len = i2d_PUBKEY(pkey, &p) <= 0)
|
||||
ossl_raise(ePKeyError, NULL);
|
||||
ossl_str_adjust(str, p);
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
ossl_pkey_sign(VALUE self, VALUE digest, VALUE data)
|
||||
{
|
||||
|
@ -226,7 +206,6 @@ Init_ossl_pkey()
|
|||
rb_define_alloc_func(cPKey, ossl_pkey_alloc);
|
||||
rb_define_method(cPKey, "initialize", ossl_pkey_initialize, 0);
|
||||
|
||||
rb_define_method(cPKey, "to_der", ossl_pkey_to_der, 0);
|
||||
rb_define_method(cPKey, "sign", ossl_pkey_sign, 2);
|
||||
rb_define_method(cPKey, "verify", ossl_pkey_verify, 3);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue