Class: OpenSSL::OCSP::Response
- Inherits:
-
Object
- Object
- OpenSSL::OCSP::Response
- Defined in:
- ossl_ocsp.c
Class Method Summary collapse
-
.OpenSSL::OCSP::Response.create(status, basic_response = nil) ⇒ Object
Creates an OpenSSL::OCSP::Response from
status
andbasic_response
.
Instance Method Summary collapse
-
#basic ⇒ Object
Returns a BasicResponse for this response.
-
#initialize(*args) ⇒ Object
constructor
Creates a new OpenSSL::OCSP::Response.
-
#status ⇒ Integer
Returns the status of the response.
-
#status_string ⇒ String
Returns a status string for the response.
-
#to_der ⇒ String
Returns this response as a DER-encoded string.
Constructor Details
#OpenSSL::OCSP::Response.new ⇒ Object #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.
447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 |
# File 'ossl_ocsp.c', line 447
static VALUE
ossl_ocspres_initialize(int argc, VALUE *argv, VALUE self)
{
VALUE arg;
const unsigned char *p;
rb_scan_args(argc, argv, "01", &arg);
if(!NIL_P(arg)){
OCSP_RESPONSE *res = DATA_PTR(self), *x;
arg = ossl_to_der_if_possible(arg);
StringValue(arg);
p = (unsigned char *)RSTRING_PTR(arg);
x = d2i_OCSP_RESPONSE(&res, &p, RSTRING_LEN(arg));
DATA_PTR(self) = res;
if(!x){
ossl_raise(eOCSPError, "cannot load DER encoded response");
}
}
return self;
}
|
Class Method Details
.OpenSSL::OCSP::Response.create(status, basic_response = nil) ⇒ Object
Creates an OpenSSL::OCSP::Response from status
and basic_response
.
408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 |
# File 'ossl_ocsp.c', line 408
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
Returns a BasicResponse for this response
514 515 516 517 518 519 520 521 522 523 524 525 526 527 |
# File 'ossl_ocsp.c', line 514
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 ⇒ Integer
Returns the status of the response.
476 477 478 479 480 481 482 483 484 485 486 |
# File 'ossl_ocsp.c', line 476
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 ⇒ String
Returns a status string for the response.
495 496 497 498 499 500 501 502 503 504 505 |
# File 'ossl_ocsp.c', line 495
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 ⇒ String
Returns this response as a DER-encoded string.
536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 |
# File 'ossl_ocsp.c', line 536
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 = (unsigned char *)RSTRING_PTR(str);
if(i2d_OCSP_RESPONSE(res, &p) <= 0)
ossl_raise(eOCSPError, NULL);
ossl_str_adjust(str, p);
return str;
}
|