Method: OpenSSL::OCSP::Response#initialize

Defined in:
ext/openssl/ossl_ocsp.c

#OpenSSL::OCSP::Response.newObject #OpenSSL::OCSP::Response.new(response_der) ⇒ Object

Creates a new OpenSSL::OCSP::Response. The response may be created empty or from a response_der string.



546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
# File 'ext/openssl/ossl_ocsp.c', line 546

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

    rb_scan_args(argc, argv, "01", &arg);
    if(!NIL_P(arg)){
        GetOCSPRes(self, res);
        arg = ossl_to_der_if_possible(arg);
        StringValue(arg);
        p = (unsigned char *)RSTRING_PTR(arg);
        res_new = d2i_OCSP_RESPONSE(NULL, &p, RSTRING_LEN(arg));
        if (!res_new)
            ossl_raise(eOCSPError, "d2i_OCSP_RESPONSE");
        SetOCSPRes(self, res_new);
        OCSP_RESPONSE_free(res);
    }

    return self;
}