Method: OpenSSL::OCSP::BasicResponse#to_der

Defined in:
ossl_ocsp.c

#to_derString

Encodes this basic response into a DER-encoded string.

Returns:

  • (String)


1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
# File 'ossl_ocsp.c', line 1086

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;
}