mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/openssl/ossl_x509req.c (ossl_x509req_to_der): add function for
X509::Request#to_der. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4949 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
06a9101158
commit
a3845916c0
2 changed files with 26 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
|||
Thu Nov 13 16:45:53 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
|
||||
|
||||
* ext/openssl/ossl_x509req.c (ossl_x509req_to_der): add function for
|
||||
X509::Request#to_der.
|
||||
|
||||
Thu Nov 13 11:31:14 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* lib/optparse.rb (OptionParser::Completion#complete): prior shorter
|
||||
|
|
|
@ -159,6 +159,26 @@ ossl_x509req_to_pem(VALUE self)
|
|||
return str;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
ossl_x509req_to_der(VALUE self)
|
||||
{
|
||||
X509_REQ *req;
|
||||
VALUE str;
|
||||
long len;
|
||||
unsigned char *p;
|
||||
|
||||
GetX509Req(self, req);
|
||||
if ((len = i2d_X509_REQ(req, NULL)) <= 0)
|
||||
ossl_raise(eX509CertError, NULL);
|
||||
str = rb_str_new(0, len);
|
||||
p = RSTRING(str)->ptr;
|
||||
if (i2d_X509_REQ(req, &p) <= 0)
|
||||
ossl_raise(eX509ReqError, NULL);
|
||||
ossl_str_adjust(str, p);
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
ossl_x509req_to_text(VALUE self)
|
||||
{
|
||||
|
@ -427,6 +447,7 @@ Init_ossl_x509req()
|
|||
rb_define_copy_func(cX509Req, ossl_x509req_copy);
|
||||
|
||||
rb_define_method(cX509Req, "to_pem", ossl_x509req_to_pem, 0);
|
||||
rb_define_method(cX509Req, "to_der", ossl_x509req_to_der, 0);
|
||||
rb_define_alias(cX509Req, "to_s", "to_pem");
|
||||
rb_define_method(cX509Req, "to_text", ossl_x509req_to_text, 0);
|
||||
rb_define_method(cX509Req, "version", ossl_x509req_get_version, 0);
|
||||
|
|
Loading…
Add table
Reference in a new issue