Method: OpenSSL::OCSP::BasicResponse#to_der

Defined in:
ossl_ocsp.c

#to_derString

Encodes this basic response into a DER-encoded string.

Returns:

  • (String)


1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
# File 'ossl_ocsp.c', line 1134

static VALUE
ossl_ocspbres_to_der(VALUE self)
{
    OCSP_BASICRESP *res;
    VALUE str;
    long len;
    unsigned char *p;

    GetOCSPBasicRes(self, res);
    if ((len = i2d_OCSP_BASICRESP(res, NULL)) <= 0)
  ossl_raise(eOCSPError, NULL);
    str = rb_str_new(0, len);
    p = (unsigned char *)RSTRING_PTR(str);
    if (i2d_OCSP_BASICRESP(res, &p) <= 0)
  ossl_raise(eOCSPError, NULL);
    ossl_str_adjust(str, p);

    return str;
}