Method: OpenSSL::OCSP::BasicResponse#initialize

Defined in:
ossl_ocsp.c

#OpenSSL::OCSP::BasicResponse.new(der_string = nil) ⇒ Object

Creates a new BasicResponse. If der_string is given, decodes der_string as DER.



699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
# File 'ossl_ocsp.c', line 699

static VALUE
ossl_ocspbres_initialize(int argc, VALUE *argv, VALUE self)
{
    VALUE arg;
    OCSP_BASICRESP *res, *res_new;
    const unsigned char *p;

    rb_scan_args(argc, argv, "01", &arg);
    if (!NIL_P(arg)) {
  GetOCSPBasicRes(self, res);
  arg = ossl_to_der_if_possible(arg);
  StringValue(arg);
  p = (unsigned char *)RSTRING_PTR(arg);
  res_new = d2i_OCSP_BASICRESP(NULL, &p, RSTRING_LEN(arg));
  if (!res_new)
      ossl_raise(eOCSPError, "d2i_OCSP_BASICRESP");
  SetOCSPBasicRes(self, res_new);
  OCSP_BASICRESP_free(res);
    }

    return self;
}