summaryrefslogtreecommitdiff
path: root/manual/html_node/OCSP-API.html
blob: c9608059e0a2c230a19e9911f7ac3a3b51853d5f (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
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- This manual is last updated 4 March 2015 for version
3.4.9 of GnuTLS.

Copyright (C) 2001-2015 Free Software Foundation, Inc.\\
Copyright (C) 2001-2015 Nikos Mavrogiannopoulos

Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.  A
copy of the license is included in the section entitled "GNU Free
Documentation License". -->
<!-- Created by GNU Texinfo 6.0, http://www.gnu.org/software/texinfo/ -->
<head>
<title>GnuTLS 3.4.9: OCSP API</title>

<meta name="description" content="GnuTLS 3.4.9: OCSP API">
<meta name="keywords" content="GnuTLS 3.4.9: OCSP API">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Function-and-Data-Index.html#Function-and-Data-Index" rel="index" title="Function and Data Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="API-reference.html#API-reference" rel="up" title="API reference">
<link href="OpenPGP-API.html#OpenPGP-API" rel="next" title="OpenPGP API">
<link href="PKCS-7-API.html#PKCS-7-API" rel="prev" title="PKCS 7 API">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nocodebreak {white-space: nowrap}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: serif; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
body { 
	margin: 2%;
	padding: 0 5%;
	background: #ffffff;
}
h1,h2,h3,h4,h5 {
    font-weight: bold;
    padding: 5px 5px 5px 5px;
    background-color: #c2e0ff;
    color: #336699;
}
h1 {
    padding: 2em 2em 2em 5%;
    color: white;
    background: #336699;
    text-align: center;
    letter-spacing: 3px;
}
h2 { text-decoration: underline; }
pre {
  margin: 0 5%;
  padding: 0.5em;
}
pre.example,pre.verbatim {
  padding-bottom: 1em;

  border: solid #c2e0ff;
  background: #f0faff;
  border-width: 1px 1px 1px 5px;
  margin: 1em auto;
  width: 90%;
}

div.node {
  margin: 0 -5% 0 -2%;
  padding: 0.5em 0.5em;
  margin-top: 0.5em;
  margin-bottom: 0.5em;
  font-weight: bold;
}
dd, li {
  padding-top: 0.1em;
  padding-bottom: 0.1em;
}
div.float {

  margin-bottom: 0.5em;
  text-align: center;
}

table {
  text-align: left;
  margin-left:auto;
  margin-right:auto;
  border-spacing: 7px;
  width: 50%;
}

th {
  padding: 0;
  color: #336699;
  background-color: #c2e0ff;
  border: solid #000000;
  border-width: 0px;
  margin: 1em auto;
  text-align: center;
  margin-left:auto;
  margin-right:auto;
}

td {
  padding: 0;
  border: solid #000000;
  background-color: #f0faff;
  border-width: 0px;
  margin: 1em auto;
  text-align: left;
  margin-left:auto;
  margin-right:auto;
  padding-left: 1em;
}

dl {
  text-align: left;
  margin-left:auto;
  margin-right:auto;
  width: 50%;

  padding-left: 1em;
  border: solid #c2e0ff;
  background: #f0faff;
  border-width: 5px 1px 1px 1px;
  margin: 1em auto;
}

-->
</style>


</head>

<body lang="en">
<a name="OCSP-API"></a>
<div class="header">
<p>
Next: <a href="OpenPGP-API.html#OpenPGP-API" accesskey="n" rel="next">OpenPGP API</a>, Previous: <a href="PKCS-7-API.html#PKCS-7-API" accesskey="p" rel="prev">PKCS 7 API</a>, Up: <a href="API-reference.html#API-reference" accesskey="u" rel="up">API reference</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Function-and-Data-Index.html#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="OCSP-API-1"></a>
<h3 class="section">E.5 <acronym>OCSP</acronym> API</h3>
<a name="index-OCSP-Functions"></a>

<p>The following functions are for <acronym>OCSP</acronym> certificate status
checking.  Their prototypes lie in <samp>gnutls/ocsp.h</samp>.
</p>

<a name="gnutls_005focsp_005freq_005fadd_005fcert-1"></a>
<h4 class="subheading">gnutls_ocsp_req_add_cert</h4>
<a name="gnutls_005focsp_005freq_005fadd_005fcert"></a><dl>
<dt><a name="index-gnutls_005focsp_005freq_005fadd_005fcert"></a>Function: <em>int</em> <strong>gnutls_ocsp_req_add_cert</strong> <em>(gnutls_ocsp_req_t <var>req</var>, gnutls_digest_algorithm_t <var>digest</var>, gnutls_x509_crt_t <var>issuer</var>, gnutls_x509_crt_t <var>cert</var>)</em></dt>
<dd><p><var>req</var>: should contain a <code>gnutls_ocsp_req_t</code>  type
</p>
<p><var>digest</var>: hash algorithm, a <code>gnutls_digest_algorithm_t</code>  value
</p>
<p><var>issuer</var>: issuer of  <code>subject</code> certificate
</p>
<p><var>cert</var>: certificate to request status for
</p>
<p>This function will add another request to the OCSP request for a
particular certificate.  The issuer name hash, issuer key hash, and
serial number fields is populated as follows.  The issuer name and
the serial number is taken from  <code>cert</code> .  The issuer key is taken
from  <code>issuer</code> .  The hashed values will be hashed using the  <code>digest</code> algorithm, normally <code>GNUTLS_DIG_SHA1</code> .
</p>
<p><strong>Returns:</strong> On success, <code>GNUTLS_E_SUCCESS</code>  (0) is returned, otherwise a
negative error code is returned.
</p></dd></dl>

<a name="gnutls_005focsp_005freq_005fadd_005fcert_005fid-1"></a>
<h4 class="subheading">gnutls_ocsp_req_add_cert_id</h4>
<a name="gnutls_005focsp_005freq_005fadd_005fcert_005fid"></a><dl>
<dt><a name="index-gnutls_005focsp_005freq_005fadd_005fcert_005fid"></a>Function: <em>int</em> <strong>gnutls_ocsp_req_add_cert_id</strong> <em>(gnutls_ocsp_req_t <var>req</var>, gnutls_digest_algorithm_t <var>digest</var>, const gnutls_datum_t * <var>issuer_name_hash</var>, const gnutls_datum_t * <var>issuer_key_hash</var>, const gnutls_datum_t * <var>serial_number</var>)</em></dt>
<dd><p><var>req</var>: should contain a <code>gnutls_ocsp_req_t</code>  type
</p>
<p><var>digest</var>: hash algorithm, a <code>gnutls_digest_algorithm_t</code>  value
</p>
<p><var>issuer_name_hash</var>: hash of issuer&rsquo;s DN
</p>
<p><var>issuer_key_hash</var>: hash of issuer&rsquo;s public key
</p>
<p><var>serial_number</var>: serial number of certificate to check
</p>
<p>This function will add another request to the OCSP request for a
particular certificate having the issuer name hash of
 <code>issuer_name_hash</code> and issuer key hash of  <code>issuer_key_hash</code> (both
hashed using  <code>digest</code> ) and serial number  <code>serial_number</code> .
</p>
<p>The information needed corresponds to the CertID structure:
</p>
<p>&lt;informalexample&gt;&lt;programlisting&gt;
CertID          ::=     SEQUENCE {
hashAlgorithm       AlgorithmIdentifier,
issuerNameHash      OCTET STRING, &ndash; Hash of Issuer&rsquo;s DN
issuerKeyHash       OCTET STRING, &ndash; Hash of Issuers public key
serialNumber        CertificateSerialNumber }
&lt;/programlisting&gt;&lt;/informalexample&gt;
</p>
<p><strong>Returns:</strong> On success, <code>GNUTLS_E_SUCCESS</code>  (0) is returned, otherwise a
negative error code is returned.
</p></dd></dl>

<a name="gnutls_005focsp_005freq_005fdeinit-1"></a>
<h4 class="subheading">gnutls_ocsp_req_deinit</h4>
<a name="gnutls_005focsp_005freq_005fdeinit"></a><dl>
<dt><a name="index-gnutls_005focsp_005freq_005fdeinit"></a>Function: <em>void</em> <strong>gnutls_ocsp_req_deinit</strong> <em>(gnutls_ocsp_req_t <var>req</var>)</em></dt>
<dd><p><var>req</var>: The data to be deinitialized
</p>
<p>This function will deinitialize a OCSP request structure.
</p></dd></dl>

<a name="gnutls_005focsp_005freq_005fexport-1"></a>
<h4 class="subheading">gnutls_ocsp_req_export</h4>
<a name="gnutls_005focsp_005freq_005fexport"></a><dl>
<dt><a name="index-gnutls_005focsp_005freq_005fexport"></a>Function: <em>int</em> <strong>gnutls_ocsp_req_export</strong> <em>(gnutls_ocsp_req_t <var>req</var>, gnutls_datum_t * <var>data</var>)</em></dt>
<dd><p><var>req</var>: Holds the OCSP request
</p>
<p><var>data</var>: newly allocate buffer holding DER encoded OCSP request
</p>
<p>This function will export the OCSP request to DER format.
</p>
<p><strong>Returns:</strong> In case of failure a negative error code will be
returned, and 0 on success.
</p></dd></dl>

<a name="gnutls_005focsp_005freq_005fget_005fcert_005fid-1"></a>
<h4 class="subheading">gnutls_ocsp_req_get_cert_id</h4>
<a name="gnutls_005focsp_005freq_005fget_005fcert_005fid"></a><dl>
<dt><a name="index-gnutls_005focsp_005freq_005fget_005fcert_005fid"></a>Function: <em>int</em> <strong>gnutls_ocsp_req_get_cert_id</strong> <em>(gnutls_ocsp_req_t <var>req</var>, unsigned <var>indx</var>, gnutls_digest_algorithm_t * <var>digest</var>, gnutls_datum_t * <var>issuer_name_hash</var>, gnutls_datum_t * <var>issuer_key_hash</var>, gnutls_datum_t * <var>serial_number</var>)</em></dt>
<dd><p><var>req</var>: should contain a <code>gnutls_ocsp_req_t</code>  type
</p>
<p><var>indx</var>: Specifies which extension OID to get. Use (0) to get the first one.
</p>
<p><var>digest</var>: output variable with <code>gnutls_digest_algorithm_t</code>  hash algorithm
</p>
<p><var>issuer_name_hash</var>: output buffer with hash of issuer&rsquo;s DN
</p>
<p><var>issuer_key_hash</var>: output buffer with hash of issuer&rsquo;s public key
</p>
<p><var>serial_number</var>: output buffer with serial number of certificate to check
</p>
<p>This function will return the certificate information of the
 <code>indx</code> &rsquo;ed request in the OCSP request.  The information returned
corresponds to the CertID structure:
</p>
<p>&lt;informalexample&gt;&lt;programlisting&gt;
CertID          ::=     SEQUENCE {
hashAlgorithm       AlgorithmIdentifier,
issuerNameHash      OCTET STRING, &ndash; Hash of Issuer&rsquo;s DN
issuerKeyHash       OCTET STRING, &ndash; Hash of Issuers public key
serialNumber        CertificateSerialNumber }
&lt;/programlisting&gt;&lt;/informalexample&gt;
</p>
<p>Each of the pointers to output variables may be NULL to indicate
that the caller is not interested in that value.
</p>
<p><strong>Returns:</strong> On success, <code>GNUTLS_E_SUCCESS</code>  (0) is returned, otherwise a
negative error code is returned.  If you have reached the last
CertID available <code>GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code>  will be
returned.
</p></dd></dl>

<a name="gnutls_005focsp_005freq_005fget_005fextension-1"></a>
<h4 class="subheading">gnutls_ocsp_req_get_extension</h4>
<a name="gnutls_005focsp_005freq_005fget_005fextension"></a><dl>
<dt><a name="index-gnutls_005focsp_005freq_005fget_005fextension"></a>Function: <em>int</em> <strong>gnutls_ocsp_req_get_extension</strong> <em>(gnutls_ocsp_req_t <var>req</var>, unsigned <var>indx</var>, gnutls_datum_t * <var>oid</var>, unsigned int * <var>critical</var>, gnutls_datum_t * <var>data</var>)</em></dt>
<dd><p><var>req</var>: should contain a <code>gnutls_ocsp_req_t</code>  type
</p>
<p><var>indx</var>: Specifies which extension OID to get. Use (0) to get the first one.
</p>
<p><var>oid</var>: will hold newly allocated buffer with OID of extension, may be NULL
</p>
<p><var>critical</var>: output variable with critical flag, may be NULL.
</p>
<p><var>data</var>: will hold newly allocated buffer with extension data, may be NULL
</p>
<p>This function will return all information about the requested
extension in the OCSP request.  The information returned is the
OID, the critical flag, and the data itself.  The extension OID
will be stored as a string.  Any of  <code>oid</code> ,  <code>critical</code> , and  <code>data</code> may
be NULL which means that the caller is not interested in getting
that information back.
</p>
<p>The caller needs to deallocate memory by calling <code>gnutls_free()</code>  on
 <code>oid</code> -&gt;data and  <code>data</code> -&gt;data.
</p>
<p><strong>Returns:</strong> On success, <code>GNUTLS_E_SUCCESS</code>  (0) is returned, otherwise a
negative error code is returned.  If you have reached the last
extension available <code>GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code>  will
be returned.
</p></dd></dl>

<a name="gnutls_005focsp_005freq_005fget_005fnonce-1"></a>
<h4 class="subheading">gnutls_ocsp_req_get_nonce</h4>
<a name="gnutls_005focsp_005freq_005fget_005fnonce"></a><dl>
<dt><a name="index-gnutls_005focsp_005freq_005fget_005fnonce"></a>Function: <em>int</em> <strong>gnutls_ocsp_req_get_nonce</strong> <em>(gnutls_ocsp_req_t <var>req</var>, unsigned int * <var>critical</var>, gnutls_datum_t * <var>nonce</var>)</em></dt>
<dd><p><var>req</var>: should contain a <code>gnutls_ocsp_req_t</code>  type
</p>
<p><var>critical</var>: whether nonce extension is marked critical, or NULL
</p>
<p><var>nonce</var>: will hold newly allocated buffer with nonce data
</p>
<p>This function will return the OCSP request nonce extension data.
</p>
<p>The caller needs to deallocate memory by calling <code>gnutls_free()</code>  on
 <code>nonce</code> -&gt;data.
</p>
<p><strong>Returns:</strong> On success, <code>GNUTLS_E_SUCCESS</code>  (0) is returned, otherwise a
negative error code is returned.
</p></dd></dl>

<a name="gnutls_005focsp_005freq_005fget_005fversion-1"></a>
<h4 class="subheading">gnutls_ocsp_req_get_version</h4>
<a name="gnutls_005focsp_005freq_005fget_005fversion"></a><dl>
<dt><a name="index-gnutls_005focsp_005freq_005fget_005fversion"></a>Function: <em>int</em> <strong>gnutls_ocsp_req_get_version</strong> <em>(gnutls_ocsp_req_t <var>req</var>)</em></dt>
<dd><p><var>req</var>: should contain a <code>gnutls_ocsp_req_t</code>  type
</p>
<p>This function will return the version of the OCSP request.
Typically this is always 1 indicating version 1.
</p>
<p><strong>Returns:</strong> version of OCSP request, or a negative error code on error.
</p></dd></dl>

<a name="gnutls_005focsp_005freq_005fimport-1"></a>
<h4 class="subheading">gnutls_ocsp_req_import</h4>
<a name="gnutls_005focsp_005freq_005fimport"></a><dl>
<dt><a name="index-gnutls_005focsp_005freq_005fimport"></a>Function: <em>int</em> <strong>gnutls_ocsp_req_import</strong> <em>(gnutls_ocsp_req_t <var>req</var>, const gnutls_datum_t * <var>data</var>)</em></dt>
<dd><p><var>req</var>: The data to store the parsed request.
</p>
<p><var>data</var>: DER encoded OCSP request.
</p>
<p>This function will convert the given DER encoded OCSP request to
the native <code>gnutls_ocsp_req_t</code>  format. The output will be stored in
 <code>req</code> .
</p>
<p><strong>Returns:</strong> On success, <code>GNUTLS_E_SUCCESS</code>  (0) is returned, otherwise a
negative error value.
</p></dd></dl>

<a name="gnutls_005focsp_005freq_005finit-1"></a>
<h4 class="subheading">gnutls_ocsp_req_init</h4>
<a name="gnutls_005focsp_005freq_005finit"></a><dl>
<dt><a name="index-gnutls_005focsp_005freq_005finit"></a>Function: <em>int</em> <strong>gnutls_ocsp_req_init</strong> <em>(gnutls_ocsp_req_t * <var>req</var>)</em></dt>
<dd><p><var>req</var>: A pointer to the type to be initialized
</p>
<p>This function will initialize an OCSP request structure.
</p>
<p><strong>Returns:</strong> On success, <code>GNUTLS_E_SUCCESS</code>  (0) is returned, otherwise a
negative error value.
</p></dd></dl>

<a name="gnutls_005focsp_005freq_005fprint-1"></a>
<h4 class="subheading">gnutls_ocsp_req_print</h4>
<a name="gnutls_005focsp_005freq_005fprint"></a><dl>
<dt><a name="index-gnutls_005focsp_005freq_005fprint"></a>Function: <em>int</em> <strong>gnutls_ocsp_req_print</strong> <em>(gnutls_ocsp_req_t <var>req</var>, gnutls_ocsp_print_formats_t <var>format</var>, gnutls_datum_t * <var>out</var>)</em></dt>
<dd><p><var>req</var>: The data to be printed
</p>
<p><var>format</var>: Indicate the format to use
</p>
<p><var>out</var>: Newly allocated datum with (0) terminated string.
</p>
<p>This function will pretty print a OCSP request, suitable for
display to a human.
</p>
<p>If the format is <code>GNUTLS_OCSP_PRINT_FULL</code>  then all fields of the
request will be output, on multiple lines.
</p>
<p>The output  <code>out</code> -&gt;data needs to be deallocate using <code>gnutls_free()</code> .
</p>
<p><strong>Returns:</strong> On success, <code>GNUTLS_E_SUCCESS</code>  (0) is returned, otherwise a
negative error value.
</p></dd></dl>

<a name="gnutls_005focsp_005freq_005frandomize_005fnonce-1"></a>
<h4 class="subheading">gnutls_ocsp_req_randomize_nonce</h4>
<a name="gnutls_005focsp_005freq_005frandomize_005fnonce"></a><dl>
<dt><a name="index-gnutls_005focsp_005freq_005frandomize_005fnonce"></a>Function: <em>int</em> <strong>gnutls_ocsp_req_randomize_nonce</strong> <em>(gnutls_ocsp_req_t <var>req</var>)</em></dt>
<dd><p><var>req</var>: should contain a <code>gnutls_ocsp_req_t</code>  type
</p>
<p>This function will add or update an nonce extension to the OCSP
request with a newly generated random value.
</p>
<p><strong>Returns:</strong> On success, <code>GNUTLS_E_SUCCESS</code>  (0) is returned, otherwise a
negative error code is returned.
</p></dd></dl>

<a name="gnutls_005focsp_005freq_005fset_005fextension-1"></a>
<h4 class="subheading">gnutls_ocsp_req_set_extension</h4>
<a name="gnutls_005focsp_005freq_005fset_005fextension"></a><dl>
<dt><a name="index-gnutls_005focsp_005freq_005fset_005fextension"></a>Function: <em>int</em> <strong>gnutls_ocsp_req_set_extension</strong> <em>(gnutls_ocsp_req_t <var>req</var>, const char * <var>oid</var>, unsigned int <var>critical</var>, const gnutls_datum_t * <var>data</var>)</em></dt>
<dd><p><var>req</var>: should contain a <code>gnutls_ocsp_req_t</code>  type
</p>
<p><var>oid</var>: buffer with OID of extension as a string.
</p>
<p><var>critical</var>: critical flag, normally false.
</p>
<p><var>data</var>: the extension data
</p>
<p>This function will add an extension to the OCSP request.  Calling
this function multiple times for the same OID will overwrite values
from earlier calls.
</p>
<p><strong>Returns:</strong> On success, <code>GNUTLS_E_SUCCESS</code>  (0) is returned, otherwise a
negative error code is returned.
</p></dd></dl>

<a name="gnutls_005focsp_005freq_005fset_005fnonce-1"></a>
<h4 class="subheading">gnutls_ocsp_req_set_nonce</h4>
<a name="gnutls_005focsp_005freq_005fset_005fnonce"></a><dl>
<dt><a name="index-gnutls_005focsp_005freq_005fset_005fnonce"></a>Function: <em>int</em> <strong>gnutls_ocsp_req_set_nonce</strong> <em>(gnutls_ocsp_req_t <var>req</var>, unsigned int <var>critical</var>, const gnutls_datum_t * <var>nonce</var>)</em></dt>
<dd><p><var>req</var>: should contain a <code>gnutls_ocsp_req_t</code>  type
</p>
<p><var>critical</var>: critical flag, normally false.
</p>
<p><var>nonce</var>: the nonce data
</p>
<p>This function will add an nonce extension to the OCSP request.
Calling this function multiple times will overwrite values from
earlier calls.
</p>
<p><strong>Returns:</strong> On success, <code>GNUTLS_E_SUCCESS</code>  (0) is returned, otherwise a
negative error code is returned.
</p></dd></dl>

<a name="gnutls_005focsp_005fresp_005fcheck_005fcrt-1"></a>
<h4 class="subheading">gnutls_ocsp_resp_check_crt</h4>
<a name="gnutls_005focsp_005fresp_005fcheck_005fcrt"></a><dl>
<dt><a name="index-gnutls_005focsp_005fresp_005fcheck_005fcrt"></a>Function: <em>int</em> <strong>gnutls_ocsp_resp_check_crt</strong> <em>(gnutls_ocsp_resp_t <var>resp</var>, unsigned int <var>indx</var>, gnutls_x509_crt_t <var>crt</var>)</em></dt>
<dd><p><var>resp</var>: should contain a <code>gnutls_ocsp_resp_t</code>  type
</p>
<p><var>indx</var>: Specifies response number to get. Use (0) to get the first one.
</p>
<p><var>crt</var>: The certificate to check
</p>
<p>This function will check whether the OCSP response
is about the provided certificate.
</p>
<p><strong>Returns:</strong> On success, <code>GNUTLS_E_SUCCESS</code>  (0) is returned, otherwise a
negative error code is returned.  
</p>
<p><strong>Since:</strong> 3.1.3
</p></dd></dl>

<a name="gnutls_005focsp_005fresp_005fdeinit-1"></a>
<h4 class="subheading">gnutls_ocsp_resp_deinit</h4>
<a name="gnutls_005focsp_005fresp_005fdeinit"></a><dl>
<dt><a name="index-gnutls_005focsp_005fresp_005fdeinit"></a>Function: <em>void</em> <strong>gnutls_ocsp_resp_deinit</strong> <em>(gnutls_ocsp_resp_t <var>resp</var>)</em></dt>
<dd><p><var>resp</var>: The data to be deinitialized
</p>
<p>This function will deinitialize a OCSP response structure.
</p></dd></dl>

<a name="gnutls_005focsp_005fresp_005fexport-1"></a>
<h4 class="subheading">gnutls_ocsp_resp_export</h4>
<a name="gnutls_005focsp_005fresp_005fexport"></a><dl>
<dt><a name="index-gnutls_005focsp_005fresp_005fexport"></a>Function: <em>int</em> <strong>gnutls_ocsp_resp_export</strong> <em>(gnutls_ocsp_resp_t <var>resp</var>, gnutls_datum_t * <var>data</var>)</em></dt>
<dd><p><var>resp</var>: Holds the OCSP response
</p>
<p><var>data</var>: newly allocate buffer holding DER encoded OCSP response
</p>
<p>This function will export the OCSP response to DER format.
</p>
<p><strong>Returns:</strong> In case of failure a negative error code will be
returned, and 0 on success.
</p></dd></dl>

<a name="gnutls_005focsp_005fresp_005fget_005fcerts-1"></a>
<h4 class="subheading">gnutls_ocsp_resp_get_certs</h4>
<a name="gnutls_005focsp_005fresp_005fget_005fcerts"></a><dl>
<dt><a name="index-gnutls_005focsp_005fresp_005fget_005fcerts"></a>Function: <em>int</em> <strong>gnutls_ocsp_resp_get_certs</strong> <em>(gnutls_ocsp_resp_t <var>resp</var>, gnutls_x509_crt_t ** <var>certs</var>, size_t * <var>ncerts</var>)</em></dt>
<dd><p><var>resp</var>: should contain a <code>gnutls_ocsp_resp_t</code>  type
</p>
<p><var>certs</var>: newly allocated array with <code>gnutls_x509_crt_t</code>  certificates
</p>
<p><var>ncerts</var>: output variable with number of allocated certs.
</p>
<p>This function will extract the X.509 certificates found in the
Basic OCSP Response.  The  <code>certs</code> output variable will hold a newly
allocated zero-terminated array with X.509 certificates.
</p>
<p>Every certificate in the array needs to be de-allocated with
<code>gnutls_x509_crt_deinit()</code>  and the array itself must be freed using
<code>gnutls_free()</code> .
</p>
<p>Both the  <code>certs</code> and  <code>ncerts</code> variables may be NULL.  Then the
function will work as normal but will not return the NULL:d
information.  This can be used to get the number of certificates
only, or to just get the certificate array without its size.
</p>
<p><strong>Returns:</strong> On success, <code>GNUTLS_E_SUCCESS</code>  (0) is returned, otherwise a
negative error value.
</p></dd></dl>

<a name="gnutls_005focsp_005fresp_005fget_005fextension-1"></a>
<h4 class="subheading">gnutls_ocsp_resp_get_extension</h4>
<a name="gnutls_005focsp_005fresp_005fget_005fextension"></a><dl>
<dt><a name="index-gnutls_005focsp_005fresp_005fget_005fextension"></a>Function: <em>int</em> <strong>gnutls_ocsp_resp_get_extension</strong> <em>(gnutls_ocsp_resp_t <var>resp</var>, unsigned <var>indx</var>, gnutls_datum_t * <var>oid</var>, unsigned int * <var>critical</var>, gnutls_datum_t * <var>data</var>)</em></dt>
<dd><p><var>resp</var>: should contain a <code>gnutls_ocsp_resp_t</code>  type
</p>
<p><var>indx</var>: Specifies which extension OID to get. Use (0) to get the first one.
</p>
<p><var>oid</var>: will hold newly allocated buffer with OID of extension, may be NULL
</p>
<p><var>critical</var>: output variable with critical flag, may be NULL.
</p>
<p><var>data</var>: will hold newly allocated buffer with extension data, may be NULL
</p>
<p>This function will return all information about the requested
extension in the OCSP response.  The information returned is the
OID, the critical flag, and the data itself.  The extension OID
will be stored as a string.  Any of  <code>oid</code> ,  <code>critical</code> , and  <code>data</code> may
be NULL which means that the caller is not interested in getting
that information back.
</p>
<p>The caller needs to deallocate memory by calling <code>gnutls_free()</code>  on
 <code>oid</code> -&gt;data and  <code>data</code> -&gt;data.
</p>
<p><strong>Returns:</strong> On success, <code>GNUTLS_E_SUCCESS</code>  (0) is returned, otherwise a
negative error code is returned.  If you have reached the last
extension available <code>GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code>  will
be returned.
</p></dd></dl>

<a name="gnutls_005focsp_005fresp_005fget_005fnonce-1"></a>
<h4 class="subheading">gnutls_ocsp_resp_get_nonce</h4>
<a name="gnutls_005focsp_005fresp_005fget_005fnonce"></a><dl>
<dt><a name="index-gnutls_005focsp_005fresp_005fget_005fnonce"></a>Function: <em>int</em> <strong>gnutls_ocsp_resp_get_nonce</strong> <em>(gnutls_ocsp_resp_t <var>resp</var>, unsigned int * <var>critical</var>, gnutls_datum_t * <var>nonce</var>)</em></dt>
<dd><p><var>resp</var>: should contain a <code>gnutls_ocsp_resp_t</code>  type
</p>
<p><var>critical</var>: whether nonce extension is marked critical
</p>
<p><var>nonce</var>: will hold newly allocated buffer with nonce data
</p>
<p>This function will return the Basic OCSP Response nonce extension
data.
</p>
<p>The caller needs to deallocate memory by calling <code>gnutls_free()</code>  on
 <code>nonce</code> -&gt;data.
</p>
<p><strong>Returns:</strong> On success, <code>GNUTLS_E_SUCCESS</code>  (0) is returned, otherwise a
negative error code is returned.
</p></dd></dl>

<a name="gnutls_005focsp_005fresp_005fget_005fproduced-1"></a>
<h4 class="subheading">gnutls_ocsp_resp_get_produced</h4>
<a name="gnutls_005focsp_005fresp_005fget_005fproduced"></a><dl>
<dt><a name="index-gnutls_005focsp_005fresp_005fget_005fproduced"></a>Function: <em>time_t</em> <strong>gnutls_ocsp_resp_get_produced</strong> <em>(gnutls_ocsp_resp_t <var>resp</var>)</em></dt>
<dd><p><var>resp</var>: should contain a <code>gnutls_ocsp_resp_t</code>  type
</p>
<p>This function will return the time when the OCSP response was
signed.
</p>
<p><strong>Returns:</strong> signing time, or (time_t)-1 on error.
</p></dd></dl>

<a name="gnutls_005focsp_005fresp_005fget_005fresponder-1"></a>
<h4 class="subheading">gnutls_ocsp_resp_get_responder</h4>
<a name="gnutls_005focsp_005fresp_005fget_005fresponder"></a><dl>
<dt><a name="index-gnutls_005focsp_005fresp_005fget_005fresponder"></a>Function: <em>int</em> <strong>gnutls_ocsp_resp_get_responder</strong> <em>(gnutls_ocsp_resp_t <var>resp</var>, gnutls_datum_t * <var>dn</var>)</em></dt>
<dd><p><var>resp</var>: should contain a <code>gnutls_ocsp_resp_t</code>  type
</p>
<p><var>dn</var>: newly allocated buffer with name
</p>
<p>This function will extract the name of the Basic OCSP Response in
the provided buffer. The name will be in the form
&quot;C=xxxx,O=yyyy,CN=zzzz&quot; as described in RFC2253. The output string
will be ASCII or UTF-8 encoded, depending on the certificate data.
</p>
<p>If the responder ID is not a name but a hash, this function
will return zero and the  <code>dn</code> elements will be set to <code>NULL</code> .
</p>
<p>The caller needs to deallocate memory by calling <code>gnutls_free()</code>  on
 <code>dn</code> -&gt;data.
</p>
<p><strong>Returns:</strong> On success, <code>GNUTLS_E_SUCCESS</code>  (0) is returned, otherwise a
negative error code is returned.
</p></dd></dl>

<a name="gnutls_005focsp_005fresp_005fget_005fresponder_005fraw_005fid-1"></a>
<h4 class="subheading">gnutls_ocsp_resp_get_responder_raw_id</h4>
<a name="gnutls_005focsp_005fresp_005fget_005fresponder_005fraw_005fid"></a><dl>
<dt><a name="index-gnutls_005focsp_005fresp_005fget_005fresponder_005fraw_005fid"></a>Function: <em>int</em> <strong>gnutls_ocsp_resp_get_responder_raw_id</strong> <em>(gnutls_ocsp_resp_t <var>resp</var>, unsigned <var>type</var>, gnutls_datum_t * <var>raw</var>)</em></dt>
<dd><p><var>resp</var>: should contain a <code>gnutls_ocsp_resp_t</code>  type
</p>
<p><var>type</var>: should be <code>GNUTLS_OCSP_RESP_ID_KEY</code>  or <code>GNUTLS_OCSP_RESP_ID_DN</code> 
</p>
<p><var>raw</var>: newly allocated buffer with the raw ID
</p>
<p>This function will extract the raw key (or DN) ID of the Basic OCSP Response in
the provided buffer. If the responder ID is not a key ID then
this function will return <code>GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code> .
</p>
<p>The caller needs to deallocate memory by calling <code>gnutls_free()</code>  on
 <code>dn</code> -&gt;data.
</p>
<p><strong>Returns:</strong> On success, <code>GNUTLS_E_SUCCESS</code>  (0) is returned, otherwise a
negative error code is returned.
</p></dd></dl>

<a name="gnutls_005focsp_005fresp_005fget_005fresponse-1"></a>
<h4 class="subheading">gnutls_ocsp_resp_get_response</h4>
<a name="gnutls_005focsp_005fresp_005fget_005fresponse"></a><dl>
<dt><a name="index-gnutls_005focsp_005fresp_005fget_005fresponse"></a>Function: <em>int</em> <strong>gnutls_ocsp_resp_get_response</strong> <em>(gnutls_ocsp_resp_t <var>resp</var>, gnutls_datum_t * <var>response_type_oid</var>, gnutls_datum_t * <var>response</var>)</em></dt>
<dd><p><var>resp</var>: should contain a <code>gnutls_ocsp_resp_t</code>  type
</p>
<p><var>response_type_oid</var>: newly allocated output buffer with response type OID
</p>
<p><var>response</var>: newly allocated output buffer with DER encoded response
</p>
<p>This function will extract the response type OID in and the
response data from an OCSP response.  Normally the
 <code>response_type_oid</code> is always &quot;1.3.6.1.5.5.7.48.1.1&quot; which means the
 <code>response</code> should be decoded as a Basic OCSP Response, but
technically other response types could be used.
</p>
<p>This function is typically only useful when you want to extract the
response type OID of an response for diagnostic purposes.
Otherwise <code>gnutls_ocsp_resp_import()</code>  will decode the basic OCSP
response part and the caller need not worry about that aspect.
</p>
<p><strong>Returns:</strong> On success, <code>GNUTLS_E_SUCCESS</code>  (0) is returned, otherwise a
negative error value.
</p></dd></dl>

<a name="gnutls_005focsp_005fresp_005fget_005fsignature-1"></a>
<h4 class="subheading">gnutls_ocsp_resp_get_signature</h4>
<a name="gnutls_005focsp_005fresp_005fget_005fsignature"></a><dl>
<dt><a name="index-gnutls_005focsp_005fresp_005fget_005fsignature"></a>Function: <em>int</em> <strong>gnutls_ocsp_resp_get_signature</strong> <em>(gnutls_ocsp_resp_t <var>resp</var>, gnutls_datum_t * <var>sig</var>)</em></dt>
<dd><p><var>resp</var>: should contain a <code>gnutls_ocsp_resp_t</code>  type
</p>
<p><var>sig</var>: newly allocated output buffer with signature data
</p>
<p>This function will extract the signature field of a OCSP response.
</p>
<p><strong>Returns:</strong> On success, <code>GNUTLS_E_SUCCESS</code>  (0) is returned, otherwise a
negative error value.
</p></dd></dl>

<a name="gnutls_005focsp_005fresp_005fget_005fsignature_005falgorithm-1"></a>
<h4 class="subheading">gnutls_ocsp_resp_get_signature_algorithm</h4>
<a name="gnutls_005focsp_005fresp_005fget_005fsignature_005falgorithm"></a><dl>
<dt><a name="index-gnutls_005focsp_005fresp_005fget_005fsignature_005falgorithm"></a>Function: <em>int</em> <strong>gnutls_ocsp_resp_get_signature_algorithm</strong> <em>(gnutls_ocsp_resp_t <var>resp</var>)</em></dt>
<dd><p><var>resp</var>: should contain a <code>gnutls_ocsp_resp_t</code>  type
</p>
<p>This function will return a value of the <code>gnutls_sign_algorithm_t</code> 
enumeration that is the signature algorithm that has been used to
sign the OCSP response.
</p>
<p><strong>Returns:</strong> a <code>gnutls_sign_algorithm_t</code>  value, or a negative error code
on error.
</p></dd></dl>

<a name="gnutls_005focsp_005fresp_005fget_005fsingle-1"></a>
<h4 class="subheading">gnutls_ocsp_resp_get_single</h4>
<a name="gnutls_005focsp_005fresp_005fget_005fsingle"></a><dl>
<dt><a name="index-gnutls_005focsp_005fresp_005fget_005fsingle-1"></a>Function: <em>int</em> <strong>gnutls_ocsp_resp_get_single</strong> <em>(gnutls_ocsp_resp_t <var>resp</var>, unsigned <var>indx</var>, gnutls_digest_algorithm_t * <var>digest</var>, gnutls_datum_t * <var>issuer_name_hash</var>, gnutls_datum_t * <var>issuer_key_hash</var>, gnutls_datum_t * <var>serial_number</var>, unsigned int * <var>cert_status</var>, time_t * <var>this_update</var>, time_t * <var>next_update</var>, time_t * <var>revocation_time</var>, unsigned int * <var>revocation_reason</var>)</em></dt>
<dd><p><var>resp</var>: should contain a <code>gnutls_ocsp_resp_t</code>  type
</p>
<p><var>indx</var>: Specifies response number to get. Use (0) to get the first one.
</p>
<p><var>digest</var>: output variable with <code>gnutls_digest_algorithm_t</code>  hash algorithm
</p>
<p><var>issuer_name_hash</var>: output buffer with hash of issuer&rsquo;s DN
</p>
<p><var>issuer_key_hash</var>: output buffer with hash of issuer&rsquo;s public key
</p>
<p><var>serial_number</var>: output buffer with serial number of certificate to check
</p>
<p><var>cert_status</var>: a certificate status, a <code>gnutls_ocsp_cert_status_t</code>  enum.
</p>
<p><var>this_update</var>: time at which the status is known to be correct.
</p>
<p><var>next_update</var>: when newer information will be available, or (time_t)-1 if unspecified
</p>
<p><var>revocation_time</var>: when  <code>cert_status</code> is <code>GNUTLS_OCSP_CERT_REVOKED</code> , holds time of revocation.
</p>
<p><var>revocation_reason</var>: revocation reason, a <code>gnutls_x509_crl_reason_t</code>  enum.
</p>
<p>This function will return the certificate information of the
 <code>indx</code> &rsquo;ed response in the Basic OCSP Response  <code>resp</code> .  The
information returned corresponds to the OCSP SingleResponse structure
except the final singleExtensions.
</p>
<p>Each of the pointers to output variables may be NULL to indicate
that the caller is not interested in that value.
</p>
<p><strong>Returns:</strong> On success, <code>GNUTLS_E_SUCCESS</code>  (0) is returned, otherwise a
negative error code is returned.  If you have reached the last
CertID available <code>GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code>  will be
returned.
</p></dd></dl>

<a name="gnutls_005focsp_005fresp_005fget_005fstatus-1"></a>
<h4 class="subheading">gnutls_ocsp_resp_get_status</h4>
<a name="gnutls_005focsp_005fresp_005fget_005fstatus"></a><dl>
<dt><a name="index-gnutls_005focsp_005fresp_005fget_005fstatus"></a>Function: <em>int</em> <strong>gnutls_ocsp_resp_get_status</strong> <em>(gnutls_ocsp_resp_t <var>resp</var>)</em></dt>
<dd><p><var>resp</var>: should contain a <code>gnutls_ocsp_resp_t</code>  type
</p>
<p>This function will return the status of a OCSP response, an
<code>gnutls_ocsp_resp_status_t</code>  enumeration.
</p>
<p><strong>Returns:</strong> status of OCSP request as a <code>gnutls_ocsp_resp_status_t</code> , or
a negative error code on error.
</p></dd></dl>

<a name="gnutls_005focsp_005fresp_005fget_005fversion-1"></a>
<h4 class="subheading">gnutls_ocsp_resp_get_version</h4>
<a name="gnutls_005focsp_005fresp_005fget_005fversion"></a><dl>
<dt><a name="index-gnutls_005focsp_005fresp_005fget_005fversion"></a>Function: <em>int</em> <strong>gnutls_ocsp_resp_get_version</strong> <em>(gnutls_ocsp_resp_t <var>resp</var>)</em></dt>
<dd><p><var>resp</var>: should contain a <code>gnutls_ocsp_resp_t</code>  type
</p>
<p>This function will return the version of the Basic OCSP Response.
Typically this is always 1 indicating version 1.
</p>
<p><strong>Returns:</strong> version of Basic OCSP response, or a negative error code
on error.
</p></dd></dl>

<a name="gnutls_005focsp_005fresp_005fimport-1"></a>
<h4 class="subheading">gnutls_ocsp_resp_import</h4>
<a name="gnutls_005focsp_005fresp_005fimport"></a><dl>
<dt><a name="index-gnutls_005focsp_005fresp_005fimport"></a>Function: <em>int</em> <strong>gnutls_ocsp_resp_import</strong> <em>(gnutls_ocsp_resp_t <var>resp</var>, const gnutls_datum_t * <var>data</var>)</em></dt>
<dd><p><var>resp</var>: The data to store the parsed response.
</p>
<p><var>data</var>: DER encoded OCSP response.
</p>
<p>This function will convert the given DER encoded OCSP response to
the native <code>gnutls_ocsp_resp_t</code>  format.  It also decodes the Basic
OCSP Response part, if any.  The output will be stored in  <code>resp</code> .
</p>
<p><strong>Returns:</strong> On success, <code>GNUTLS_E_SUCCESS</code>  (0) is returned, otherwise a
negative error value.
</p></dd></dl>

<a name="gnutls_005focsp_005fresp_005finit-1"></a>
<h4 class="subheading">gnutls_ocsp_resp_init</h4>
<a name="gnutls_005focsp_005fresp_005finit"></a><dl>
<dt><a name="index-gnutls_005focsp_005fresp_005finit"></a>Function: <em>int</em> <strong>gnutls_ocsp_resp_init</strong> <em>(gnutls_ocsp_resp_t * <var>resp</var>)</em></dt>
<dd><p><var>resp</var>: A pointer to the type to be initialized
</p>
<p>This function will initialize an OCSP response structure.
</p>
<p><strong>Returns:</strong> On success, <code>GNUTLS_E_SUCCESS</code>  (0) is returned, otherwise a
negative error value.
</p></dd></dl>

<a name="gnutls_005focsp_005fresp_005fprint-1"></a>
<h4 class="subheading">gnutls_ocsp_resp_print</h4>
<a name="gnutls_005focsp_005fresp_005fprint"></a><dl>
<dt><a name="index-gnutls_005focsp_005fresp_005fprint"></a>Function: <em>int</em> <strong>gnutls_ocsp_resp_print</strong> <em>(gnutls_ocsp_resp_t <var>resp</var>, gnutls_ocsp_print_formats_t <var>format</var>, gnutls_datum_t * <var>out</var>)</em></dt>
<dd><p><var>resp</var>: The data to be printed
</p>
<p><var>format</var>: Indicate the format to use
</p>
<p><var>out</var>: Newly allocated datum with (0) terminated string.
</p>
<p>This function will pretty print a OCSP response, suitable for
display to a human.
</p>
<p>If the format is <code>GNUTLS_OCSP_PRINT_FULL</code>  then all fields of the
response will be output, on multiple lines.
</p>
<p>The output  <code>out</code> -&gt;data needs to be deallocate using <code>gnutls_free()</code> .
</p>
<p><strong>Returns:</strong> On success, <code>GNUTLS_E_SUCCESS</code>  (0) is returned, otherwise a
negative error value.
</p></dd></dl>

<a name="gnutls_005focsp_005fresp_005fverify-1"></a>
<h4 class="subheading">gnutls_ocsp_resp_verify</h4>
<a name="gnutls_005focsp_005fresp_005fverify"></a><dl>
<dt><a name="index-gnutls_005focsp_005fresp_005fverify"></a>Function: <em>int</em> <strong>gnutls_ocsp_resp_verify</strong> <em>(gnutls_ocsp_resp_t <var>resp</var>, gnutls_x509_trust_list_t <var>trustlist</var>, unsigned int * <var>verify</var>, unsigned int <var>flags</var>)</em></dt>
<dd><p><var>resp</var>: should contain a <code>gnutls_ocsp_resp_t</code>  type
</p>
<p><var>trustlist</var>: trust anchors as a <code>gnutls_x509_trust_list_t</code>  type
</p>
<p><var>verify</var>: output variable with verification status, an <code>gnutls_ocsp_verify_reason_t</code> 
</p>
<p><var>flags</var>: verification flags, 0 for now.
</p>
<p>Verify signature of the Basic OCSP Response against the public key
in the certificate of a trusted signer.  The  <code>trustlist</code> should be
populated with trust anchors.  The function will extract the signer
certificate from the Basic OCSP Response and will verify it against
the  <code>trustlist</code> .  A trusted signer is a certificate that is either
in  <code>trustlist</code> , or it is signed directly by a certificate in
 <code>trustlist</code> and has the id-ad-ocspSigning Extended Key Usage bit
set.
</p>
<p>The output  <code>verify</code> variable will hold verification status codes
(e.g., <code>GNUTLS_OCSP_VERIFY_SIGNER_NOT_FOUND</code> ,
<code>GNUTLS_OCSP_VERIFY_INSECURE_ALGORITHM</code> ) which are only valid if the
function returned <code>GNUTLS_E_SUCCESS</code> .
</p>
<p>Note that the function returns <code>GNUTLS_E_SUCCESS</code>  even when
verification failed.  The caller must always inspect the  <code>verify</code> variable to find out the verification status.
</p>
<p>The  <code>flags</code> variable should be 0 for now.
</p>
<p><strong>Returns:</strong> On success, <code>GNUTLS_E_SUCCESS</code>  (0) is returned, otherwise a
negative error value.
</p></dd></dl>

<a name="gnutls_005focsp_005fresp_005fverify_005fdirect-1"></a>
<h4 class="subheading">gnutls_ocsp_resp_verify_direct</h4>
<a name="gnutls_005focsp_005fresp_005fverify_005fdirect"></a><dl>
<dt><a name="index-gnutls_005focsp_005fresp_005fverify_005fdirect"></a>Function: <em>int</em> <strong>gnutls_ocsp_resp_verify_direct</strong> <em>(gnutls_ocsp_resp_t <var>resp</var>, gnutls_x509_crt_t <var>issuer</var>, unsigned int * <var>verify</var>, unsigned int <var>flags</var>)</em></dt>
<dd><p><var>resp</var>: should contain a <code>gnutls_ocsp_resp_t</code>  type
</p>
<p><var>issuer</var>: certificate believed to have signed the response
</p>
<p><var>verify</var>: output variable with verification status, an <code>gnutls_ocsp_verify_reason_t</code> 
</p>
<p><var>flags</var>: verification flags, 0 for now.
</p>
<p>Verify signature of the Basic OCSP Response against the public key
in the  <code>issuer</code> certificate.
</p>
<p>The output  <code>verify</code> variable will hold verification status codes
(e.g., <code>GNUTLS_OCSP_VERIFY_SIGNER_NOT_FOUND</code> ,
<code>GNUTLS_OCSP_VERIFY_INSECURE_ALGORITHM</code> ) which are only valid if the
function returned <code>GNUTLS_E_SUCCESS</code> .
</p>
<p>Note that the function returns <code>GNUTLS_E_SUCCESS</code>  even when
verification failed.  The caller must always inspect the  <code>verify</code> variable to find out the verification status.
</p>
<p>The  <code>flags</code> variable should be 0 for now.
</p>
<p><strong>Returns:</strong> On success, <code>GNUTLS_E_SUCCESS</code>  (0) is returned, otherwise a
negative error value.
</p></dd></dl>


<hr>
<div class="header">
<p>
Next: <a href="OpenPGP-API.html#OpenPGP-API" accesskey="n" rel="next">OpenPGP API</a>, Previous: <a href="PKCS-7-API.html#PKCS-7-API" accesskey="p" rel="prev">PKCS 7 API</a>, Up: <a href="API-reference.html#API-reference" accesskey="u" rel="up">API reference</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Function-and-Data-Index.html#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>



</body>
</html>