Method: OpenSSL::OCSP::SingleResponse#to_der

Defined in:
ossl_ocsp.c

#to_derString

Encodes this SingleResponse into a DER-encoded string.

Returns:

  • (String)


1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
# File 'ossl_ocsp.c', line 1383

static VALUE
ossl_ocspsres_to_der(VALUE self)
{
    OCSP_SINGLERESP *sres;
    VALUE str;
    long len;
    unsigned char *p;

    GetOCSPSingleRes(self, sres);
    if ((len = i2d_OCSP_SINGLERESP(sres, NULL)) <= 0)
  ossl_raise(eOCSPError, NULL);
    str = rb_str_new(0, len);
    p = (unsigned char *)RSTRING_PTR(str);
    if (i2d_OCSP_SINGLERESP(sres, &p) <= 0)
  ossl_raise(eOCSPError, NULL);
    ossl_str_adjust(str, p);

    return str;
}