Method: OpenSSL::OCSP::BasicResponse#status

Defined in:
ossl_ocsp.c

#statusObject

Returns an Array of statuses for this response. Each status contains a CertificateId, the status (0 for good, 1 for revoked, 2 for unknown), the reason for the status, the revocation time, the time of this update, the time for the next update and a list of OpenSSL::X509::Extension.

This should be superseded by BasicResponse#responses and #find_response that return SingleResponse.



895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
# File 'ossl_ocsp.c', line 895

static VALUE
ossl_ocspbres_get_status(VALUE self)
{
    OCSP_BASICRESP *bs;
    OCSP_SINGLERESP *single;
    OCSP_CERTID *cid;
    ASN1_TIME *revtime, *thisupd, *nextupd;
    int status, reason;
    X509_EXTENSION *x509ext;
    VALUE ret, ary, ext;
    int count, ext_count, i, j;

    GetOCSPBasicRes(self, bs);
    ret = rb_ary_new();
    count = OCSP_resp_count(bs);
    for(i = 0; i < count; i++){
  single = OCSP_resp_get0(bs, i);
  if(!single) continue;

  revtime = thisupd = nextupd = NULL;
  status = OCSP_single_get0_status(single, &reason, &revtime,
           &thisupd, &nextupd);
  if(status < 0) continue;
  if(!(cid = OCSP_CERTID_dup((OCSP_CERTID *)OCSP_SINGLERESP_get0_id(single)))) /* FIXME */
      ossl_raise(eOCSPError, NULL);
  ary = rb_ary_new();
  rb_ary_push(ary, ossl_ocspcertid_new(cid));
  rb_ary_push(ary, INT2NUM(status));
  rb_ary_push(ary, INT2NUM(reason));
  rb_ary_push(ary, revtime ? asn1time_to_time(revtime) : Qnil);
  rb_ary_push(ary, thisupd ? asn1time_to_time(thisupd) : Qnil);
  rb_ary_push(ary, nextupd ? asn1time_to_time(nextupd) : Qnil);
  ext = rb_ary_new();
  ext_count = OCSP_SINGLERESP_get_ext_count(single);
  for(j = 0; j < ext_count; j++){
      x509ext = OCSP_SINGLERESP_get_ext(single, j);
      rb_ary_push(ext, ossl_x509ext_new(x509ext));
  }
  rb_ary_push(ary, ext);
  rb_ary_push(ret, ary);
    }

    return ret;
}