summaryrefslogtreecommitdiffstats
path: root/OpenSSL/OCSP/BasicResponse.html
blob: 4c3aac19ed8ddeb594c193eaff52e5a59ef12f6d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
<!DOCTYPE html>

<html>
<head>
<meta charset="UTF-8">

<title>class OpenSSL::OCSP::BasicResponse - RDoc Documentation</title>

<script type="text/javascript">
  var rdoc_rel_prefix = "../../";
  var index_rel_prefix = "../../";
</script>

<script src="../../js/navigation.js" defer></script>
<script src="../../js/search.js" defer></script>
<script src="../../js/search_index.js" defer></script>
<script src="../../js/searcher.js" defer></script>
<script src="../../js/darkfish.js" defer></script>

<link href="../../css/fonts.css" rel="stylesheet">
<link href="../../css/rdoc.css" rel="stylesheet">


<body id="top" role="document" class="class">
<nav role="navigation">
  <div id="project-navigation">
    <div id="home-section" role="region" title="Quick navigation" class="nav-section">
  <h2>
    <a href="../../index.html" rel="home">Home</a>
  </h2>

  <div id="table-of-contents-navigation">
    <a href="../../table_of_contents.html#pages">Pages</a>
    <a href="../../table_of_contents.html#classes">Classes</a>
    <a href="../../table_of_contents.html#methods">Methods</a>
  </div>
</div>

    <div id="search-section" role="search" class="project-section initially-hidden">
  <form action="#" method="get" accept-charset="utf-8">
    <div id="search-field-wrapper">
      <input id="search-field" role="combobox" aria-label="Search"
             aria-autocomplete="list" aria-controls="search-results"
             type="text" name="search" placeholder="Search" spellcheck="false"
             title="Type to search, Up and Down to navigate, Enter to load">
    </div>

    <ul id="search-results" aria-label="Search Results"
        aria-busy="false" aria-expanded="false"
        aria-atomic="false" class="initially-hidden"></ul>
  </form>
</div>

  </div>

  

  <div id="class-metadata">
    
    
<div id="parent-class-section" class="nav-section">
  <h3>Parent</h3>

  <p class="link">Object
</div>

    
    
    
<!-- Method Quickref -->
<div id="method-list-section" class="nav-section">
  <h3>Methods</h3>

  <ul class="link-list" role="directory">
    <li ><a href="#method-c-new">::new</a>
    <li ><a href="#method-i-add_nonce">#add_nonce</a>
    <li ><a href="#method-i-add_status">#add_status</a>
    <li ><a href="#method-i-copy_nonce">#copy_nonce</a>
    <li ><a href="#method-i-find_response">#find_response</a>
    <li ><a href="#method-i-initialize_copy">#initialize_copy</a>
    <li ><a href="#method-i-responses">#responses</a>
    <li ><a href="#method-i-sign">#sign</a>
    <li ><a href="#method-i-status">#status</a>
    <li ><a href="#method-i-to_der">#to_der</a>
    <li ><a href="#method-i-verify">#verify</a>
  </ul>
</div>

  </div>
</nav>

<main role="main" aria-labelledby="class-OpenSSL::OCSP::BasicResponse">
  <h1 id="class-OpenSSL::OCSP::BasicResponse" class="class">
    class OpenSSL::OCSP::BasicResponse
  </h1>

  <section class="description">
    
<p>An <a href="BasicResponse.html"><code>OpenSSL::OCSP::BasicResponse</code></a> contains the status of a certificate check which is created from an <a href="Request.html"><code>OpenSSL::OCSP::Request</code></a>.  A <a href="BasicResponse.html"><code>BasicResponse</code></a> is more detailed than a <a href="Response.html"><code>Response</code></a>.</p>

  </section>

  <section id="5Buntitled-5D" class="documentation-section">





     <section id="public-class-5Buntitled-5D-method-details" class="method-section">
       <header>
         <h3>Public Class Methods</h3>
       </header>

      <div id="method-c-new" class="method-detail ">
        <div class="method-heading">
          <span class="method-callseq">
            OpenSSL::OCSP::BasicResponse.new(der_string = nil) &rarr; basic_response
          </span>
          <span class="method-click-advice">click to toggle source</span>
        </div>

        <div class="method-description">
          <p>Creates a new <a href="BasicResponse.html"><code>BasicResponse</code></a>. If <em>der_string</em> is given, decodes <em>der_string</em> as DER.</p>

          <div class="method-source-code" id="new-source">
            <pre>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, &quot;01&quot;, &amp;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, &amp;p, RSTRING_LEN(arg));
        if (!res_new)
            ossl_raise(eOCSPError, &quot;d2i_OCSP_BASICRESP&quot;);
        SetOCSPBasicRes(self, res_new);
        OCSP_BASICRESP_free(res);
    }

    return self;
}</pre>
          </div>
        </div>


      </div>

    </section>

     <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
       <header>
         <h3>Public Instance Methods</h3>
       </header>

      <div id="method-i-add_nonce" class="method-detail ">
        <div class="method-heading">
          <span class="method-callseq">
            add_nonce(nonce = nil)
          </span>
          <span class="method-click-advice">click to toggle source</span>
        </div>

        <div class="method-description">
          <p>Adds <em>nonce</em> to this response.  If no nonce was provided a random nonce will be added.</p>

          <div class="method-source-code" id="add_nonce-source">
            <pre>static VALUE
ossl_ocspbres_add_nonce(int argc, VALUE *argv, VALUE self)
{
    OCSP_BASICRESP *bs;
    VALUE val;
    int ret;

    rb_scan_args(argc, argv, &quot;01&quot;, &amp;val);
    if(NIL_P(val)) {
        GetOCSPBasicRes(self, bs);
        ret = OCSP_basic_add1_nonce(bs, NULL, -1);
    }
    else{
        StringValue(val);
        GetOCSPBasicRes(self, bs);
        ret = OCSP_basic_add1_nonce(bs, (unsigned char *)RSTRING_PTR(val), RSTRING_LENINT(val));
    }
    if(!ret) ossl_raise(eOCSPError, NULL);

    return self;
}</pre>
          </div>
        </div>


      </div>

      <div id="method-i-add_status" class="method-detail ">
        <div class="method-heading">
          <span class="method-callseq">
            add_status(certificate_id, status, reason, revocation_time, this_update, next_update, extensions) &rarr; basic_response
          </span>
          <span class="method-click-advice">click to toggle source</span>
        </div>

        <div class="method-description">
          <p>Adds a certificate status for <em>certificate_id</em>. <em>status</em> is the status, and must be one of these:</p>
<ul><li>
<p>OpenSSL::OCSP::V_CERTSTATUS_GOOD</p>
</li><li>
<p>OpenSSL::OCSP::V_CERTSTATUS_REVOKED</p>
</li><li>
<p>OpenSSL::OCSP::V_CERTSTATUS_UNKNOWN</p>
</li></ul>

<p><em>reason</em> and <em>revocation_time</em> can be given only when <em>status</em> is OpenSSL::OCSP::V_CERTSTATUS_REVOKED. <em>reason</em> describes the reason for the revocation, and must be one of OpenSSL::OCSP::REVOKED_STATUS_* constants. <em>revocation_time</em> is the time when the certificate is revoked.</p>

<p><em>this_update</em> and <em>next_update</em> indicate the time at which the status is verified to be correct and the time at or before which newer information will be available, respectively. <em>next_update</em> is optional.</p>

<p><em>extensions</em> is an Array of <a href="../X509/Extension.html"><code>OpenSSL::X509::Extension</code></a> to be included in the <a href="SingleResponse.html"><code>SingleResponse</code></a>. This is also optional.</p>

<p>Note that the times, <em>revocation_time</em>, <em>this_update</em> and <em>next_update</em> can be specified in either of <a href="../../Integer.html"><code>Integer</code></a> or Time object. If they are <a href="../../Integer.html"><code>Integer</code></a>, it is treated as the relative seconds from the current time.</p>

          <div class="method-source-code" id="add_status-source">
            <pre>static VALUE
ossl_ocspbres_add_status(VALUE self, VALUE cid, VALUE status,
                         VALUE reason, VALUE revtime,
                         VALUE thisupd, VALUE nextupd, VALUE ext)
{
    OCSP_BASICRESP *bs;
    OCSP_SINGLERESP *single;
    OCSP_CERTID *id;
    ASN1_TIME *ths = NULL, *nxt = NULL, *rev = NULL;
    int st, rsn = 0, error = 0, rstatus = 0;
    long i;
    VALUE tmp;

    GetOCSPBasicRes(self, bs);
    GetOCSPCertId(cid, id);
    st = NUM2INT(status);
    if (!NIL_P(ext)) { /* All ext&#39;s members must be X509::Extension */
        ext = rb_check_array_type(ext);
        for (i = 0; i &lt; RARRAY_LEN(ext); i++)
            OSSL_Check_Kind(RARRAY_AREF(ext, i), cX509Ext);
    }

    if (st == V_OCSP_CERTSTATUS_REVOKED) {
        rsn = NUM2INT(reason);
        tmp = rb_protect(add_status_convert_time, revtime, &amp;rstatus);
        if (rstatus) goto err;
        rev = (ASN1_TIME *)tmp;
    }

    tmp = rb_protect(add_status_convert_time, thisupd, &amp;rstatus);
    if (rstatus) goto err;
    ths = (ASN1_TIME *)tmp;

    if (!NIL_P(nextupd)) {
        tmp = rb_protect(add_status_convert_time, nextupd, &amp;rstatus);
        if (rstatus) goto err;
        nxt = (ASN1_TIME *)tmp;
    }

    if(!(single = OCSP_basic_add1_status(bs, id, st, rsn, rev, ths, nxt))){
        error = 1;
        goto err;
    }

    if(!NIL_P(ext)){
        X509_EXTENSION *x509ext;

        for(i = 0; i &lt; RARRAY_LEN(ext); i++){
            x509ext = GetX509ExtPtr(RARRAY_AREF(ext, i));
            if(!OCSP_SINGLERESP_add_ext(single, x509ext, -1)){
                error = 1;
                goto err;
            }
        }
    }

 err:
    ASN1_TIME_free(ths);
    ASN1_TIME_free(nxt);
    ASN1_TIME_free(rev);
    if(error) ossl_raise(eOCSPError, NULL);
    if(rstatus) rb_jump_tag(rstatus);

    return self;
}</pre>
          </div>
        </div>


      </div>

      <div id="method-i-copy_nonce" class="method-detail ">
        <div class="method-heading">
          <span class="method-callseq">
            copy_nonce(request) &rarr; Integer
          </span>
          <span class="method-click-advice">click to toggle source</span>
        </div>

        <div class="method-description">
          <p>Copies the nonce from <em>request</em> into this response.  Returns 1 on success and 0 on failure.</p>

          <div class="method-source-code" id="copy_nonce-source">
            <pre>static VALUE
ossl_ocspbres_copy_nonce(VALUE self, VALUE request)
{
    OCSP_BASICRESP *bs;
    OCSP_REQUEST *req;
    int ret;

    GetOCSPBasicRes(self, bs);
    GetOCSPReq(request, req);
    ret = OCSP_copy_nonce(bs, req);

    return INT2NUM(ret);
}</pre>
          </div>
        </div>


      </div>

      <div id="method-i-find_response" class="method-detail ">
        <div class="method-heading">
          <span class="method-callseq">
            find_response(certificate_id) &rarr; SingleResponse | nil
          </span>
          <span class="method-click-advice">click to toggle source</span>
        </div>

        <div class="method-description">
          <p>Returns a <a href="SingleResponse.html"><code>SingleResponse</code></a> whose CertId matches with <em>certificate_id</em>, or <code>nil</code> if this <a href="BasicResponse.html"><code>BasicResponse</code></a> does not contain it.</p>

          <div class="method-source-code" id="find_response-source">
            <pre>static VALUE
ossl_ocspbres_find_response(VALUE self, VALUE target)
{
    OCSP_BASICRESP *bs;
    OCSP_SINGLERESP *sres, *sres_new;
    OCSP_CERTID *id;
    int n;

    GetOCSPCertId(target, id);
    GetOCSPBasicRes(self, bs);

    if ((n = OCSP_resp_find(bs, id, -1)) == -1)
        return Qnil;

    sres = OCSP_resp_get0(bs, n);
    sres_new = ASN1_item_dup(ASN1_ITEM_rptr(OCSP_SINGLERESP), sres);
    if (!sres_new)
        ossl_raise(eOCSPError, &quot;ASN1_item_dup&quot;);

    return ossl_ocspsres_new(sres_new);
}</pre>
          </div>
        </div>


      </div>

      <div id="method-i-initialize_copy" class="method-detail ">
        <div class="method-heading">
          <span class="method-name">initialize_copy</span><span
            class="method-args">(p1)</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>

        <div class="method-description">
          

          <div class="method-source-code" id="initialize_copy-source">
            <pre>static VALUE
ossl_ocspbres_initialize_copy(VALUE self, VALUE other)
{
    OCSP_BASICRESP *bs, *bs_old, *bs_new;

    rb_check_frozen(self);
    GetOCSPBasicRes(self, bs_old);
    GetOCSPBasicRes(other, bs);

    bs_new = ASN1_item_dup(ASN1_ITEM_rptr(OCSP_BASICRESP), bs);
    if (!bs_new)
        ossl_raise(eOCSPError, &quot;ASN1_item_dup&quot;);

    SetOCSPBasicRes(self, bs_new);
    OCSP_BASICRESP_free(bs_old);

    return self;
}</pre>
          </div>
        </div>


      </div>

      <div id="method-i-responses" class="method-detail ">
        <div class="method-heading">
          <span class="method-callseq">
            responses &rarr; Array of SingleResponse
          </span>
          <span class="method-click-advice">click to toggle source</span>
        </div>

        <div class="method-description">
          <p>Returns an Array of <a href="SingleResponse.html"><code>SingleResponse</code></a> for this <a href="BasicResponse.html"><code>BasicResponse</code></a>.</p>

          <div class="method-source-code" id="responses-source">
            <pre>static VALUE
ossl_ocspbres_get_responses(VALUE self)
{
    OCSP_BASICRESP *bs;
    VALUE ret;
    int count, i;

    GetOCSPBasicRes(self, bs);
    count = OCSP_resp_count(bs);
    ret = rb_ary_new2(count);

    for (i = 0; i &lt; count; i++) {
        OCSP_SINGLERESP *sres, *sres_new;

        sres = OCSP_resp_get0(bs, i);
        sres_new = ASN1_item_dup(ASN1_ITEM_rptr(OCSP_SINGLERESP), sres);
        if (!sres_new)
            ossl_raise(eOCSPError, &quot;ASN1_item_dup&quot;);

        rb_ary_push(ret, ossl_ocspsres_new(sres_new));
    }

    return ret;
}</pre>
          </div>
        </div>


      </div>

      <div id="method-i-sign" class="method-detail ">
        <div class="method-heading">
          <span class="method-callseq">
            sign(cert, key, certs = nil, flags = 0, digest = nil) &rarr; self
          </span>
          <span class="method-click-advice">click to toggle source</span>
        </div>

        <div class="method-description">
          <p>Signs this <a href="../OCSP.html"><code>OCSP</code></a> response using the <em>cert</em>, <em>key</em> and optional <em>digest</em>. This behaves in the similar way as <a href="Request.html#method-i-sign"><code>OpenSSL::OCSP::Request#sign</code></a>.</p>

<p><em>flags</em> can include:</p>
<dl class="rdoc-list note-list"><dt>OpenSSL::OCSP::NOCERTS
<dd>
<p>don’t include certificates</p>
</dd><dt>OpenSSL::OCSP::NOTIME
<dd>
<p>don’t set producedAt</p>
</dd><dt>OpenSSL::OCSP::RESPID_KEY
<dd>
<p>use signer’s public key hash as responderID</p>
</dd></dl>

          <div class="method-source-code" id="sign-source">
            <pre>static VALUE
ossl_ocspbres_sign(int argc, VALUE *argv, VALUE self)
{
    VALUE signer_cert, signer_key, certs, flags, digest;
    OCSP_BASICRESP *bs;
    X509 *signer;
    EVP_PKEY *key;
    STACK_OF(X509) *x509s = NULL;
    unsigned long flg = 0;
    const EVP_MD *md;
    int ret;

    rb_scan_args(argc, argv, &quot;23&quot;, &amp;signer_cert, &amp;signer_key, &amp;certs, &amp;flags, &amp;digest);
    GetOCSPBasicRes(self, bs);
    signer = GetX509CertPtr(signer_cert);
    key = GetPrivPKeyPtr(signer_key);
    if (!NIL_P(flags))
        flg = NUM2INT(flags);
    if (NIL_P(digest))
        md = EVP_sha1();
    else
        md = ossl_evp_get_digestbyname(digest);
    if (NIL_P(certs))
        flg |= OCSP_NOCERTS;
    else
        x509s = ossl_x509_ary2sk(certs);

    ret = OCSP_basic_sign(bs, signer, key, md, x509s, flg);
    sk_X509_pop_free(x509s, X509_free);
    if (!ret) ossl_raise(eOCSPError, NULL);

    return self;
}</pre>
          </div>
        </div>


      </div>

      <div id="method-i-status" class="method-detail ">
        <div class="method-heading">
          <span class="method-callseq">
            status &rarr; statuses
          </span>
          <span class="method-click-advice">click to toggle source</span>
        </div>

        <div class="method-description">
          <p>Returns an Array of statuses for this response.  Each status contains a <a href="CertificateId.html"><code>CertificateId</code></a>, 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 <a href="../X509/Extension.html"><code>OpenSSL::X509::Extension</code></a>.</p>

<p>This should be superseded by <a href="BasicResponse.html#method-i-responses"><code>BasicResponse#responses</code></a> and <a href="BasicResponse.html#method-i-find_response"><code>find_response</code></a> that return <a href="SingleResponse.html"><code>SingleResponse</code></a>.</p>

          <div class="method-source-code" id="status-source">
            <pre>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 &lt; count; i++){
        single = OCSP_resp_get0(bs, i);
        if(!single) continue;

        revtime = thisupd = nextupd = NULL;
        status = OCSP_single_get0_status(single, &amp;reason, &amp;revtime,
                                         &amp;thisupd, &amp;nextupd);
        if(status &lt; 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 &lt; 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;
}</pre>
          </div>
        </div>


      </div>

      <div id="method-i-to_der" class="method-detail ">
        <div class="method-heading">
          <span class="method-callseq">
            to_der &rarr; String
          </span>
          <span class="method-click-advice">click to toggle source</span>
        </div>

        <div class="method-description">
          <p>Encodes this basic response into a DER-encoded string.</p>

          <div class="method-source-code" id="to_der-source">
            <pre>static VALUE
ossl_ocspbres_to_der(VALUE self)
{
    OCSP_BASICRESP *res;
    VALUE str;
    long len;
    unsigned char *p;

    GetOCSPBasicRes(self, res);
    if ((len = i2d_OCSP_BASICRESP(res, NULL)) &lt;= 0)
        ossl_raise(eOCSPError, NULL);
    str = rb_str_new(0, len);
    p = (unsigned char *)RSTRING_PTR(str);
    if (i2d_OCSP_BASICRESP(res, &amp;p) &lt;= 0)
        ossl_raise(eOCSPError, NULL);
    ossl_str_adjust(str, p);

    return str;
}</pre>
          </div>
        </div>


      </div>

      <div id="method-i-verify" class="method-detail ">
        <div class="method-heading">
          <span class="method-callseq">
            verify(certificates, store, flags = 0) &rarr; true or false
          </span>
          <span class="method-click-advice">click to toggle source</span>
        </div>

        <div class="method-description">
          <p>Verifies the signature of the response using the given <em>certificates</em> and <em>store</em>. This works in the similar way as <a href="Request.html#method-i-verify"><code>OpenSSL::OCSP::Request#verify</code></a>.</p>

          <div class="method-source-code" id="verify-source">
            <pre>static VALUE
ossl_ocspbres_verify(int argc, VALUE *argv, VALUE self)
{
    VALUE certs, store, flags;
    OCSP_BASICRESP *bs;
    STACK_OF(X509) *x509s;
    X509_STORE *x509st;
    int flg, result;

    rb_scan_args(argc, argv, &quot;21&quot;, &amp;certs, &amp;store, &amp;flags);
    GetOCSPBasicRes(self, bs);
    x509st = GetX509StorePtr(store);
    flg = NIL_P(flags) ? 0 : NUM2INT(flags);
    x509s = ossl_x509_ary2sk(certs);
    result = OCSP_basic_verify(bs, x509s, x509st, flg);
    sk_X509_pop_free(x509s, X509_free);
    if (result &lt;= 0)
        ossl_clear_error();

    return result &gt; 0 ? Qtrue : Qfalse;
}</pre>
          </div>
        </div>


      </div>

    </section>

  </section>
</main>


<footer id="validator-badges" role="contentinfo">
  <p><a href="https://validator.w3.org/check/referer">Validate</a>
  <p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.3.2.
  <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
</footer>