Class: OpenSSL::OCSP::Response
- Inherits:
-
Object
- Object
- OpenSSL::OCSP::Response
- Defined in:
- ossl_ocsp.c
Class Method Summary collapse
-
.create(status, basic_resp) ⇒ Object
OCSP::Response.
Instance Method Summary collapse
- #basic ⇒ Object
- #initialize(*args) ⇒ Object constructor
- #status ⇒ Object
- #status_string ⇒ Object
- #to_der ⇒ Object
Constructor Details
#initialize(*args) ⇒ Object
309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 |
# File 'ossl_ocsp.c', line 309
static VALUE
ossl_ocspres_initialize(int argc, VALUE *argv, VALUE self)
{
VALUE arg;
unsigned char *p;
rb_scan_args(argc, argv, "01", &arg);
if(!NIL_P(arg)){
arg = ossl_to_der_if_possible(arg);
StringValue(arg);
p = RSTRING(arg)->ptr;
if(!d2i_OCSP_RESPONSE((OCSP_RESPONSE**)&DATA_PTR(self), &p,
RSTRING(arg)->len)){
ossl_raise(eOCSPError, "cannot load DER encoded response");
}
}
return self;
}
|
Class Method Details
.create(status, basic_resp) ⇒ Object
OCSP::Response
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 |
# File 'ossl_ocsp.c', line 279
static VALUE
ossl_ocspres_s_create(VALUE klass, VALUE status, VALUE basic_resp)
{
OCSP_BASICRESP *bs;
OCSP_RESPONSE *res;
VALUE obj;
int st = NUM2INT(status);
if(NIL_P(basic_resp)) bs = NULL;
else GetOCSPBasicRes(basic_resp, bs); /* NO NEED TO DUP */
if(!(res = OCSP_response_create(st, bs)))
ossl_raise(eOCSPError, NULL);
WrapOCSPRes(klass, obj, res);
return obj;
}
|
Instance Method Details
#basic ⇒ Object
353 354 355 356 357 358 359 360 361 362 363 364 365 366 |
# File 'ossl_ocsp.c', line 353
static VALUE
ossl_ocspres_get_basic(VALUE self)
{
OCSP_RESPONSE *res;
OCSP_BASICRESP *bs;
VALUE ret;
GetOCSPRes(self, res);
if(!(bs = OCSP_response_get1_basic(res)))
return Qnil;
WrapOCSPBasicRes(cOCSPBasicRes, ret, bs);
return ret;
}
|
#status ⇒ Object
329 330 331 332 333 334 335 336 337 338 339 |
# File 'ossl_ocsp.c', line 329
static VALUE
ossl_ocspres_status(VALUE self)
{
OCSP_RESPONSE *res;
int st;
GetOCSPRes(self, res);
st = OCSP_response_status(res);
return INT2NUM(st);
}
|
#status_string ⇒ Object
341 342 343 344 345 346 347 348 349 350 351 |
# File 'ossl_ocsp.c', line 341
static VALUE
ossl_ocspres_status_string(VALUE self)
{
OCSP_RESPONSE *res;
int st;
GetOCSPRes(self, res);
st = OCSP_response_status(res);
return rb_str_new2(OCSP_response_status_str(st));
}
|
#to_der ⇒ Object
368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 |
# File 'ossl_ocsp.c', line 368
static VALUE
ossl_ocspres_to_der(VALUE self)
{
OCSP_RESPONSE *res;
VALUE str;
long len;
unsigned char *p;
GetOCSPRes(self, res);
if((len = i2d_OCSP_RESPONSE(res, NULL)) <= 0)
ossl_raise(eOCSPError, NULL);
str = rb_str_new(0, len);
p = RSTRING(str)->ptr;
if(i2d_OCSP_RESPONSE(res, NULL) <= 0)
ossl_raise(eOCSPError, NULL);
ossl_str_adjust(str, p);
return str;
}
|